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,161 @@
1
+ module Workarea
2
+ module GlobalE
3
+ module Merchant
4
+ class PaymentDetails
5
+ # Card owner’s first name
6
+ # (optional if OwnerName is specified)
7
+ #
8
+ # @return [String]
9
+ #
10
+ def owner_first_name
11
+ end
12
+
13
+ # Card owner’s last name
14
+ # (optional if OwnerName is specified)
15
+ #
16
+ # @return [String]
17
+ #
18
+ def owner_last_name
19
+ end
20
+
21
+ # Card owner’s full name (the Merchant’s may choose to consider either
22
+ # full name or first name with last name, according to the existing
23
+ # payment method input validation requirements).
24
+ #
25
+ # @return [String]
26
+ #
27
+ def owner_name
28
+ end
29
+
30
+ # Card numer
31
+ #
32
+ # @return [String]
33
+ #
34
+ def card_number
35
+ end
36
+
37
+ # Card CVV number
38
+ #
39
+ # @return [String]
40
+ #
41
+ def cvv_number
42
+ end
43
+
44
+ # Payment method name
45
+ #
46
+ # @return [String]
47
+ #
48
+ def payment_method_name
49
+ end
50
+
51
+ # Payment method code used to identify the payment method on the
52
+ # Merchant’s site (to be mapped on Global-e side).
53
+ #
54
+ # @return [String]
55
+ #
56
+ def payment_method_code
57
+ end
58
+
59
+ # Payment method type’s code used to identify the payment method type
60
+ # (such as Credit Card or Check) on the Merchant’s site (to be mapped
61
+ # on Global-e side).
62
+ #
63
+ # @return [String]
64
+ #
65
+ def payment_method_type_code
66
+ end
67
+
68
+ # Card expiration date (in YYYY-MM-DD format)
69
+ #
70
+ # @return [String]
71
+ #
72
+ def expiration_date
73
+ end
74
+
75
+ # Country name
76
+ #
77
+ # @return [String]
78
+ #
79
+ def country_name
80
+ end
81
+
82
+ # 2-char ISO country code
83
+ #
84
+ # @return [String]
85
+ #
86
+ def country_code
87
+ end
88
+
89
+ # State or province ISO code such as AZ for Arizona (if applicable)
90
+ #
91
+ # @return [String]
92
+ #
93
+ def state_code
94
+ end
95
+
96
+ # State or province name
97
+ #
98
+ # @return [String]
99
+ #
100
+ def state_or_province
101
+ end
102
+
103
+ # City name
104
+ #
105
+ # @return [String]
106
+ #
107
+ def city
108
+ end
109
+
110
+ # Zip or postal code
111
+ #
112
+ # @return [String]
113
+ #
114
+ def zip
115
+ end
116
+
117
+ # Address line 1
118
+ #
119
+ # @return [String]
120
+ #
121
+ def address1
122
+ end
123
+
124
+ # Address line 2
125
+ #
126
+ # @return [String]
127
+ #
128
+ def address2
129
+ end
130
+
131
+ # Phone 1
132
+ #
133
+ # @return [String]
134
+ #
135
+ def phone1
136
+ end
137
+
138
+ # Phone 2
139
+ #
140
+ # @return [String]
141
+ #
142
+ def phone2
143
+ end
144
+
145
+ # Fax
146
+ #
147
+ # @return [String]
148
+ #
149
+ def fax
150
+ end
151
+
152
+ # E-mail address
153
+ #
154
+ # @return [String]
155
+ #
156
+ def email
157
+ end
158
+ end
159
+ end
160
+ end
161
+ end
@@ -0,0 +1,222 @@
1
+ module Workarea
2
+ module GlobalE
3
+ module Merchant
4
+ class Product
5
+ attr_reader :hash
6
+
7
+ def initialize(hash)
8
+ @hash = hash
9
+ end
10
+
11
+ # SKU code used to identify the product on the Merchant’s site (to be
12
+ # mapped on Global-e side).
13
+ #
14
+ # @return [String]
15
+ #
16
+ def sku
17
+ hash["Sku"]
18
+ end
19
+
20
+ # Single product price in currency defined in CurrencyCode property of
21
+ # the respective Merchant.Order object for the order being submitted to
22
+ # the Merchant.
23
+ #
24
+ # @return [Float]
25
+ #
26
+ def price
27
+ hash["Price"]
28
+ end
29
+
30
+ # VAT rate applied to this product
31
+ #
32
+ # @return [Float]
33
+ #
34
+ def vat_rate
35
+ hash["VATRate"]
36
+ end
37
+
38
+ # Single product price in end customer’s currency (specified in
39
+ # InternationalDetails.CurrencyCode property for the respective
40
+ # Merchant.Order), after applying country coefficient, FX conversion,
41
+ # rounding rule (if applicable) and IncludeVAT handling.
42
+ #
43
+ # @return [Float]
44
+ #
45
+ def international_price
46
+ hash["InternationalPrice"]
47
+ end
48
+
49
+ # Line item (product in ordered quantity) price in end customer’s
50
+ # currency (specified in InternationalDetails.CurrencyCode property for
51
+ # the respective Merchant.Order), after applying country coefficient,
52
+ # FX conversion, rounding rule (if applicable) and IncludeVAT handling.
53
+ # If not specified, should be deemed equal to “InternationalPrice *
54
+ # Quantity”. If specified, should take preference over InternationalPrice.
55
+ #
56
+ # @return [Float]
57
+ #
58
+ def line_item_international_price
59
+ end
60
+
61
+ # Conversion rate applied to this product’s price paid by the end
62
+ # customer, when calculating the prices paid by Global-e to the Merchant
63
+ # in the original Merchant’s currency. This rate includes “FX conversion”
64
+ # and “marketing rounding” factors.
65
+ #
66
+ # @return [Float]
67
+ #
68
+ def rounding_rate
69
+ hash["RoundingRate"]
70
+ end
71
+
72
+ # Product quantity in the order that is currently being submitted to the Merchant.
73
+ #
74
+ # @return [Integer]
75
+ #
76
+ def quantity
77
+ hash["Quantity"]
78
+ end
79
+
80
+ # Identifier of the cart item on the Merchant’s site originally
81
+ # specified in Product.CartItemId property of the respective product in
82
+ # SendCart method for the cart converted to this order on Global-e.
83
+ #
84
+ # @return [String]
85
+ #
86
+ def cart_item_id
87
+ hash["CartItemId"]
88
+ end
89
+
90
+ # Identifier of the current item’s parent cart item on the Merchant’s
91
+ # site originally specified in Product.ParentCartItemId property of the
92
+ # respective product in SendCart method for the cart converted to this
93
+ # order on Global-e.
94
+ #
95
+ # @return [String]
96
+ #
97
+ def parent_cart_item_id
98
+ hash["ParentCartItemId"]
99
+ end
100
+
101
+ # Identifier of the child cart item “option” on the Merchant’s site
102
+ # originally specified in Product.CartItemOptionId property of the
103
+ # respective product in SendCart method for the cart converted to this
104
+ # order on Global-e.
105
+ #
106
+ # @return [String]
107
+ #
108
+ def cart_item_option_id
109
+ hash["CartItemOptionId"]
110
+ end
111
+
112
+ # Code originally specified in Product.HandlingCode property of the
113
+ # respective product in SendCart method for the cart converted to this
114
+ # order on Global-e.
115
+ #
116
+ # @return [String]
117
+ #
118
+ def handling_code
119
+ hash["HandlingCode"]
120
+ end
121
+
122
+ # Text originally specified in Product.GiftMessage property of the
123
+ # respective product in SendCart method for the cart converted to this order on Global-e.
124
+ #
125
+ # @return [String]
126
+ #
127
+ def gift_message
128
+ hash["GiftMessage"]
129
+ end
130
+
131
+ # Boolean specifying if the product was ordered as a backed ordered item
132
+ #
133
+ # @return [Boolean]
134
+ #
135
+ def is_back_ordered
136
+ hash["IsBackOrdered"]
137
+ end
138
+
139
+ # Estimated date for the backordered item to be in stock
140
+ #
141
+ # @return [String]
142
+ #
143
+ def back_order_date
144
+ hash["BackOrderDate"]
145
+ end
146
+
147
+ # The product value in merchant currency after deducting all product and
148
+ # cart level discounts from the price. Product level discounts will be
149
+ # fully deducted from the respective product’s price and cart discounts
150
+ # will be prorated over all products according to the remaining value.
151
+ #
152
+ # This value can be used as pre-calculated value for returned product’s refund.
153
+ #
154
+ # @return [Float]
155
+ #
156
+ def discounted_price
157
+ hash["DiscountedPrice"]
158
+ end
159
+
160
+ # The product value in customer currency after deducting all product and
161
+ # cart level discounts from the price. Product level discounts will be
162
+ # fully deducted from the respective product’s price and cart discounts
163
+ # will be prorated over all products according to the remaining value.
164
+ #
165
+ # This value can be used as pre-calculated value for returned product’s refund.
166
+ #
167
+ # @return [Float]
168
+ #
169
+ def international_discounted_price
170
+ hash["InternationalDiscountedPrice"]
171
+ end
172
+
173
+ # Product’s brand
174
+ #
175
+ # @return [Workarea::GlobalE::MerchantBrand]
176
+ #
177
+ def brand
178
+ end
179
+
180
+ # Product’s categories
181
+ #
182
+ # @return [Array<Workarea::GlobalE::MerchantCategory>]
183
+ #
184
+ def categories
185
+ end
186
+
187
+ # Custom attributes describe product that customer can personalize
188
+ # according to what the site offers. Each Attribute holds Key to specify
189
+ # attribute name and Value properties.
190
+ #
191
+ # @return [Array<Workarea::GlobalE::CartProductAttribute>]
192
+ #
193
+ def attributes
194
+ end
195
+
196
+ def list_price
197
+ hash["ListPrice"]
198
+ end
199
+
200
+ def international_list_price
201
+ hash["InternationalListPrice"]
202
+ end
203
+
204
+ # Product price exclusive of duties & taxes in base currency
205
+ #
206
+ # @return [String]
207
+ #
208
+ def discounted_price_for_customs
209
+ hash["DiscountedPriceForCustoms"]
210
+ end
211
+
212
+ # Product HS code
213
+ #
214
+ # @return [String]
215
+ #
216
+ def generic_hs_code
217
+ hash["GenericHSCode"]
218
+ end
219
+ end
220
+ end
221
+ end
222
+ end
@@ -0,0 +1,69 @@
1
+ module Workarea
2
+ module GlobalE
3
+ module Merchant
4
+ class RefundProduct
5
+ attr_reader :hash
6
+
7
+ def initialize(hash)
8
+ @hash = hash
9
+ end
10
+
11
+ # Identifier of the line item on the Merchant’s site. This property is
12
+ # mandatory and should be equal to the respective Product’s CartItemId
13
+ # originally specified in SendCart method for the order being refunded.
14
+ #
15
+ # @return [String]
16
+ #
17
+ def cart_item_id
18
+ hash["CartItemId"]
19
+ end
20
+
21
+ # Product quantity (i.e. a part of the originally ordered quantity)
22
+ # that the refund refers to.
23
+ #
24
+ # @return [Integer]
25
+ #
26
+ def refund_quantity
27
+ hash["RefundQuantity"]
28
+ end
29
+
30
+ # Refund amount in original Merchant’s currency including the local
31
+ # Merchant’s VAT for this product line item, before applying any price
32
+ # modifications (i.e. part of or the full value paid by Global-e to the
33
+ # Merchant, as was specified in Merchant.Product.Price for the
34
+ # respective order).
35
+ #
36
+ # @return [Float]
37
+ #
38
+ def original_refund_amount
39
+ hash["OriginalRefundAmount"]
40
+ end
41
+
42
+ # Refund amount for this product line item in end customer’s currency
43
+ # used for this order’s payment.
44
+ #
45
+ # @return [Float]
46
+ #
47
+ def refund_amount
48
+ hash["RefundAmount"]
49
+ end
50
+
51
+ # Reason for this product’s refund
52
+ #
53
+ # @return [Hash]
54
+ #
55
+ def refund_reason
56
+ hash["RefundReason"]
57
+ end
58
+
59
+ # Comments for this product’s refund
60
+ #
61
+ # @return [String]
62
+ #
63
+ def refund_comments
64
+ hash["RefundComments"]
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,115 @@
1
+ module Workarea
2
+ module GlobalE
3
+ module Merchant
4
+ class ResponseInfo
5
+ attr_reader :order
6
+
7
+ def self.error(message:, order: nil)
8
+ new(success: false, message: message, order: order)
9
+ end
10
+
11
+ def initialize(order: nil, message: nil, success: true)
12
+ @order = order
13
+ @message = message
14
+ @success = success
15
+ end
16
+
17
+ def to_h
18
+ {
19
+ InternalOrderId: internal_order_id,
20
+ OrderId: order_id,
21
+ StatusCode: status_code,
22
+ PaymentCurrencyCode: payment_currency_code,
23
+ PaymentAmount: payment_amount,
24
+ Success: success,
25
+ ErrorCode: error_code,
26
+ Message: message,
27
+ Description: description
28
+ }
29
+ end
30
+
31
+ def as_json(*args)
32
+ to_h
33
+ end
34
+
35
+ # Order unique identifier on the Merchant’s site
36
+ # (optional in case of error, failure or if the action is not related
37
+ # to a specific order)
38
+ #
39
+ # @return [String]
40
+ #
41
+ def internal_order_id
42
+ order&.id
43
+ end
44
+
45
+ # Order identifier on the Merchant’s site used for display and reporting
46
+ # purposes only. Unlike InternalOrderId, this identifier is not
47
+ # necessarily unique over time, as the Merchant’s site may potentially
48
+ # reuse it (for example after deleting the old order having the same
49
+ # OrderId).
50
+ #
51
+ # @return [String]
52
+ #
53
+ def order_id
54
+ end
55
+
56
+ # Code denoting the order status on the Merchant’s site (to be mapped
57
+ # on Global-e side).
58
+ # (optional in case of error or failure)
59
+ #
60
+ # @return [String]
61
+ #
62
+ def status_code
63
+ end
64
+
65
+ # 3-char ISO currency code for the order (if payment was processed in
66
+ # the respective API method call).
67
+ #
68
+ # @return [String]
69
+ #
70
+ def payment_currency_code
71
+ end
72
+
73
+ # The total payment amount in PaymentCurrency charged for the order
74
+ # (if payment was processed in the respective API method call).
75
+ #
76
+ # @return [String]
77
+ #
78
+ def payment_amount
79
+ end
80
+
81
+ # Indicates if the call has succeeded. FALSE denotes an error or failure.
82
+ #
83
+ # @return [Boolean]
84
+ #
85
+ def success
86
+ @success
87
+ end
88
+
89
+ # Error code to be returned when an error occurs.
90
+ #
91
+ # @return [String]
92
+ #
93
+ def error_code
94
+ end
95
+
96
+ # Optional response message. In case of an error, this property
97
+ # indicates the error message text.
98
+ #
99
+ # @return [String]
100
+ #
101
+ def message
102
+ @message
103
+ end
104
+
105
+ # Optional response description. In case of an error, this property
106
+ # indicates the error message description.
107
+ #
108
+ # @return [String]
109
+ #
110
+ def description
111
+ end
112
+ end
113
+ end
114
+ end
115
+ end
@@ -0,0 +1,21 @@
1
+ module Workarea
2
+ module GlobalE
3
+ module Merchant
4
+ class CartProductAttribute
5
+ # Custom product attribute name that is used to describe personalized product.
6
+ #
7
+ # @return [String]
8
+ #
9
+ def attribute_key
10
+ end
11
+
12
+ # Custom product attribute value that is used to describe personalized product.
13
+ #
14
+ # @return [String]
15
+ #
16
+ def attribute_value
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,20 @@
1
+ module Workarea
2
+ module GlobalE
3
+ class OrderStatus
4
+ # Code denoting the order status on the Merchant’s site (to be mapped on
5
+ # Global-e side)
6
+ #
7
+ # @return [String]
8
+ #
9
+ def status_code
10
+ end
11
+
12
+ # Order status name
13
+ #
14
+ # @return [String]
15
+ #
16
+ def name
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,79 @@
1
+ module Workarea
2
+ module GlobalE
3
+ class OrderStatusDetails
4
+ # Global-e order unique identifier (previously submitted to the Merchant’s
5
+ # SendOrderToMerchant method defined below in this document when an order
6
+ # had been created with Global-e checkout)
7
+ #
8
+ # @return [String]
9
+ #
10
+ def order_id
11
+ end
12
+
13
+ # Order status
14
+ #
15
+ # @return [Workarea::GlobalE::OrderStatus]
16
+ #
17
+ def order_status
18
+ end
19
+
20
+ # Reason for the order status
21
+ #
22
+ # @return [Workarea::GlobalE::OrderStatusReason]
23
+ #
24
+ def order_status_reason
25
+ end
26
+
27
+ # Merchant's comments for the order
28
+ #
29
+ # @return [String]
30
+ #
31
+ def order_comments
32
+ end
33
+
34
+ # Merchant's Order confirmation number
35
+ #
36
+ # @return [String]
37
+ #
38
+ def confirmation_number
39
+ end
40
+
41
+ # Name of the tracking service used by the Merchant for this order
42
+ #
43
+ # @return [String]
44
+ #
45
+ def tracking_service_name
46
+ end
47
+
48
+ # URL of the tracking service site used by the Merchant for this order
49
+ #
50
+ # @return [String]
51
+ #
52
+ def tracking_service_site
53
+ end
54
+
55
+ # Reference number valid for the tracking service used by the Merchant
56
+ # for this order
57
+ #
58
+ # @return [String]
59
+ #
60
+ def tracking_number
61
+ end
62
+
63
+ # Full tracking URL on the tracking service site used by the Merchant
64
+ # (if specified overrides all other “Tracking...” properties)
65
+ #
66
+ # @return [String]
67
+ #
68
+ def tracking_number
69
+ end
70
+
71
+ # Merchant’s internal Delivery Reference Number for this order
72
+ #
73
+ # @return [String]
74
+ #
75
+ def delivery_reference_number
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,20 @@
1
+ module Workarea
2
+ module GlobalE
3
+ class OrderStatusReason
4
+ # Code denoting the order status reason on the Merchant’s site (to be
5
+ # mapped on Global-e side)
6
+ #
7
+ # @return [String]
8
+ #
9
+ def reason_code
10
+ end
11
+
12
+ # Order status reason name
13
+ #
14
+ # @return [String]
15
+ #
16
+ def name
17
+ end
18
+ end
19
+ end
20
+ end