workarea-global_e 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (232) hide show
  1. checksums.yaml +7 -0
  2. data/.eslintrc.json +37 -0
  3. data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
  4. data/.github/ISSUE_TEMPLATE/documentation-request.md +17 -0
  5. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  6. data/.github/workflows/ci.yml +77 -0
  7. data/.gitignore +20 -0
  8. data/.rubocop.yml +2 -0
  9. data/.ruby-version +1 -0
  10. data/CHANGELOG.md +261 -0
  11. data/Gemfile +16 -0
  12. data/README.md +39 -0
  13. data/Rakefile +59 -0
  14. data/app/assets/javascripts/workarea/storefront/global_e/modules/checkout_info_validator.js +122 -0
  15. data/app/assets/javascripts/workarea/storefront/global_e/modules/suppress_price_ranges.js +19 -0
  16. data/app/controllers/workarea/admin/country_exceptions_controller.rb +67 -0
  17. data/app/controllers/workarea/admin/fixed_prices_controller.rb +89 -0
  18. data/app/controllers/workarea/admin/orders_controller.decorator +6 -0
  19. data/app/controllers/workarea/storefront/application_controller.decorator +30 -0
  20. data/app/controllers/workarea/storefront/checkouts_controller.decorator +22 -0
  21. data/app/controllers/workarea/storefront/ge_checkouts_controller.rb +10 -0
  22. data/app/controllers/workarea/storefront/global_e_controller.rb +42 -0
  23. data/app/controllers/workarea/storefront/globale/api_controller.rb +108 -0
  24. data/app/controllers/workarea/storefront/globale/refund_controller.rb +65 -0
  25. data/app/controllers/workarea/storefront/users/logins_controller.decorator +13 -0
  26. data/app/helpers/workarea/admin/global_e_helpers.rb +28 -0
  27. data/app/models/workarea/address.decorator +11 -0
  28. data/app/models/workarea/catalog/product.decorator +14 -0
  29. data/app/models/workarea/fulfillment/status/partially_refunded.rb +13 -0
  30. data/app/models/workarea/fulfillment/status/refunded.rb +15 -0
  31. data/app/models/workarea/fulfillment.decorator +55 -0
  32. data/app/models/workarea/global_e/country_exception.rb +37 -0
  33. data/app/models/workarea/global_e/fixed_price.rb +93 -0
  34. data/app/models/workarea/global_e/order_api_events.rb +29 -0
  35. data/app/models/workarea/order/item.decorator +46 -0
  36. data/app/models/workarea/order/status/pending_global_e_fraud_check.rb +12 -0
  37. data/app/models/workarea/order.decorator +64 -0
  38. data/app/models/workarea/payment/status/global_e_appoved.rb +9 -0
  39. data/app/models/workarea/payment/status/pending_global_e_fraud_check.rb +9 -0
  40. data/app/models/workarea/payment/tender/global_e_payment.rb +16 -0
  41. data/app/models/workarea/payment.decorator +10 -0
  42. data/app/models/workarea/price_adjustment.decorator +13 -0
  43. data/app/models/workarea/price_adjustment_set.decorator +25 -0
  44. data/app/models/workarea/pricing/calculators/item_calculator.decorator +48 -0
  45. data/app/models/workarea/pricing/collection.decorator +90 -0
  46. data/app/models/workarea/pricing/discount/appliation_group.decorator +16 -0
  47. data/app/models/workarea/pricing/discount/international_item_proxy.rb +27 -0
  48. data/app/models/workarea/pricing/discount/international_order.rb +29 -0
  49. data/app/models/workarea/pricing/discount.decorator +65 -0
  50. data/app/models/workarea/pricing/price_distributor.decorator +37 -0
  51. data/app/models/workarea/pricing/request.decorator +17 -0
  52. data/app/models/workarea/pricing/sku.decorator +17 -0
  53. data/app/models/workarea/search/admin/order.decorator +11 -0
  54. data/app/models/workarea/shipping/sku.decorator +23 -0
  55. data/app/models/workarea/shipping.decorator +11 -0
  56. data/app/models/workarea/user.decorator +10 -0
  57. data/app/seeds/workarea/global_e_seeds.rb +66 -0
  58. data/app/services/workarea/create_fulfillment.decorator +12 -0
  59. data/app/services/workarea/global_e/address_details.rb +218 -0
  60. data/app/services/workarea/global_e/api/notify_order_refunded.rb +45 -0
  61. data/app/services/workarea/global_e/api/perform_order_payment.rb +46 -0
  62. data/app/services/workarea/global_e/api/remove_restricted_products.rb +28 -0
  63. data/app/services/workarea/global_e/api/send_order_to_merchant/item_pricer.rb +147 -0
  64. data/app/services/workarea/global_e/api/send_order_to_merchant/save_user.rb +59 -0
  65. data/app/services/workarea/global_e/api/send_order_to_merchant.rb +359 -0
  66. data/app/services/workarea/global_e/api/update_order_shipping_info.rb +38 -0
  67. data/app/services/workarea/global_e/api/update_order_status/canceled.rb +42 -0
  68. data/app/services/workarea/global_e/api/update_order_status.rb +28 -0
  69. data/app/services/workarea/global_e/attribute.rb +44 -0
  70. data/app/services/workarea/global_e/brand.rb +19 -0
  71. data/app/services/workarea/global_e/cart_user_details.rb +34 -0
  72. data/app/services/workarea/global_e/category.rb +19 -0
  73. data/app/services/workarea/global_e/checkout_cart_info.rb +358 -0
  74. data/app/services/workarea/global_e/custom_product_attribute.rb +19 -0
  75. data/app/services/workarea/global_e/discount.rb +215 -0
  76. data/app/services/workarea/global_e/merchant/brand.rb +21 -0
  77. data/app/services/workarea/global_e/merchant/category.rb +21 -0
  78. data/app/services/workarea/global_e/merchant/customer.rb +36 -0
  79. data/app/services/workarea/global_e/merchant/customer_details.rb +201 -0
  80. data/app/services/workarea/global_e/merchant/discount.rb +127 -0
  81. data/app/services/workarea/global_e/merchant/international_details.rb +296 -0
  82. data/app/services/workarea/global_e/merchant/order.rb +425 -0
  83. data/app/services/workarea/global_e/merchant/order_refund.rb +103 -0
  84. data/app/services/workarea/global_e/merchant/original_order.rb +28 -0
  85. data/app/services/workarea/global_e/merchant/parcel_tracking.rb +31 -0
  86. data/app/services/workarea/global_e/merchant/payment_details.rb +161 -0
  87. data/app/services/workarea/global_e/merchant/product.rb +222 -0
  88. data/app/services/workarea/global_e/merchant/refund_product.rb +69 -0
  89. data/app/services/workarea/global_e/merchant/response_info.rb +115 -0
  90. data/app/services/workarea/global_e/merchant_cart_product_attribute.rb +21 -0
  91. data/app/services/workarea/global_e/order_status.rb +20 -0
  92. data/app/services/workarea/global_e/order_status_details.rb +79 -0
  93. data/app/services/workarea/global_e/order_status_reason.rb +20 -0
  94. data/app/services/workarea/global_e/parcel.rb +53 -0
  95. data/app/services/workarea/global_e/product.rb +612 -0
  96. data/app/services/workarea/global_e/product_meta_data.rb +13 -0
  97. data/app/services/workarea/global_e/tracking_details.rb +23 -0
  98. data/app/services/workarea/global_e/update_order_dispatch_exception.rb +46 -0
  99. data/app/services/workarea/global_e/update_order_dispatch_request.rb +108 -0
  100. data/app/services/workarea/global_e/user_id_number_type.rb +21 -0
  101. data/app/services/workarea/global_e/users_details.rb +151 -0
  102. data/app/services/workarea/global_e/vat_category.rb +20 -0
  103. data/app/services/workarea/global_e/vat_rate_type.rb +27 -0
  104. data/app/services/workarea/save_order_analytics.decorator +18 -0
  105. data/app/view_models/workarea/admin/order_view_model.decorator +13 -0
  106. data/app/view_models/workarea/storefront/cart_view_model.decorator +7 -0
  107. data/app/view_models/workarea/storefront/order_item_view_model.decorator +16 -0
  108. data/app/view_models/workarea/storefront/order_view_model.decorator +45 -0
  109. data/app/view_models/workarea/storefront/product_view_model.decorator +35 -0
  110. data/app/views/workarea/admin/catalog_products/_country_exceptions_card.html.haml +31 -0
  111. data/app/views/workarea/admin/catalog_products/_global_e_attributes.html.haml +3 -0
  112. data/app/views/workarea/admin/catalog_products/_global_e_fields.html.haml +4 -0
  113. data/app/views/workarea/admin/country_exceptions/edit.html.haml +48 -0
  114. data/app/views/workarea/admin/country_exceptions/index.html.haml +47 -0
  115. data/app/views/workarea/admin/country_exceptions/new.html.haml +44 -0
  116. data/app/views/workarea/admin/fixed_prices/edit.html.haml +73 -0
  117. data/app/views/workarea/admin/fixed_prices/index.html.haml +55 -0
  118. data/app/views/workarea/admin/fixed_prices/new.html.haml +70 -0
  119. data/app/views/workarea/admin/orders/_global_e.html.haml +27 -0
  120. data/app/views/workarea/admin/orders/attributes.html.haml +131 -0
  121. data/app/views/workarea/admin/orders/global_e.html.haml +110 -0
  122. data/app/views/workarea/admin/orders/show.html.haml +27 -0
  123. data/app/views/workarea/admin/orders/tenders/_global_e_payment.html.haml +3 -0
  124. data/app/views/workarea/admin/pricing_skus/_cards.html.haml +98 -0
  125. data/app/views/workarea/storefront/cart_items/create.html.haml +71 -0
  126. data/app/views/workarea/storefront/carts/_pricing.html.haml +14 -0
  127. data/app/views/workarea/storefront/carts/show.html.haml +187 -0
  128. data/app/views/workarea/storefront/ge_checkouts/show.html.haml +1 -0
  129. data/app/views/workarea/storefront/global_e/_country_picker.html.haml +1 -0
  130. data/app/views/workarea/storefront/global_e/_head.html.haml +10 -0
  131. data/app/views/workarea/storefront/orders/_summary.html.haml +275 -0
  132. data/app/views/workarea/storefront/orders/tenders/_global_e_payment.html.haml +3 -0
  133. data/app/views/workarea/storefront/products/_pricing.html.haml +49 -0
  134. data/app/views/workarea/storefront/products/_restricted_item_text.html.haml +1 -0
  135. data/app/views/workarea/storefront/users/orders/_summary.html.haml +22 -0
  136. data/app/workers/workarea/global_e/update_order_dispatch.rb +28 -0
  137. data/app/workers/workarea/save_user_order_details.decorator +9 -0
  138. data/bin/rails +25 -0
  139. data/config/initializers/appends.rb +46 -0
  140. data/config/initializers/seeds.rb +1 -0
  141. data/config/initializers/workarea.rb +64 -0
  142. data/config/locales/en.yml +105 -0
  143. data/config/routes.rb +31 -0
  144. data/lib/workarea/global_e/engine.rb +10 -0
  145. data/lib/workarea/global_e/error.rb +8 -0
  146. data/lib/workarea/global_e/version.rb +5 -0
  147. data/lib/workarea/global_e.rb +58 -0
  148. data/script/admin_ci +5 -0
  149. data/script/ci +8 -0
  150. data/script/core_ci +5 -0
  151. data/script/plugins_ci +5 -0
  152. data/script/storefront_ci +5 -0
  153. data/test/dummy/.ruby-version +1 -0
  154. data/test/dummy/Rakefile +6 -0
  155. data/test/dummy/app/assets/config/manifest.js +3 -0
  156. data/test/dummy/app/assets/images/.keep +0 -0
  157. data/test/dummy/app/assets/javascripts/application.js +14 -0
  158. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  159. data/test/dummy/app/controllers/application_controller.rb +2 -0
  160. data/test/dummy/app/controllers/concerns/.keep +0 -0
  161. data/test/dummy/app/helpers/application_helper.rb +2 -0
  162. data/test/dummy/app/jobs/application_job.rb +2 -0
  163. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  164. data/test/dummy/app/models/concerns/.keep +0 -0
  165. data/test/dummy/app/views/layouts/application.html.erb +15 -0
  166. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  167. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  168. data/test/dummy/bin/bundle +3 -0
  169. data/test/dummy/bin/rails +4 -0
  170. data/test/dummy/bin/rake +4 -0
  171. data/test/dummy/bin/setup +28 -0
  172. data/test/dummy/bin/update +28 -0
  173. data/test/dummy/bin/yarn +11 -0
  174. data/test/dummy/config/application.rb +23 -0
  175. data/test/dummy/config/boot.rb +5 -0
  176. data/test/dummy/config/environment.rb +5 -0
  177. data/test/dummy/config/environments/development.rb +52 -0
  178. data/test/dummy/config/environments/production.rb +83 -0
  179. data/test/dummy/config/environments/test.rb +45 -0
  180. data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
  181. data/test/dummy/config/initializers/assets.rb +14 -0
  182. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  183. data/test/dummy/config/initializers/content_security_policy.rb +25 -0
  184. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  185. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  186. data/test/dummy/config/initializers/inflections.rb +16 -0
  187. data/test/dummy/config/initializers/mime_types.rb +4 -0
  188. data/test/dummy/config/initializers/workarea.rb +5 -0
  189. data/test/dummy/config/initializers/wrap_parameters.rb +9 -0
  190. data/test/dummy/config/locales/en.yml +33 -0
  191. data/test/dummy/config/puma.rb +34 -0
  192. data/test/dummy/config/routes.rb +5 -0
  193. data/test/dummy/config/secrets.yml +18 -0
  194. data/test/dummy/config/spring.rb +6 -0
  195. data/test/dummy/config.ru +5 -0
  196. data/test/dummy/db/seeds.rb +2 -0
  197. data/test/dummy/lib/assets/.keep +0 -0
  198. data/test/dummy/log/.keep +0 -0
  199. data/test/factories/workarea/global_e_factories.rb +836 -0
  200. data/test/integration/workarea/admin/catalog_product_country_exceptions_integration_test.rb +81 -0
  201. data/test/integration/workarea/admin/global_e_jump_to_integration_test.rb +20 -0
  202. data/test/integration/workarea/admin/pricing_sku_fixed_prices_integration_test.rb +83 -0
  203. data/test/integration/workarea/storefront/global_e_api/receive_order_integration_test.rb +278 -0
  204. data/test/integration/workarea/storefront/global_e_api/receive_order_refund_integration_test.rb +25 -0
  205. data/test/integration/workarea/storefront/global_e_api/receive_payment_integration_test.rb +34 -0
  206. data/test/integration/workarea/storefront/global_e_api/receive_shipping_info_integration_test.rb +29 -0
  207. data/test/integration/workarea/storefront/global_e_api/remove_restricted_products_integration_test.rb +27 -0
  208. data/test/integration/workarea/storefront/global_e_api/update_order_status_integration_test.rb +29 -0
  209. data/test/integration/workarea/storefront/global_e_checkout_cart_info/fixed_pricing_test.rb +438 -0
  210. data/test/integration/workarea/storefront/global_e_checkout_cart_info/gift_card_test.rb +63 -0
  211. data/test/integration/workarea/storefront/global_e_checkout_cart_info_integration_test.rb +660 -0
  212. data/test/integration/workarea/storefront/global_e_checkouts_integration_test.rb +71 -0
  213. data/test/integration/workarea/storefront/users/global_e_logins_integration_test.rb +20 -0
  214. data/test/models/workarea/catalog/product_global_e_test.rb +13 -0
  215. data/test/models/workarea/fixed_pricing_test.rb +117 -0
  216. data/test/models/workarea/global_e/country_exception_test.rb +36 -0
  217. data/test/models/workarea/payment_test.decorator +31 -0
  218. data/test/models/workarea/pricing/calculators/item_calculator_fixed_prices_test.rb +83 -0
  219. data/test/models/workarea/pricing/collection_fixed_prices_test.rb +83 -0
  220. data/test/models/workarea/pricing/price_distributor_test.decorator +21 -0
  221. data/test/models/workarea/pricing/sku_fixed_price_test.rb +133 -0
  222. data/test/support/workarea/global_e_support.rb +18 -0
  223. data/test/system/workarea/admin/global_e_system_test.rb +21 -0
  224. data/test/system/workarea/storefront/global_e_cart_system_test.rb +48 -0
  225. data/test/system/workarea/storefront/global_e_order_history_system_test.rb +43 -0
  226. data/test/teaspoon_env.rb +6 -0
  227. data/test/test_helper.rb +9 -0
  228. data/test/view_models/workarea/admin/global_e_order_view_model_test.rb +22 -0
  229. data/test/workers/workarea/global_e/update_order_dispatch_test.rb +64 -0
  230. data/test/workers/workarea/global_e_save_user_order_details_test.rb +41 -0
  231. data/workarea-global_e.gemspec +16 -0
  232. metadata +293 -0
