workarea-global_e 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.eslintrc.json +37 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
- data/.github/ISSUE_TEMPLATE/documentation-request.md +17 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.github/workflows/ci.yml +77 -0
- data/.gitignore +20 -0
- data/.rubocop.yml +2 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +261 -0
- data/Gemfile +16 -0
- data/README.md +39 -0
- data/Rakefile +59 -0
- data/app/assets/javascripts/workarea/storefront/global_e/modules/checkout_info_validator.js +122 -0
- data/app/assets/javascripts/workarea/storefront/global_e/modules/suppress_price_ranges.js +19 -0
- data/app/controllers/workarea/admin/country_exceptions_controller.rb +67 -0
- data/app/controllers/workarea/admin/fixed_prices_controller.rb +89 -0
- data/app/controllers/workarea/admin/orders_controller.decorator +6 -0
- data/app/controllers/workarea/storefront/application_controller.decorator +30 -0
- data/app/controllers/workarea/storefront/checkouts_controller.decorator +22 -0
- data/app/controllers/workarea/storefront/ge_checkouts_controller.rb +10 -0
- data/app/controllers/workarea/storefront/global_e_controller.rb +42 -0
- data/app/controllers/workarea/storefront/globale/api_controller.rb +108 -0
- data/app/controllers/workarea/storefront/globale/refund_controller.rb +65 -0
- data/app/controllers/workarea/storefront/users/logins_controller.decorator +13 -0
- data/app/helpers/workarea/admin/global_e_helpers.rb +28 -0
- data/app/models/workarea/address.decorator +11 -0
- data/app/models/workarea/catalog/product.decorator +14 -0
- data/app/models/workarea/fulfillment/status/partially_refunded.rb +13 -0
- data/app/models/workarea/fulfillment/status/refunded.rb +15 -0
- data/app/models/workarea/fulfillment.decorator +55 -0
- data/app/models/workarea/global_e/country_exception.rb +37 -0
- data/app/models/workarea/global_e/fixed_price.rb +93 -0
- data/app/models/workarea/global_e/order_api_events.rb +29 -0
- data/app/models/workarea/order/item.decorator +46 -0
- data/app/models/workarea/order/status/pending_global_e_fraud_check.rb +12 -0
- data/app/models/workarea/order.decorator +64 -0
- data/app/models/workarea/payment/status/global_e_appoved.rb +9 -0
- data/app/models/workarea/payment/status/pending_global_e_fraud_check.rb +9 -0
- data/app/models/workarea/payment/tender/global_e_payment.rb +16 -0
- data/app/models/workarea/payment.decorator +10 -0
- data/app/models/workarea/price_adjustment.decorator +13 -0
- data/app/models/workarea/price_adjustment_set.decorator +25 -0
- data/app/models/workarea/pricing/calculators/item_calculator.decorator +48 -0
- data/app/models/workarea/pricing/collection.decorator +90 -0
- data/app/models/workarea/pricing/discount/appliation_group.decorator +16 -0
- data/app/models/workarea/pricing/discount/international_item_proxy.rb +27 -0
- data/app/models/workarea/pricing/discount/international_order.rb +29 -0
- data/app/models/workarea/pricing/discount.decorator +65 -0
- data/app/models/workarea/pricing/price_distributor.decorator +37 -0
- data/app/models/workarea/pricing/request.decorator +17 -0
- data/app/models/workarea/pricing/sku.decorator +17 -0
- data/app/models/workarea/search/admin/order.decorator +11 -0
- data/app/models/workarea/shipping/sku.decorator +23 -0
- data/app/models/workarea/shipping.decorator +11 -0
- data/app/models/workarea/user.decorator +10 -0
- data/app/seeds/workarea/global_e_seeds.rb +66 -0
- data/app/services/workarea/create_fulfillment.decorator +12 -0
- data/app/services/workarea/global_e/address_details.rb +218 -0
- data/app/services/workarea/global_e/api/notify_order_refunded.rb +45 -0
- data/app/services/workarea/global_e/api/perform_order_payment.rb +46 -0
- data/app/services/workarea/global_e/api/remove_restricted_products.rb +28 -0
- data/app/services/workarea/global_e/api/send_order_to_merchant/item_pricer.rb +147 -0
- data/app/services/workarea/global_e/api/send_order_to_merchant/save_user.rb +59 -0
- data/app/services/workarea/global_e/api/send_order_to_merchant.rb +359 -0
- data/app/services/workarea/global_e/api/update_order_shipping_info.rb +38 -0
- data/app/services/workarea/global_e/api/update_order_status/canceled.rb +42 -0
- data/app/services/workarea/global_e/api/update_order_status.rb +28 -0
- data/app/services/workarea/global_e/attribute.rb +44 -0
- data/app/services/workarea/global_e/brand.rb +19 -0
- data/app/services/workarea/global_e/cart_user_details.rb +34 -0
- data/app/services/workarea/global_e/category.rb +19 -0
- data/app/services/workarea/global_e/checkout_cart_info.rb +358 -0
- data/app/services/workarea/global_e/custom_product_attribute.rb +19 -0
- data/app/services/workarea/global_e/discount.rb +215 -0
- data/app/services/workarea/global_e/merchant/brand.rb +21 -0
- data/app/services/workarea/global_e/merchant/category.rb +21 -0
- data/app/services/workarea/global_e/merchant/customer.rb +36 -0
- data/app/services/workarea/global_e/merchant/customer_details.rb +201 -0
- data/app/services/workarea/global_e/merchant/discount.rb +127 -0
- data/app/services/workarea/global_e/merchant/international_details.rb +296 -0
- data/app/services/workarea/global_e/merchant/order.rb +425 -0
- data/app/services/workarea/global_e/merchant/order_refund.rb +103 -0
- data/app/services/workarea/global_e/merchant/original_order.rb +28 -0
- data/app/services/workarea/global_e/merchant/parcel_tracking.rb +31 -0
- data/app/services/workarea/global_e/merchant/payment_details.rb +161 -0
- data/app/services/workarea/global_e/merchant/product.rb +222 -0
- data/app/services/workarea/global_e/merchant/refund_product.rb +69 -0
- data/app/services/workarea/global_e/merchant/response_info.rb +115 -0
- data/app/services/workarea/global_e/merchant_cart_product_attribute.rb +21 -0
- data/app/services/workarea/global_e/order_status.rb +20 -0
- data/app/services/workarea/global_e/order_status_details.rb +79 -0
- data/app/services/workarea/global_e/order_status_reason.rb +20 -0
- data/app/services/workarea/global_e/parcel.rb +53 -0
- data/app/services/workarea/global_e/product.rb +612 -0
- data/app/services/workarea/global_e/product_meta_data.rb +13 -0
- data/app/services/workarea/global_e/tracking_details.rb +23 -0
- data/app/services/workarea/global_e/update_order_dispatch_exception.rb +46 -0
- data/app/services/workarea/global_e/update_order_dispatch_request.rb +108 -0
- data/app/services/workarea/global_e/user_id_number_type.rb +21 -0
- data/app/services/workarea/global_e/users_details.rb +151 -0
- data/app/services/workarea/global_e/vat_category.rb +20 -0
- data/app/services/workarea/global_e/vat_rate_type.rb +27 -0
- data/app/services/workarea/save_order_analytics.decorator +18 -0
- data/app/view_models/workarea/admin/order_view_model.decorator +13 -0
- data/app/view_models/workarea/storefront/cart_view_model.decorator +7 -0
- data/app/view_models/workarea/storefront/order_item_view_model.decorator +16 -0
- data/app/view_models/workarea/storefront/order_view_model.decorator +45 -0
- data/app/view_models/workarea/storefront/product_view_model.decorator +35 -0
- data/app/views/workarea/admin/catalog_products/_country_exceptions_card.html.haml +31 -0
- data/app/views/workarea/admin/catalog_products/_global_e_attributes.html.haml +3 -0
- data/app/views/workarea/admin/catalog_products/_global_e_fields.html.haml +4 -0
- data/app/views/workarea/admin/country_exceptions/edit.html.haml +48 -0
- data/app/views/workarea/admin/country_exceptions/index.html.haml +47 -0
- data/app/views/workarea/admin/country_exceptions/new.html.haml +44 -0
- data/app/views/workarea/admin/fixed_prices/edit.html.haml +73 -0
- data/app/views/workarea/admin/fixed_prices/index.html.haml +55 -0
- data/app/views/workarea/admin/fixed_prices/new.html.haml +70 -0
- data/app/views/workarea/admin/orders/_global_e.html.haml +27 -0
- data/app/views/workarea/admin/orders/attributes.html.haml +131 -0
- data/app/views/workarea/admin/orders/global_e.html.haml +110 -0
- data/app/views/workarea/admin/orders/show.html.haml +27 -0
- data/app/views/workarea/admin/orders/tenders/_global_e_payment.html.haml +3 -0
- data/app/views/workarea/admin/pricing_skus/_cards.html.haml +98 -0
- data/app/views/workarea/storefront/cart_items/create.html.haml +71 -0
- data/app/views/workarea/storefront/carts/_pricing.html.haml +14 -0
- data/app/views/workarea/storefront/carts/show.html.haml +187 -0
- data/app/views/workarea/storefront/ge_checkouts/show.html.haml +1 -0
- data/app/views/workarea/storefront/global_e/_country_picker.html.haml +1 -0
- data/app/views/workarea/storefront/global_e/_head.html.haml +10 -0
- data/app/views/workarea/storefront/orders/_summary.html.haml +275 -0
- data/app/views/workarea/storefront/orders/tenders/_global_e_payment.html.haml +3 -0
- data/app/views/workarea/storefront/products/_pricing.html.haml +49 -0
- data/app/views/workarea/storefront/products/_restricted_item_text.html.haml +1 -0
- data/app/views/workarea/storefront/users/orders/_summary.html.haml +22 -0
- data/app/workers/workarea/global_e/update_order_dispatch.rb +28 -0
- data/app/workers/workarea/save_user_order_details.decorator +9 -0
- data/bin/rails +25 -0
- data/config/initializers/appends.rb +46 -0
- data/config/initializers/seeds.rb +1 -0
- data/config/initializers/workarea.rb +64 -0
- data/config/locales/en.yml +105 -0
- data/config/routes.rb +31 -0
- data/lib/workarea/global_e/engine.rb +10 -0
- data/lib/workarea/global_e/error.rb +8 -0
- data/lib/workarea/global_e/version.rb +5 -0
- data/lib/workarea/global_e.rb +58 -0
- data/script/admin_ci +5 -0
- data/script/ci +8 -0
- data/script/core_ci +5 -0
- data/script/plugins_ci +5 -0
- data/script/storefront_ci +5 -0
- data/test/dummy/.ruby-version +1 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/config/manifest.js +3 -0
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/javascripts/application.js +14 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +2 -0
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/jobs/application_job.rb +2 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +15 -0
- data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +28 -0
- data/test/dummy/bin/update +28 -0
- data/test/dummy/bin/yarn +11 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +52 -0
- data/test/dummy/config/environments/production.rb +83 -0
- data/test/dummy/config/environments/test.rb +45 -0
- data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/test/dummy/config/initializers/assets.rb +14 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/content_security_policy.rb +25 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/workarea.rb +5 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +9 -0
- data/test/dummy/config/locales/en.yml +33 -0
- data/test/dummy/config/puma.rb +34 -0
- data/test/dummy/config/routes.rb +5 -0
- data/test/dummy/config/secrets.yml +18 -0
- data/test/dummy/config/spring.rb +6 -0
- data/test/dummy/config.ru +5 -0
- data/test/dummy/db/seeds.rb +2 -0
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/log/.keep +0 -0
- data/test/factories/workarea/global_e_factories.rb +836 -0
- data/test/integration/workarea/admin/catalog_product_country_exceptions_integration_test.rb +81 -0
- data/test/integration/workarea/admin/global_e_jump_to_integration_test.rb +20 -0
- data/test/integration/workarea/admin/pricing_sku_fixed_prices_integration_test.rb +83 -0
- data/test/integration/workarea/storefront/global_e_api/receive_order_integration_test.rb +278 -0
- data/test/integration/workarea/storefront/global_e_api/receive_order_refund_integration_test.rb +25 -0
- data/test/integration/workarea/storefront/global_e_api/receive_payment_integration_test.rb +34 -0
- data/test/integration/workarea/storefront/global_e_api/receive_shipping_info_integration_test.rb +29 -0
- data/test/integration/workarea/storefront/global_e_api/remove_restricted_products_integration_test.rb +27 -0
- data/test/integration/workarea/storefront/global_e_api/update_order_status_integration_test.rb +29 -0
- data/test/integration/workarea/storefront/global_e_checkout_cart_info/fixed_pricing_test.rb +438 -0
- data/test/integration/workarea/storefront/global_e_checkout_cart_info/gift_card_test.rb +63 -0
- data/test/integration/workarea/storefront/global_e_checkout_cart_info_integration_test.rb +660 -0
- data/test/integration/workarea/storefront/global_e_checkouts_integration_test.rb +71 -0
- data/test/integration/workarea/storefront/users/global_e_logins_integration_test.rb +20 -0
- data/test/models/workarea/catalog/product_global_e_test.rb +13 -0
- data/test/models/workarea/fixed_pricing_test.rb +117 -0
- data/test/models/workarea/global_e/country_exception_test.rb +36 -0
- data/test/models/workarea/payment_test.decorator +31 -0
- data/test/models/workarea/pricing/calculators/item_calculator_fixed_prices_test.rb +83 -0
- data/test/models/workarea/pricing/collection_fixed_prices_test.rb +83 -0
- data/test/models/workarea/pricing/price_distributor_test.decorator +21 -0
- data/test/models/workarea/pricing/sku_fixed_price_test.rb +133 -0
- data/test/support/workarea/global_e_support.rb +18 -0
- data/test/system/workarea/admin/global_e_system_test.rb +21 -0
- data/test/system/workarea/storefront/global_e_cart_system_test.rb +48 -0
- data/test/system/workarea/storefront/global_e_order_history_system_test.rb +43 -0
- data/test/teaspoon_env.rb +6 -0
- data/test/test_helper.rb +9 -0
- data/test/view_models/workarea/admin/global_e_order_view_model_test.rb +22 -0
- data/test/workers/workarea/global_e/update_order_dispatch_test.rb +64 -0
- data/test/workers/workarea/global_e_save_user_order_details_test.rb +41 -0
- data/workarea-global_e.gemspec +16 -0
- metadata +293 -0
@@ -0,0 +1,36 @@
|
|
1
|
+
module Workarea
|
2
|
+
module GlobalE
|
3
|
+
module Merchant
|
4
|
+
class Customer
|
5
|
+
attr_reader :hash
|
6
|
+
|
7
|
+
def initialize(hash)
|
8
|
+
@hash = hash
|
9
|
+
end
|
10
|
+
|
11
|
+
# Indicates if e-mail confirmation of the respective order’s status
|
12
|
+
# change needs to be sent to the paying customer (Global-e acts
|
13
|
+
# as a paying customer).
|
14
|
+
#
|
15
|
+
# @return [Boolean]
|
16
|
+
#
|
17
|
+
def send_confirmation
|
18
|
+
hash["SendConfirmation"]
|
19
|
+
end
|
20
|
+
|
21
|
+
# Indicates if end customer details are “swapped” with a paying
|
22
|
+
# (Global-e) customer’s details when submitting the order to the
|
23
|
+
# Merchant. By default IsEndCustomerPrimary is FALSE which means that
|
24
|
+
# Primary customer denotes the paying (Global-e) customer and Secondary
|
25
|
+
# customer denotes the end customer who has placed the order with
|
26
|
+
# Global-e checkout
|
27
|
+
#
|
28
|
+
# @return [Boolean]
|
29
|
+
#
|
30
|
+
def is_end_customer_primary
|
31
|
+
hash["IsEndCustomerPrimary"]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,201 @@
|
|
1
|
+
module Workarea
|
2
|
+
module GlobalE
|
3
|
+
module Merchant
|
4
|
+
class CustomerDetails
|
5
|
+
attr_reader :hash, :url_encoded
|
6
|
+
|
7
|
+
def initialize(hash, url_encoded: false)
|
8
|
+
@hash = hash
|
9
|
+
@url_encoded = url_encoded
|
10
|
+
end
|
11
|
+
|
12
|
+
# Attributes used for saving to a {Workarea::Address}
|
13
|
+
#
|
14
|
+
# @return [Hash]
|
15
|
+
#
|
16
|
+
def workarea_address_attributes
|
17
|
+
{
|
18
|
+
first_name: first_name,
|
19
|
+
last_name: last_name,
|
20
|
+
street: address1,
|
21
|
+
street_2: address2,
|
22
|
+
city: city,
|
23
|
+
region: state_code,
|
24
|
+
postal_code: zip,
|
25
|
+
country: Country[country_code],
|
26
|
+
phone_number: phone1,
|
27
|
+
skip_region_presence: true
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
# First Name
|
32
|
+
#
|
33
|
+
# @return [String]
|
34
|
+
#
|
35
|
+
def first_name
|
36
|
+
decode hash["FirstName"]
|
37
|
+
end
|
38
|
+
|
39
|
+
# Last name
|
40
|
+
#
|
41
|
+
# @return [String]
|
42
|
+
#
|
43
|
+
def last_name
|
44
|
+
decode hash["LastName"]
|
45
|
+
end
|
46
|
+
|
47
|
+
# Middle name
|
48
|
+
#
|
49
|
+
# @return [String]
|
50
|
+
#
|
51
|
+
def middle_name
|
52
|
+
decode hash["MiddleName"]
|
53
|
+
end
|
54
|
+
|
55
|
+
# Salutation or title (e.g. Dr., Mr., etc.)
|
56
|
+
#
|
57
|
+
# @return [String]
|
58
|
+
#
|
59
|
+
def salutation
|
60
|
+
decode hash["Salutation"]
|
61
|
+
end
|
62
|
+
|
63
|
+
# Phone 1
|
64
|
+
#
|
65
|
+
# @return [String]
|
66
|
+
#
|
67
|
+
def phone1
|
68
|
+
decode hash["Phone1"]
|
69
|
+
end
|
70
|
+
|
71
|
+
# Phone 2
|
72
|
+
#
|
73
|
+
# @return [String]
|
74
|
+
#
|
75
|
+
def phone2
|
76
|
+
decode hash["Phone2"]
|
77
|
+
end
|
78
|
+
|
79
|
+
# Fax
|
80
|
+
#
|
81
|
+
# @return [String]
|
82
|
+
#
|
83
|
+
def fax
|
84
|
+
decode hash["Fax"]
|
85
|
+
end
|
86
|
+
|
87
|
+
# E-mail address
|
88
|
+
#
|
89
|
+
# @return [String]
|
90
|
+
#
|
91
|
+
def email
|
92
|
+
decode hash["Email"]
|
93
|
+
end
|
94
|
+
|
95
|
+
# Company name
|
96
|
+
#
|
97
|
+
# @return [String]
|
98
|
+
#
|
99
|
+
def company
|
100
|
+
decode hash["Company"]
|
101
|
+
end
|
102
|
+
|
103
|
+
# Address line 1
|
104
|
+
#
|
105
|
+
# @return [String]
|
106
|
+
#
|
107
|
+
def address1
|
108
|
+
decode hash["Address1"]
|
109
|
+
end
|
110
|
+
|
111
|
+
# Address line 2
|
112
|
+
#
|
113
|
+
# @return [String]
|
114
|
+
#
|
115
|
+
def address2
|
116
|
+
decode hash["Address2"]
|
117
|
+
end
|
118
|
+
|
119
|
+
# City name
|
120
|
+
#
|
121
|
+
# @return [String]
|
122
|
+
#
|
123
|
+
def city
|
124
|
+
decode hash["City"]
|
125
|
+
end
|
126
|
+
|
127
|
+
# State or province name
|
128
|
+
#
|
129
|
+
# @return [String]
|
130
|
+
#
|
131
|
+
def state_or_province
|
132
|
+
decode hash["StateOrProvince"]
|
133
|
+
end
|
134
|
+
|
135
|
+
# State or province ISO code such as AZ for Arizona (if applicable)
|
136
|
+
#
|
137
|
+
# @return [String]
|
138
|
+
#
|
139
|
+
def state_code
|
140
|
+
decode hash["StateCode"]
|
141
|
+
end
|
142
|
+
|
143
|
+
# Zip or postal code
|
144
|
+
#
|
145
|
+
# @return [String]
|
146
|
+
#
|
147
|
+
def zip
|
148
|
+
decode hash["Zip"]
|
149
|
+
end
|
150
|
+
|
151
|
+
# 2-char ISO country code
|
152
|
+
#
|
153
|
+
# @return [String]
|
154
|
+
#
|
155
|
+
def country_code
|
156
|
+
decode hash["CountryCode"]
|
157
|
+
end
|
158
|
+
|
159
|
+
# Country name
|
160
|
+
#
|
161
|
+
# @return [String]
|
162
|
+
#
|
163
|
+
def country_name
|
164
|
+
decode hash["CountryName"]
|
165
|
+
end
|
166
|
+
|
167
|
+
# Id of the current address from within the address book
|
168
|
+
#
|
169
|
+
# @return [String]
|
170
|
+
#
|
171
|
+
def address_book_id
|
172
|
+
hash["AddressBookId"]
|
173
|
+
end
|
174
|
+
|
175
|
+
# Name of the current address from within the address book
|
176
|
+
#
|
177
|
+
# @return [String]
|
178
|
+
#
|
179
|
+
def address_book_name
|
180
|
+
end
|
181
|
+
|
182
|
+
# Indicates that the current address should be saved in merchant platform
|
183
|
+
#
|
184
|
+
# @return [Boolean]
|
185
|
+
#
|
186
|
+
def save_address
|
187
|
+
end
|
188
|
+
|
189
|
+
private
|
190
|
+
|
191
|
+
def decode(value)
|
192
|
+
if url_encoded && value
|
193
|
+
CGI.unescape value
|
194
|
+
else
|
195
|
+
value
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
module Workarea
|
2
|
+
module GlobalE
|
3
|
+
module Merchant
|
4
|
+
class Discount
|
5
|
+
attr_reader :hash
|
6
|
+
|
7
|
+
def initialize(hash)
|
8
|
+
@hash = hash
|
9
|
+
end
|
10
|
+
|
11
|
+
# Discount Name
|
12
|
+
#
|
13
|
+
# @return [String]
|
14
|
+
#
|
15
|
+
def name
|
16
|
+
hash["Name"]
|
17
|
+
end
|
18
|
+
|
19
|
+
# Discount value in currency defined in CurrencyCode property of the
|
20
|
+
# respective Merchant.Order object for the order being submitted to the Merchant.
|
21
|
+
#
|
22
|
+
# @return [Float]
|
23
|
+
#
|
24
|
+
def price
|
25
|
+
hash["Price"]
|
26
|
+
end
|
27
|
+
|
28
|
+
# VAT rate applied to this discount
|
29
|
+
#
|
30
|
+
# @return [Float]
|
31
|
+
#
|
32
|
+
def vat_rate
|
33
|
+
hash["VATRate"]
|
34
|
+
end
|
35
|
+
|
36
|
+
# VAT rate that would be applied to this discount if the order was
|
37
|
+
# placed by the local customer. This value must be specified if
|
38
|
+
# UseCountryVAT for the current Country is TRUE and therefore VATRate
|
39
|
+
# property actually denotes the VAT for the target country.
|
40
|
+
#
|
41
|
+
# @return [Float]
|
42
|
+
#
|
43
|
+
def local_vat_rate
|
44
|
+
hash["LocalVATRate"]
|
45
|
+
end
|
46
|
+
|
47
|
+
# Discount value in end customer’s currency (specified in
|
48
|
+
# InternationalDetails.CurrencyCode property for the respective
|
49
|
+
# Merchant.Order), after applying country coefficient, FX conversion and
|
50
|
+
# IncludeVAT handling.
|
51
|
+
#
|
52
|
+
# @return [Float]
|
53
|
+
#
|
54
|
+
def international_price
|
55
|
+
hash["InternationalPrice"]
|
56
|
+
end
|
57
|
+
|
58
|
+
# Discount textual description
|
59
|
+
#
|
60
|
+
# @return [String]
|
61
|
+
#
|
62
|
+
def description
|
63
|
+
hash["Description"]
|
64
|
+
end
|
65
|
+
|
66
|
+
# Merchant’s coupon code used for this discount (applicable to
|
67
|
+
# coupon-based discounts only)
|
68
|
+
#
|
69
|
+
# @return [String]
|
70
|
+
#
|
71
|
+
def coupon_code
|
72
|
+
hash["CouponCode"]
|
73
|
+
end
|
74
|
+
|
75
|
+
# Identifier of the product cart item related to this discount on the
|
76
|
+
# Merchant’s site originally specified in Discount.ProductCartItemId
|
77
|
+
# property of the respective discount in SendCart method for the cart
|
78
|
+
# converted to this order on Global-e.
|
79
|
+
#
|
80
|
+
# @return [String[
|
81
|
+
#
|
82
|
+
def product_cart_item_id
|
83
|
+
hash["ProductCartItemId"]
|
84
|
+
end
|
85
|
+
|
86
|
+
# Discount code originally specified in Discount.DiscountCode property of
|
87
|
+
# the respective discount in SendCart method for the cart converted to
|
88
|
+
# this order on Global-e.
|
89
|
+
#
|
90
|
+
# @return [String]
|
91
|
+
#
|
92
|
+
def discount_code
|
93
|
+
hash["DiscountCode"]
|
94
|
+
end
|
95
|
+
|
96
|
+
# Loyalty Voucher code originally specified in
|
97
|
+
# Discount.LoyaltyVoucherCode property of the respective discount in
|
98
|
+
# SendCart method for the cart converted to this order on Global-e.
|
99
|
+
#
|
100
|
+
# @return [String]
|
101
|
+
#
|
102
|
+
def loyalty_voucher_code
|
103
|
+
hash["LoyaltyVoucherCode"]
|
104
|
+
end
|
105
|
+
|
106
|
+
# Discount type (“Cart”, “Shipping”, etc.), as defined in
|
107
|
+
# | DiscountType Option Value | Name | Description |
|
108
|
+
# | 1 | Cart Discount | Discount related to volume, amount, coupon or another promotion value. |
|
109
|
+
# | 2 | Shipping Discount | Discount aimed to sponsor international shipping. |
|
110
|
+
# | 3 | Loyalty points discount | Discount applied against the Merchant’s loyalty points to be spent for this purchase. |
|
111
|
+
# | 4 | Duties discount | Discount aimed to sponsor taxes & duties pre- paid by the end customer in Global-e checkout. |
|
112
|
+
# | 5 | Checkout Loyalty Points Discount | Discount applied against the Merchant’s loyalty points in Global-e checkout. |
|
113
|
+
# | 6 | Payment Charge | Discount aimed to sponsor “Cash on Delivery” fee. |
|
114
|
+
#
|
115
|
+
# @return [Integer]
|
116
|
+
#
|
117
|
+
def discount_type
|
118
|
+
hash["DiscountType"]
|
119
|
+
end
|
120
|
+
|
121
|
+
def shipping?
|
122
|
+
discount_type == 2
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
@@ -0,0 +1,296 @@
|
|
1
|
+
module Workarea
|
2
|
+
module GlobalE
|
3
|
+
module Merchant
|
4
|
+
class InternationalDetails
|
5
|
+
attr_reader :hash
|
6
|
+
|
7
|
+
def initialize(hash)
|
8
|
+
@hash = hash
|
9
|
+
end
|
10
|
+
|
11
|
+
# 3-char ISO code for the currency selected by the end customer for the
|
12
|
+
# order payment.
|
13
|
+
#
|
14
|
+
# @return [String]
|
15
|
+
#
|
16
|
+
def currency_code
|
17
|
+
hash["CurrencyCode"]
|
18
|
+
end
|
19
|
+
|
20
|
+
# Total order price in the currency denoted by CurrencyCode.
|
21
|
+
#
|
22
|
+
# @return [Float]
|
23
|
+
#
|
24
|
+
def total_price
|
25
|
+
hash["TotalPrice"]
|
26
|
+
end
|
27
|
+
|
28
|
+
# 3-char ISO code for the currency actually used for the current order
|
29
|
+
# payment. TransactionCurrencyCode may differ from CurrencyCode if the
|
30
|
+
# currency selected by the end customer could not be used with the
|
31
|
+
# selected payment method.
|
32
|
+
#
|
33
|
+
# @return [String]
|
34
|
+
#
|
35
|
+
def transaction_currency_code
|
36
|
+
hash["TransactionCurrencyCode"]
|
37
|
+
end
|
38
|
+
|
39
|
+
# Total order price actually paid by the end customer in the currency
|
40
|
+
# denoted by TransactionCurrencyCode.
|
41
|
+
#
|
42
|
+
# @return [Float]
|
43
|
+
#
|
44
|
+
def transaction_total_price
|
45
|
+
hash["TransactionTotalPrice"]
|
46
|
+
end
|
47
|
+
|
48
|
+
# Total shipping price in the currency denoted by CurrencyCode.
|
49
|
+
#
|
50
|
+
# @return [Float]
|
51
|
+
#
|
52
|
+
def total_shipping_price
|
53
|
+
hash["TotalShippingPrice"]
|
54
|
+
end
|
55
|
+
|
56
|
+
# Consignment fee paid by the end customer in the currency denoted by
|
57
|
+
# CurrencyCode. This value is included in TotalShippingPrice.
|
58
|
+
#
|
59
|
+
# @return [Float]
|
60
|
+
#
|
61
|
+
def consignment_fee
|
62
|
+
hash["ConsignmentFee"]
|
63
|
+
end
|
64
|
+
|
65
|
+
# Oversized items charge paid by the end customer in the currency
|
66
|
+
# denoted by CurrencyCode. This value is included in TotalShippingPrice.
|
67
|
+
#
|
68
|
+
# @return [Float]
|
69
|
+
#
|
70
|
+
def size_overchange_value
|
71
|
+
hash["SizeOverchargeValue"]
|
72
|
+
end
|
73
|
+
|
74
|
+
# Remote area surcharge paid by the end customer in the currency
|
75
|
+
# denoted by CurrencyCode. This value is included in TotalShippingPrice.
|
76
|
+
#
|
77
|
+
# @return [Float]
|
78
|
+
#
|
79
|
+
def remote_area_surcharge
|
80
|
+
hash["RemoteAreaSurcharge"]
|
81
|
+
end
|
82
|
+
|
83
|
+
# Cost of “Same Day Dispatch” option (if selected by the end customer
|
84
|
+
# on Global-e checkout), in the currency denoted by CurrencyCode. This
|
85
|
+
# value is NOT included in TotalShippingPrice.
|
86
|
+
#
|
87
|
+
# @return [Float]
|
88
|
+
#
|
89
|
+
def same_day_dispatch_cost
|
90
|
+
hash["SameDayDispatchCost"]
|
91
|
+
end
|
92
|
+
|
93
|
+
# Total Duties & Taxes value including Customs Clearance Fees, in the
|
94
|
+
# currency denoted by CurrencyCode.
|
95
|
+
#
|
96
|
+
# @return [Float]
|
97
|
+
#
|
98
|
+
def total_duties_price
|
99
|
+
hash["TotalDutiesPrice"]
|
100
|
+
end
|
101
|
+
|
102
|
+
# Total Customs Clearance Fees value in the currency denoted by
|
103
|
+
# CurrencyCode. This value is included in TotalDutiesPrice.
|
104
|
+
#
|
105
|
+
# @return [Float]
|
106
|
+
#
|
107
|
+
def total_ccf_price
|
108
|
+
hash["TotalCCFPrice"]
|
109
|
+
end
|
110
|
+
|
111
|
+
# Code denoting the selected international shipping method as defined
|
112
|
+
# on the Merchant’s site (to be mapped on Global-e side). If this
|
113
|
+
# international shipping method doesn’t exist on the Merchant’s site,
|
114
|
+
# the internal Global-e shipping method code will be specified instead.
|
115
|
+
#
|
116
|
+
# @return [String]
|
117
|
+
#
|
118
|
+
def shipping_method_code
|
119
|
+
hash["ShippingMethodCode"]
|
120
|
+
end
|
121
|
+
|
122
|
+
# Name of the selected international shipping method.
|
123
|
+
#
|
124
|
+
# @return [String]
|
125
|
+
#
|
126
|
+
def shipping_method_name
|
127
|
+
hash["ShippingMethodName"]
|
128
|
+
end
|
129
|
+
|
130
|
+
# Code denoting the selected international shipping method type as
|
131
|
+
# defined on the Merchant’s site (to be mapped on Global-e side). If
|
132
|
+
# this international shipping method type doesn’t exist on the
|
133
|
+
# Merchant’s site, the internal Global-e shipping method type code will
|
134
|
+
# be specified instead.
|
135
|
+
#
|
136
|
+
# @return [String]
|
137
|
+
#
|
138
|
+
def shipping_method_type_code
|
139
|
+
hash["ShippingMethodTypeCode"]
|
140
|
+
end
|
141
|
+
|
142
|
+
# Name of the selected international shipping method type.
|
143
|
+
#
|
144
|
+
# @return [String]
|
145
|
+
#
|
146
|
+
def shipping_method_type_name
|
147
|
+
hash["ShippingMethodTypeName"]
|
148
|
+
end
|
149
|
+
|
150
|
+
# Minimum number of days for delivery to the end customer for the
|
151
|
+
# selected shipping method.
|
152
|
+
#
|
153
|
+
# @return [Integer]
|
154
|
+
#
|
155
|
+
def delivery_days_from
|
156
|
+
hash["DeliveryDaysFrom"]
|
157
|
+
end
|
158
|
+
|
159
|
+
# Maximum number of days for delivery to the end customer for the
|
160
|
+
# selected shipping method.
|
161
|
+
#
|
162
|
+
# @return [Integer]
|
163
|
+
#
|
164
|
+
def delivery_days_to
|
165
|
+
hash["DeliveryDaysTo"]
|
166
|
+
end
|
167
|
+
|
168
|
+
# Code denoting the selected payment method as defined on the Merchant’s
|
169
|
+
# site (to be mapped on Global-e side). If this payment method doesn’t
|
170
|
+
# exist on the Merchant’s site, the internal Global-e payment method
|
171
|
+
# code will be specified instead.
|
172
|
+
#
|
173
|
+
# @return [String]
|
174
|
+
#
|
175
|
+
def payment_method_code
|
176
|
+
hash["PaymentMethodCode"]
|
177
|
+
end
|
178
|
+
|
179
|
+
# Name of the selected payment method.
|
180
|
+
#
|
181
|
+
# @return [String]
|
182
|
+
#
|
183
|
+
def payment_method_name
|
184
|
+
hash["PaymentMethodName"]
|
185
|
+
end
|
186
|
+
|
187
|
+
# Indicates if the end customer has selected the “guaranteed duties
|
188
|
+
# and taxes” option.
|
189
|
+
#
|
190
|
+
# @return [Boolean]
|
191
|
+
#
|
192
|
+
def duties_guaranteed
|
193
|
+
hash["DutiesGuaranteed"]
|
194
|
+
end
|
195
|
+
|
196
|
+
# Tracking number used by the selected international shipping method
|
197
|
+
# for this order.
|
198
|
+
#
|
199
|
+
# @return [String]
|
200
|
+
#
|
201
|
+
def order_tracking_number
|
202
|
+
hash["OrderTrackingNumber"]
|
203
|
+
end
|
204
|
+
|
205
|
+
# Full tracking URL including OrderTrackingNumber used by the selected
|
206
|
+
# international shipping method for this order.
|
207
|
+
#
|
208
|
+
# @return [String]
|
209
|
+
#
|
210
|
+
def order_tracking_url
|
211
|
+
hash["OrderTrackingUrl"]
|
212
|
+
end
|
213
|
+
|
214
|
+
# Waybill number used by the selected international shipping method for
|
215
|
+
# this order.
|
216
|
+
#
|
217
|
+
# @return [String]
|
218
|
+
#
|
219
|
+
def order_waybill_number
|
220
|
+
hash["OrderWaybillNumber"]
|
221
|
+
end
|
222
|
+
|
223
|
+
# Code denoting the selected shipping status as defined on the
|
224
|
+
# Merchant’s site (to be mapped on Global- e side). If this shipping
|
225
|
+
# status doesn’t exist on the Merchant’s site, the internal Global-e
|
226
|
+
# shipping status code will be specified instead.
|
227
|
+
#
|
228
|
+
# @return [String]
|
229
|
+
#
|
230
|
+
def shipping_method_status_code
|
231
|
+
hash["ShippingMethodStatusCode"]
|
232
|
+
end
|
233
|
+
|
234
|
+
# Name of the shipping status.
|
235
|
+
#
|
236
|
+
# @return [String]
|
237
|
+
#
|
238
|
+
def shipping_method_status_name
|
239
|
+
hash["ShippingMethodStatusName"]
|
240
|
+
end
|
241
|
+
|
242
|
+
# The price paid by customer in local currency. Total Shipping price
|
243
|
+
# reducing Order Discounts International price.
|
244
|
+
#
|
245
|
+
# @return [Float]
|
246
|
+
#
|
247
|
+
def discounted_shipping_price
|
248
|
+
hash["DiscountedShippingPrice"]
|
249
|
+
end
|
250
|
+
|
251
|
+
# List of Merchant.ParcelTracking objects, each object holds parcel
|
252
|
+
# tracking number and full tracking URL for the relevant shipper (with
|
253
|
+
# the parcel tracking number).
|
254
|
+
#
|
255
|
+
# @return [Array<Workarea::GlobalE::Merchant::ParcelTracking>]
|
256
|
+
#
|
257
|
+
def parcels_tracking
|
258
|
+
hash["ParcelsTracking"]
|
259
|
+
end
|
260
|
+
|
261
|
+
# The last 4 digits of Card number (if applicable).
|
262
|
+
#
|
263
|
+
# @return [String]
|
264
|
+
#
|
265
|
+
def card_number_last_four_digits
|
266
|
+
hash["CardNumberLastFourDigits"]
|
267
|
+
end
|
268
|
+
|
269
|
+
# Card expiration date in YYYY-MM-DD format (if applicable).
|
270
|
+
#
|
271
|
+
# @return [String]
|
272
|
+
#
|
273
|
+
def expiration_date
|
274
|
+
hash["ExpirationDate"]
|
275
|
+
end
|
276
|
+
|
277
|
+
# Additional charge paid by the end customer when “Cash on Delivery”
|
278
|
+
# payment method has been selected.
|
279
|
+
#
|
280
|
+
# @return [Float]
|
281
|
+
#
|
282
|
+
def cash_on_delivery_fee_customer_currency
|
283
|
+
hash["CashOnDeliveryFee"]
|
284
|
+
end
|
285
|
+
|
286
|
+
# Amount of VAT paid by the customer to Global-e
|
287
|
+
#
|
288
|
+
# @return [Float]
|
289
|
+
#
|
290
|
+
def total_vat_amount
|
291
|
+
hash["TotalDutiesPrice"]
|
292
|
+
end
|
293
|
+
end
|
294
|
+
end
|
295
|
+
end
|
296
|
+
end
|