class merchant_calculation_callback_t(gxml.Document): tag_name = 'merchant-calculation-callback' serial_number = gxml.ID('@serial-number') buyer_id = gxml.Long('buyer-id', required=False) buyer_language = gxml.LanguageCode('buyer-language') calculate = gxml.Complex('calculate', calculate_t) shopping_cart = gxml.Complex('shopping-cart', shopping_cart_t)
class coupon_gift_adjustment_t(gxml.Node): code = gxml.String('code') calculated_amount = gxml.Complex('calculated-amount', price_t, required=False) applied_amount = gxml.Complex('applied-amount', price_t) message = gxml.String('message', required=False)
class chargeback_amount_notification_t(abstract_notification_t): tag_name = 'chargeback-amount-notification' latest_chargeback_amount = gxml.Complex('latest-chargeback-amount', price_t) latest_promotion_chargeback_amount = gxml.Complex( 'latest-promotion-chargeback-amount', price_t, required=False) total_chargeback_amount = gxml.Complex('total-chargeback-amount', price_t)
class tax_tables_t(gxml.Node): merchant_calculated = gxml.Boolean('@merchant-calculated', default=False) default = gxml.Complex('default-tax-table', default_tax_table_t) alternates = gxml.List('alternate-tax-tables', gxml.Complex('alternate-tax-table', alternate_tax_table_t), required=False)
class charge_amount_notification_t(abstract_notification_t): """ Represents information about a successful charge for an order. >>> from datetime import datetime >>> import iso8601 >>> test_document( ... charge_amount_notification_t( ... serial_number='95d44287-12b1-4722-bc56-cfaa73f4c0d1', ... google_order_number = '841171949013218', ... timestamp = iso8601.parse_date('2006-03-18T18:25:31.593Z'), ... latest_charge_amount = price_t(currency='USD', value=2226.06), ... total_charge_amount = price_t(currency='USD', value=2226.06) ... ) ... , ... ''' ... <charge-amount-notification xmlns="http://checkout.google.com/schema/2" serial-number="95d44287-12b1-4722-bc56-cfaa73f4c0d1"> ... <latest-charge-amount currency="USD">2226.060</latest-charge-amount> ... <google-order-number>841171949013218</google-order-number> ... <total-charge-amount currency="USD">2226.060</total-charge-amount> ... <timestamp>2006-03-18T18:25:31.593000+00:00</timestamp> ... </charge-amount-notification> ... ''' ... ) """ tag_name = 'charge-amount-notification' latest_charge_amount = gxml.Complex('latest-charge-amount', price_t) latest_promotion_charge_amount = gxml.Complex( 'latest-promotion-charge-amount', price_t, required=False) total_charge_amount = gxml.Complex('total-charge-amount', price_t)
class carrier_calculated_shipping_t(gxml.Node): carrier_calculated_shipping_options = gxml.List( 'carrier-calculated-shipping-options', gxml.Complex('carrier-calculated-shipping-option', carrier_calculated_shipping_option_t)) shipping_packages = gxml.List( 'shipping-packages', gxml.Complex('shipping-package', shipping_package_t))
class address_filters_t(gxml.Node): allowed_areas = gxml.Complex('allowed-areas', allowed_areas_t, required=False) excluded_areas = gxml.Complex('excluded-areas', excluded_areas_t, required=False) allow_us_po_box = gxml.Boolean('allow-us-po-box', required=False)
class shipping_package_t(gxml.Node): delivery_address_category = gxml.String('delivery-address-category', values=('RESIDENTIAL', 'COMMERCIAL'), required=False) height = gxml.Complex('height', measure_t) length = gxml.Complex('length', measure_t) ship_from = gxml.Complex('ship-from', ship_from_t) width = gxml.Complex('width', measure_t)
class checkout_shopping_cart_t(gxml.Document): tag_name = 'checkout-shopping-cart' shopping_cart = gxml.Complex('shopping-cart', shopping_cart_t) checkout_flow_support = gxml.Complex( 'checkout-flow-support/merchant-checkout-flow-support', checkout_flow_support_t) request_initial_auth_details = gxml.Boolean( 'order-processing-support/request-initial-auth-details', required=False)
class result_t(gxml.Node): shipping_name = gxml.String('@shipping-name') address_id = gxml.String('@address-id') total_tax = gxml.Complex('total-tax', price_t, required=False) shipping_rate = gxml.Complex('shipping-rate', price_t, required=False) shippable = gxml.Boolean('shippable', required=False) merchant_code_results = gxml.Complex('merchant-code-results', merchant_code_results_t, required=False)
class calculate_t(gxml.Node): addresses = gxml.List('addresses', gxml.Complex('anonymous-address', anonymous_address_t), required=False) merchant_code_strings = gxml.Complex( 'merchant-code-strings/merchant-code-string', merchant_code_string_t, required=False) shipping = gxml.Complex('shipping', shipping_in_calculate_t, required=False) tax = gxml.Boolean('tax')
class order_adjustment_t(gxml.Node): adjustment_total = gxml.Complex('adjustment-total', price_t, required=False) merchant_calculation_successful = gxml.Boolean( 'merchant-calculation-successful', required=False) merchant_codes = gxml.Complex('merchant-codes', merchant_codes_t, required=False) shipping = gxml.Complex('shipping', shipping_in_order_adjustment_t, required=False) total_tax = gxml.Complex('total-tax', price_t, required=False)
class carrier_calculated_shipping_option_t(gxml.Node): price = gxml.Complex('price', price_t) shipping_company = gxml.String('shipping-company', values=('FedEx', 'UPS', 'USPS')) carrier_pickup = gxml.String('carrier-pickup', values=('REGULAR_PICKUP', 'SPECIAL_PICKUP', 'DROP_OFF'), default='DROP_OFF', required=False) shipping_type = gxml.String('shipping-type') additional_fixed_charge = gxml.Complex('additional-fixed-charge', price_t, required=False) additional_variable_charge_percent = gxml.Double( 'additional-variable-charge-percent', required=False)
class shipping_in_order_adjustment_t(gxml.Node): carrier_calculated_shipping_adjustment = gxml.Complex( 'carrier-calculated-shipping-adjustment', carrier_calculated_shipping_adjustment_t, required=False) flat_rate_shipping_adjustment = gxml.Complex( 'flat-rate-shipping-adjustment', shipping_adjustment_t, required=False) merchant_calculated_shipping_adjustment = gxml.Complex( 'merchant-calculated-shipping-adjustment', shipping_adjustment_t, required=False) pickup_shipping_adjustment = gxml.Complex('pickup-shipping-adjustment', shipping_adjustment_t, required=False) methods = gxml.List('', gxml.String('method/@name'))
class add_tracking_data_t(abstract_order_t): """ Represents a tag containing a request to add a shipper's tracking number to an order. >>> test_document( ... add_tracking_data_t( ... google_order_number = '841171949013218', ... tracking_data = tracking_data_t( ... carrier = 'UPS', ... tracking_number = 'Z9842W69871281267' ... ) ... ) ... , ... ''' ... <add-tracking-data xmlns="http://checkout.google.com/schema/2" ... google-order-number="841171949013218"> ... <tracking-data> ... <tracking-number>Z9842W69871281267</tracking-number> ... <carrier>UPS</carrier> ... </tracking-data> ... </add-tracking-data> ... ''' ... ) """ tag_name = 'add-tracking-data' tracking_data = gxml.Complex('tracking-data', tracking_data_t)
class authorization_amount_notification_t(abstract_notification_t): tag_name = 'authorization-amount-notification' authorization_amount = gxml.Complex('authorization-amount', price_t) authorization_expiration_date = gxml.Timestamp( 'authorization-expiration-date') avs_response = gxml.String('avs-response', values=AVS_VALUES) cvn_response = gxml.String('cvn-response', values=CVN_VALUES)
class shopping_cart_t(gxml.Node): expiration = gxml.Timestamp('cart-expiration/good-until-date', required=False) items = gxml.List('items', gxml.Complex('item', item_t)) merchant_private_data = gxml.Any('merchant-private-data', save_node_and_xml=True, required=False)
class risk_information_t(gxml.Node): avs_response = gxml.String('avs-response', values=AVS_VALUES) billing_address = gxml.Complex('billing-address', billing_address_t) buyer_account_age = gxml.Integer('buyer-account-age') cvn_response = gxml.String('cvn-response', values=CVN_VALUES) eligible_for_protection = gxml.Boolean('eligible-for-protection') ip_address = gxml.IP('ip-address') partial_cc_number = gxml.String('partial-cc-number') # partial CC Number
class shipping_methods_t(gxml.Node): carrier_calculated_shippings = gxml.List( '', gxml.Complex('carrier-calculated-shipping', carrier_calculated_shipping_t), required=False) # list of carrier_calculated_shipping_t flat_rate_shippings = gxml.List( '', gxml.Complex('flat-rate-shipping', flat_rate_shipping_t), required=False) # list of flat_rate_shipping_t merchant_calculated_shippings = gxml.List( '', gxml.Complex('merchant-calculated-shipping', merchant_calculated_shipping_t), required=False) # list of merchant_calculated_shipping_t pickups = gxml.List('', gxml.Complex('pickup', pickup_t), required=False) # list of pickup_t
class shipping_option_t(gxml.Node): """ Represents information about shipping costs. >>> test_node( ... shipping_option_t( ... name = 'Testing', ... price = price_t( ... currency = 'GBP', ... value = 9.99, ... ), ... allowed_areas = allowed_areas_t( ... world_area = True, ... ), ... excluded_areas = excluded_areas_t( ... postal_areas = [postal_area_t( ... country_code = 'US', ... )], ... ), ... ) ... , ''' ... <node name='Testing'> ... <price currency='GBP'>9.990</price> ... <shipping-restrictions> ... <allowed-areas> ... <world-area/> ... </allowed-areas> ... <excluded-areas> ... <postal-area> ... <country-code>US</country-code> ... </postal-area> ... </excluded-areas> ... </shipping-restrictions> ... </node> ... ''') """ name = gxml.String('@name') # Attribute, len <= 255, not-empty price = gxml.Complex('price', price_t) allowed_areas = gxml.Complex('shipping-restrictions/allowed-areas', allowed_areas_t, required=False) excluded_areas = gxml.Complex('shipping-restrictions/excluded-areas', excluded_areas_t, required=False)
class tax_area_t(gxml.Node): world_area = PresentOrNot('world-area', required=False) postal_area = gxml.Complex('postal-area', postal_area_t, required=False) us_state = gxml.String('us-state-area/state', required=False) us_zip_pattern = gxml.String( 'us-zip-area/zip-pattern', required=False) # regex: [a-zA-Z0-9_]+\*? Note the optional asterisk us_country_area = gxml.String( 'us-country-area/country-area', values=('CONTINENTAL_48', 'FULL_50_STATES', 'ALL'), required=False) # enum('CONTINENTAL_48', 'FULL_50_STATES', 'ALL')
class item_t(gxml.Node): """ >>> test_node(item_t(name='Peter', description='The Great', unit_price=price_t(value=1, currency='GBP'), quantity=1, merchant_item_id='custom_merchant_item_id', ... merchant_private_item_data=['some', {'private':'data', 'to':['test','the'],'thing':None}, '!! Numbers: ', None, False, True, [11, 12., [13.4]]]) ... ) >>> test_node(item_t(name='Name with empty description', description='', unit_price=price_t(value=1, currency='GBP'), quantity=1)) """ name = gxml.String('item-name') description = gxml.String('item-description') unit_price = gxml.Complex('unit-price', price_t) quantity = gxml.Decimal('quantity') item_weight = gxml.Complex('item-weight', item_weight_t, required=False) merchant_item_id = gxml.String('merchant-item-id', required=False) tax_table_selector = gxml.String('tax-table-selector', required=False) digital_content = gxml.Complex('digital-content', digital_content_t, required=False) merchant_private_item_data = gxml.Any('merchant-private-item-data', save_node_and_xml=True, required=False)
class address_t(gxml.Node): address1 = gxml.String('address1') address2 = gxml.String('address2', required=False) city = gxml.String('city') company_name = gxml.String('company-name', required=False) contact_name = gxml.String('contact-name', required=False) country_code = gxml.String('country-code') email = gxml.Email('email', required=False) fax = gxml.Phone('fax', required=False, empty=True) phone = gxml.Phone('phone', required=False, empty=True) postal_code = gxml.Zip('postal-code') region = gxml.String('region', empty=True) structured_name = gxml.Complex('structured-name', structured_name_t, required=False)
class new_order_notification_t(abstract_notification_t): tag_name = 'new-order-notification' buyer_billing_address = gxml.Complex('buyer-billing-address', buyer_billing_address_t) buyer_id = gxml.Long('buyer-id') buyer_marketing_preferences = gxml.Complex('buyer-marketing-preferences', buyer_marketing_preferences_t) buyer_shipping_address = gxml.Complex('buyer-shipping-address', buyer_shipping_address_t) financial_order_state = gxml.String('financial-order-state', values=FINANCIAL_ORDER_STATE) fulfillment_order_state = gxml.String('fulfillment-order-state', values=FULFILLMENT_ORDER_STATE) order_adjustment = gxml.Complex('order-adjustment', order_adjustment_t) order_total = gxml.Complex('order-total', price_t) shopping_cart = gxml.Complex('shopping-cart', shopping_cart_t) promotions = gxml.List('promotions', gxml.Complex('promotion', promotion_t), required=False)
class merchant_code_results_t(gxml.Node): coupon_result = gxml.List('', gxml.Complex('coupon-result', discount_result_t)) gift_certificate_result = gxml.List( '', gxml.Complex('gift-certificate-result', discount_result_t))
class discount_result_t(gxml.Node): valid = gxml.Boolean('valid') calculated_amount = gxml.Complex('calculated-amount', price_t) code = gxml.String('code') message = gxml.String('message', max_length=255)
class charge_order_t(abstract_order_t): tag_name = 'charge-order' amount = gxml.Complex('amount', price_t, required=False)
class refund_order_t(abstract_order_t): tag_name = 'refund-order' amount = gxml.Complex('amount', price_t, required=False) comment = gxml.String('comment', max_length=140, required=False) reason = gxml.String('reason', max_length=140)
class deliver_order_t(abstract_order_t): tag_name = 'deliver-order' tracking_data = gxml.Complex('tracking-data', tracking_data_t, required=False) send_email = gxml.Boolean('send-email', required=False)
class refund_amount_notification_t(abstract_notification_t): tag_name = 'refund-amount-notification' latest_refund_amount = gxml.Complex('latest-refund-amount', price_t) latest_promotion_refund_amount = gxml.Complex( 'latest-promotion-refund-amount', price_t, required=False) total_refund_amount = gxml.Complex('total-refund-amount', price_t)