@@ -0,0 +1,425 @@
1
+ module Workarea
2
+ module GlobalE
3
+ module Merchant
4
+ class Order
5
+ attr_reader :hash
6
+
7
+ def initialize(hash)
8
+ @hash = hash
9
+ end
10
+
11
+ def to_h
12
+ hash
13
+ end
14
+
15
+ # @return [String]
16
+ #
17
+ def culture_code
18
+ hash["CultureCode"]
19
+ end
20
+
21
+ # Unique identifier of the Merchant on Global-e.
22
+ #
23
+ # @return [String]
24
+ #
25
+ def merchant_guid
26
+ hash["MerchantGUID"]
27
+ end
28
+
29
+ # Global-e order unique identifier.
30
+ #
31
+ # @return [String]
32
+ #
33
+ def order_id
34
+ hash["OrderId"]
35
+ end
36
+
37
+ # Order unique identifier on the Merchant’s site returned from a
38
+ # previous call to SendOrderToMerchant method for this order.
39
+ #
40
+ # @return [String]
41
+ #
42
+ def merchant_order_id
43
+ hash["MerchantOrderId"]
44
+ end
45
+
46
+ # Identifier of the cart on the Merchant’s site originally specified in
47
+ # merchantCartToken argument for SendCart method for the cart converted
48
+ # to this order on Global-e.
49
+ #
50
+ # @return [String]
51
+ #
52
+ def cart_id
53
+ hash["CartId"]
54
+ end
55
+
56
+ # Cart hash originally specified in merchantCartHash argument for
57
+ # SendCart method for the cart converted to this order on Global-e.
58
+ #
59
+ # @return [String]
60
+ #
61
+ def cart_hash
62
+ end
63
+
64
+ # Code denoting the order status on the Merchant’s site (to be mapped on Global-e side).
65
+ #
66
+ # @return [String]
67
+ #
68
+ def status_code
69
+ hash["StatusCode"]
70
+ end
71
+
72
+ # 3-char ISO currency code for the order being posted. By default this
73
+ # is set to the original Merchant’s currency.
74
+ #
75
+ # @return [String]
76
+ #
77
+ def currency_code
78
+ hash["CurrencyCode"]
79
+ end
80
+
81
+ # CountryCoefficient rate applied to the prices in this order.
82
+ #
83
+ # @return [Float]
84
+ #
85
+ def price_coefficient_rate
86
+ hash["PriceCoefficientRate"]
87
+ end
88
+
89
+ # Average conversion rate applied to the prices paid by the end customer,
90
+ # when calculating the prices paid by Global-e to the Merchant in the
91
+ # original Merchant’s currency. This rate includes “FX conversion” and
92
+ # “marketing rounding” factors.
93
+ #
94
+ # @return [Float]
95
+ #
96
+ def rounding_rate
97
+ end
98
+
99
+ # Internal User identifier on the Merchant’s site originally specified
100
+ # in shippingDetails.UserId argument for SendCart method for the cart
101
+ # converted to this order on Global-e.
102
+ #
103
+ # @return [String]
104
+ #
105
+ def user_id
106
+ hash["UserId"]
107
+ end
108
+
109
+ # Code denoting the local shipping method selected from the list of
110
+ # available shipping options provided in shippingOptionsList argument
111
+ # for SendCart method for the cart converted to this order on Global-e.
112
+ #
113
+ # @return [String]
114
+ #
115
+ def shipping_method_code
116
+ hash ["ShippingMethodCode"]
117
+ end
118
+
119
+ # Indicates if the end customer’s cart must be cleared before this method
120
+ # finishes execution on the Merchant’s site.
121
+ #
122
+ # @return [Boolean]
123
+ #
124
+ def clear_cart
125
+ hash["ClearCart"]
126
+ end
127
+
128
+ # Indicates if the end customer has opted on Global-e checkout to receive
129
+ # emails from the Merchant.
130
+ #
131
+ # @return [Boolean]
132
+ #
133
+ def allow_mails_from_merchant
134
+ end
135
+
136
+ # Number of loyalty points spent for this purchase. The existing loyalty
137
+ # points handling procedure must be applied to the end customer’s user
138
+ # account. Therefore, “Loyalty points” type discount must not be applied
139
+ # to the order directly, but can be used for the display purposes
140
+ # elsewhere in the system (i.e in end user’s My Account page).
141
+ #
142
+ # @return [Float]
143
+ #
144
+ def loyalty_points_spend
145
+ end
146
+
147
+ # Number of loyalty points to be earned for this purchase by the end
148
+ # customer on the Merchant’s site, as specified in loyaltyPointsEarned
149
+ # argument for SendCart method for the cart converted to this order on
150
+ # Global-e.
151
+ #
152
+ # @return [Float]
153
+ #
154
+ def loyalty_points_earned
155
+ end
156
+
157
+ # Loyalty code applicable to the Merchant’s site entered by the end
158
+ # customer in Global-e checkout.
159
+ #
160
+ # @return [String]
161
+ #
162
+ def loyalty_code
163
+ end
164
+
165
+ # Indicates if the end customer has requested “Same Day Dispatch” on
166
+ # Global-e checkout.
167
+ #
168
+ # @return [Boolean]
169
+ #
170
+ def same_day_dispatch
171
+ end
172
+
173
+ # Cost of “Same Day Dispatch” option selected by the end customer on
174
+ # Global-e checkout, in the original Merchant’s currency.
175
+ #
176
+ # @return [Float]
177
+ #
178
+ def same_day_dispatch_cost
179
+ end
180
+
181
+ # Indicates if the end customer hasn’t been charged VAT in Global-e
182
+ # checkout, as specified in doNotChargeVAT argument for SendCart method
183
+ # for the cart converted to this order on Global-e.
184
+ #
185
+ # @return [Boolean]
186
+ #
187
+ def do_not_charge_vat
188
+ end
189
+
190
+ # Indicates if the Merchant offers free international shipping to the
191
+ # end customer, as specified in IsFreeShipping argument for SendCart
192
+ # method for the cart converted to this order on Global-e.
193
+ #
194
+ # @return [Boolean]
195
+ #
196
+ def is_free_shipping
197
+ end
198
+
199
+ # Merchant’s free shipping coupon code applied by the end customer,
200
+ # as specified in FreeShippingCouponCode argument for SendCart method
201
+ # for the cart converted to this order on Global-e.
202
+ #
203
+ # @return [String]
204
+ #
205
+ def free_shipping_coupon_code
206
+ end
207
+
208
+ # Code denoting the Merchant’s store specified by the customer for
209
+ # “ship to shop” shipping destination (to be mapped on Global-e side).
210
+ #
211
+ # @return [String]
212
+ #
213
+ def ship_to_store_code
214
+ end
215
+
216
+ # Comments text entered by the end customer in Global-e checkout.
217
+ #
218
+ # @return [String]
219
+ #
220
+ def customer_comments
221
+ end
222
+
223
+ # Indicates if the order should be handled as split order (i.e. without consolidation)
224
+ #
225
+ # @return [Boolean]
226
+ #
227
+ def is_split_order
228
+ end
229
+
230
+ # Onetime voucher code used to place the order
231
+ #
232
+ # @return [String]
233
+ #
234
+ def ot_voucher_code
235
+ end
236
+
237
+ # Currency of the onetime voucher code used to place the order
238
+ #
239
+ # @return [String]
240
+ #
241
+ def ot_currency_code
242
+ end
243
+
244
+ # Amount taken off the voucher when applicable
245
+ #
246
+ # @return [Float]
247
+ #
248
+ def ot_voucher_amount
249
+ end
250
+
251
+ # Code used on the merchant’s side to identify the web store, as
252
+ # specified in WebStoreCode argument for SendCart method for the cart
253
+ # converted to this order on Global-e.
254
+ #
255
+ # @return [String]
256
+ #
257
+ def web_store_code
258
+ end
259
+
260
+ # The list of products being purchased
261
+ #
262
+ # @return [Array<Workarea::GlobalE::Merchant::Product>]
263
+ #
264
+ def products
265
+ @products ||= hash["Products"].map { |p| Merchant::Product.new p }
266
+ end
267
+
268
+ # The list of discounts being applied to the order, according to the
269
+ # original list of discounts received in SendCart for this order, and to
270
+ # the Merchant shipping configuration on Global-e.
271
+ #
272
+ # @return [Array<Workarea::GlobalE::Merchant::Discount>]
273
+ #
274
+ def discounts
275
+ @discounts ||= hash["Discounts"].map { |d| Merchant::Discount.new d }
276
+ end
277
+
278
+ # The list of markups being applied to the order, according to the
279
+ # Merchant shipping configuration on Global-e. Effectively Markup is a
280
+ # “negative Discount”. The main use case for Markups is when end customer
281
+ # is charged in Global-e checkout, a flat shipping rate, which is higher
282
+ # than the shipping rate, calculated for the respective order. In this
283
+ # case, Global-e pays the difference to the merchant in the form of
284
+ # Markups applied to the order.
285
+ #
286
+ # Unlike Discounts, Markups may be only passed to the Merchant’s
287
+ # back-end ERP system for reconciliation purposes, and may not be
288
+ # displayed to the end customer.
289
+ #
290
+ # @return [Array<Workarea::GlobalE::Merchant::Discount>]
291
+ #
292
+ def markups
293
+ end
294
+
295
+ # The paying customer’s preferences (Global-e acts as a paying customer).
296
+ #
297
+ # @return [Workarea::GlobalE::Merchant::Customer]
298
+ #
299
+ def customer
300
+ @customer ||= Merchant::Customer.new hash["Customer"]
301
+ end
302
+
303
+ # Primary customer’s billing details. Primary customer denotes the paying
304
+ # (Global-e) customer unless Customer.IsEndCustomerPrimary is not
305
+ # set to TRUE. Note that all string attributes of end customer’s details
306
+ # are indicated in URL encoded form. Therefore, if
307
+ # Customer.IsEndCustomerPrimary is TRUE then all string attributes in
308
+ # PrimaryBilling are URL encoded.
309
+ #
310
+ # @return [Workarea::GlobalE::Merchant::CustomerDetails]
311
+ #
312
+ def primary_billing
313
+ @primary_billing ||= Merchant::CustomerDetails.new hash["PrimaryBilling"], url_encoded: customer.is_end_customer_primary
314
+ end
315
+
316
+ # Primary customer’s shipping details. Primary customer denotes the paying
317
+ # (Global-e) customer unless Customer.IsEndCustomerPrimary is not
318
+ # set to TRUE. Note that all string attributes of end customer’s details
319
+ # are indicated in URL encoded form. Therefore, if
320
+ # Customer.IsEndCustomerPrimary is TRUE then all string attributes in
321
+ # PrimaryShipping are URL encoded
322
+ #
323
+ # @return [Workarea::GlobalE::Merchant::CustomerDetails]
324
+ #
325
+ def primary_shipping
326
+ @primary_shipping ||= Merchant::CustomerDetails.new hash["PrimaryShipping"], url_encoded: customer.is_end_customer_primary
327
+ end
328
+
329
+ # The paying customer’s payment details.
330
+ #
331
+ # @return [Workarea::GlobalE::Merchant::PaymentDetails]
332
+ #
333
+ def payment_details
334
+ @payment_details ||= Merchant::PaymentDetails.new hash["PaymentDetails"]
335
+ end
336
+
337
+ # Secondary customer’s billing details. Secondary customer denotes the
338
+ # end customer who has placed the order with Global-e checkout unless
339
+ # Customer.IsEndCustomerPrimary is not set to TRUE. Note that all
340
+ # string attributes of end customer’s details are indicated in URL
341
+ # encoded form. Therefore, if Customer.IsEndCustomerPrimary is FALSE
342
+ # then all string attributes in SecondaryBilling are URL encoded.
343
+ #
344
+ # @return [Workarea::GlobalE::Merchant::CustomerDetails]
345
+ #
346
+ def secondary_billing
347
+ @secondary_billing ||= Merchant::CustomerDetails.new hash["SecondaryBilling"], url_encoded: !customer.is_end_customer_primary
348
+ end
349
+
350
+ # Secondary customer’s shipping details. Secondary customer denotes the
351
+ # end customer who has placed the order with Global-e checkout unless
352
+ # Customer.IsEndCustomerPrimary is not set to TRUE. Note that all string
353
+ # attributes of end customer’s details are indicated in URL
354
+ # encoded form. Therefore, if Customer.IsEndCustomerPrimary is FALSE
355
+ # then all string attributes in SecondaryShipping are URL encoded.
356
+ #
357
+ # @return [Workarea::GlobalE::Merchant::CustomerDetails]
358
+ #
359
+ def secondary_shipping
360
+ @secondary_shipping ||= Merchant::CustomerDetails.new hash["SecondaryShipping"], url_encoded: !customer.is_end_customer_primary
361
+ end
362
+
363
+ # Details referring to the end customer’s order placed on Global-e side.
364
+ # These details are applicable only to the Merchants dealing with
365
+ # international customers’ support themselves.
366
+ #
367
+ # @return [Workarea::GlobalE::Merchant::InternationalDetails]
368
+ #
369
+ def international_details
370
+ @international_details ||= Merchant::InternationalDetails.new hash["InternationalDetails"]
371
+ end
372
+
373
+ # The shipping price paid by the customer converted to the merchant’s
374
+ # currency. Total Shipping price reducing Order Discounts
375
+ # (InternationalDetails.DiscountedShippingPrice price converted to the
376
+ # merchant currency).
377
+ #
378
+ # @return [Float]
379
+ #
380
+ def discounted_shipping_price
381
+ hash["DiscountedShippingPrice"]
382
+ end
383
+
384
+ # Indicates if the prepayment option for duties and taxes was offered to
385
+ # the customer.
386
+ #
387
+ # @return [Boolean]
388
+ #
389
+ def pre_pay_offered
390
+ end
391
+
392
+ # Indicates if the order is replacement.
393
+ #
394
+ # @return [Boolean]
395
+ #
396
+ def is_replacement_order
397
+ end
398
+
399
+ # Details reffering to the original order if the current order is replacement.
400
+ #
401
+ # @return [Workarea::GlobalE::Merchant::OriginalOrder]
402
+ #
403
+ def original_order
404
+ end
405
+
406
+ # @return [Float]
407
+ #
408
+ def total_duties_and_taxes_price
409
+ hash["TotalDutiesAndTaxesPrice"]
410
+ end
411
+
412
+ # Contains clearance Fees (CCF), in the merchant currency.
413
+ # This amount is included in the TotalDutiesAndTaxesPrice but provided
414
+ # separately as well so it can be displayed independently or as part of
415
+ # the shipping cost, on the invoice.
416
+ #
417
+ # @return [Float]
418
+ #
419
+ def contains_clearance_fees_price
420
+ hash["CCFPrice"]
421
+ end
422
+ end
423
+ end
424
+ end
425
+ end
@@ -0,0 +1,103 @@
1
+ module Workarea
2
+ module GlobalE
3
+ module Merchant
4
+ class OrderRefund
5
+ attr_reader :hash
6
+
7
+ def initialize(hash)
8
+ @hash = hash
9
+ end
10
+
11
+ def to_h
12
+ hash
13
+ end
14
+
15
+ # Unique identifier of the Merchant on Global-e.
16
+ #
17
+ # @return [String]
18
+ #
19
+ def merchant_guid
20
+ hash["MerchantGUID"]
21
+ end
22
+
23
+ # Global-e order unique identifier.
24
+ #
25
+ # @return [String]
26
+ #
27
+ def order_id
28
+ hash["OrderId"]
29
+ end
30
+
31
+ # Order unique identifier on the Merchant’s site returned from a
32
+ # previous call to SendOrderToMerchant method for this order.
33
+ #
34
+ # @return [String]
35
+ #
36
+ def merchant_order_id
37
+ hash["MerchantOrderId"]
38
+ end
39
+
40
+ # Refund amount in original Merchant’s currency including the local
41
+ # Merchant’s VAT (currency is specified in CurrencyCode property of the
42
+ # respective Merchant.Order).
43
+ #
44
+ # @return [Float]
45
+ #
46
+ def original_total_refund_amount
47
+ hash["OriginalTotalRefundAmount"]
48
+ end
49
+
50
+ # Total refund amount in end customer’s currency used for this order’s
51
+ # payment (currency is specified in InternationalDetails.CurrencyCode
52
+ # property for the respective Merchant.Order).
53
+ #
54
+ # @return [Float]
55
+ #
56
+ def total_refund_amount
57
+ hash["TotalRefundAmount"]
58
+ end
59
+
60
+ # Reason for the order refund
61
+ #
62
+ # @return [Workarea::GlobalE::Merchant::OrderRefundReason]
63
+ #
64
+ def refund_reason
65
+ @refund_reason ||= OrderRefundReason.new hash["RefundReason"]
66
+ end
67
+
68
+ # Comments for the order refund
69
+ #
70
+ # @return [String]
71
+ #
72
+ def refund_comments
73
+ hash["RefundComponent"]
74
+ end
75
+
76
+ # List of RefundProduct objects for this order refund.
77
+ #
78
+ # @return [Array<Workarea::GlobalE::Merchant::RefundProduct>]
79
+ #
80
+ def products
81
+ @products ||= hash["Products"].map { |refund_product| RefundProduct.new refund_product }
82
+ end
83
+
84
+ # Code used on the merchant’s side to identify the web store, as
85
+ # specified in WebStoreCode argument for SendCart method for the cart
86
+ # converted to this order on Global-e.
87
+ #
88
+ # @return [String]
89
+ #
90
+ def web_store_code
91
+ hash["WebStoreCode"]
92
+ end
93
+
94
+ # List of RefundComponent objects for this order refund.
95
+ #
96
+ # @return [Array<Workarea::GlobalE::Merchant::RefundComponent>]
97
+ #
98
+ def components
99
+ end
100
+ end
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,28 @@
1
+ module Workarea
2
+ module GlobalE
3
+ module Merchant
4
+ class OriginalOrder
5
+ # Global-e order unique identifier for the Original order.
6
+ #
7
+ # @return [String]
8
+ #
9
+ def id
10
+ end
11
+
12
+ # OrderId returned from SendOrderToMerchant call for the Original order.
13
+ #
14
+ # @return [String]
15
+ #
16
+ def merchant_order_id
17
+ end
18
+
19
+ # InternalOrderId returned from SendOrderToMerchant call for the Original order.
20
+ #
21
+ # @return [String]
22
+ #
23
+ def merchant_internal_order_id
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,31 @@
1
+ module Workarea
2
+ module GlobalE
3
+ module Merchant
4
+ class ParcelTracking
5
+
6
+ # Tracking number used by the selected international shipping method
7
+ # for this parcel.
8
+ #
9
+ # @return [String]
10
+ #
11
+ def tracking_number
12
+ end
13
+
14
+ # Full tracking URL including ParcelTrackingNumber used by the selected
15
+ # international shipping method for this parcel.
16
+ #
17
+ # @return [String]
18
+ #
19
+ def tracking_url
20
+ end
21
+
22
+ # Parcel code
23
+ #
24
+ # @return [String]
25
+ #
26
+ def code
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end