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,46 @@
|
|
1
|
+
module Workarea
|
2
|
+
module GlobalE
|
3
|
+
class UpdateOrderDispatchException
|
4
|
+
# Identifier of the cart item on the Merchant’s site. This property may
|
5
|
+
# be optionally specified in SendCart method only, so that the same value
|
6
|
+
# could be posted back when creating the order on the Merchant’s site
|
7
|
+
# with SendOrderToMerchant method.
|
8
|
+
# NOTE either CartItemId or ProductCode should be specified.
|
9
|
+
# This property is mandatory only if ProductCode property has not been specified.
|
10
|
+
#
|
11
|
+
# @return [String]
|
12
|
+
#
|
13
|
+
def cart_item_id
|
14
|
+
end
|
15
|
+
|
16
|
+
# Product unique identifier on the Merchant’s site.
|
17
|
+
# NOTE either CartItemId or ProductCode should be specified.
|
18
|
+
# This property is mandatory only if CartItemId property has not been specified.
|
19
|
+
#
|
20
|
+
# @return [String]
|
21
|
+
#
|
22
|
+
def product_code
|
23
|
+
end
|
24
|
+
|
25
|
+
# Expected date for backordered/preordered/customized item to be
|
26
|
+
# fulfilled (in YYYY-MM-DD format).
|
27
|
+
#
|
28
|
+
# @return [String]
|
29
|
+
#
|
30
|
+
def expected_fulfillment_date
|
31
|
+
end
|
32
|
+
|
33
|
+
# One of the following possible values of ExceptionTypes enumeration:
|
34
|
+
#
|
35
|
+
# | ExceptionType | Name | Description |
|
36
|
+
# -------------------------------------------------------------------
|
37
|
+
# | 1 | Out Of Stock | Out of stock, will not be fulfilled. |
|
38
|
+
# | 2 | Backorder Preorder Customized Item | Backorder/preorder/customized item, will be fulfilled. |
|
39
|
+
#
|
40
|
+
# @return [Integer]
|
41
|
+
#
|
42
|
+
def exception_type
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
module Workarea
|
2
|
+
module GlobalE
|
3
|
+
class UpdateOrderDispatchRequest
|
4
|
+
attr_reader :fulfillment_id, :tracking_number
|
5
|
+
|
6
|
+
def initialize(fulfillment_id, tracking_number: nil)
|
7
|
+
@fulfillment_id = fulfillment_id
|
8
|
+
@tracking_number = tracking_number
|
9
|
+
end
|
10
|
+
|
11
|
+
def as_json(*args)
|
12
|
+
{
|
13
|
+
OrderId: order_id,
|
14
|
+
MerchantOrderId: merchant_order_id,
|
15
|
+
DeliveryReferenceNumber: delivery_reference_number,
|
16
|
+
IsCompleted: is_completed,
|
17
|
+
Parcels: parcels,
|
18
|
+
Exceptions: exceptions,
|
19
|
+
TrackingDetails: tracking_details
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
# Global-e order unique identifier.
|
24
|
+
# NOTE either OrderID or MerchantOrderID should be specified.
|
25
|
+
# This property is mandatory only if MerchantOrderID property has not been specified.
|
26
|
+
#
|
27
|
+
# @return [String]
|
28
|
+
#
|
29
|
+
def order_id
|
30
|
+
order.global_e_id
|
31
|
+
end
|
32
|
+
|
33
|
+
# Order unique identifier on the Merchant’s site.
|
34
|
+
# NOTE either OrderID or MerchantOrderID should be specified.
|
35
|
+
# This property is mandatory only if OrderID property has not been specified.
|
36
|
+
#
|
37
|
+
# @return [String]
|
38
|
+
#
|
39
|
+
def merchant_order_id
|
40
|
+
end
|
41
|
+
|
42
|
+
# Merchant’s internal Delivery Reference Number for this order.
|
43
|
+
#
|
44
|
+
# @return [String]
|
45
|
+
#
|
46
|
+
def delivery_reference_number
|
47
|
+
end
|
48
|
+
|
49
|
+
# Flag to mark orders as “completed” by the merchant. TRUE if order
|
50
|
+
# fulfilment has been completed and no more products will be shipped.
|
51
|
+
# FALSE if order fulfilment hasn’t been completed yet.
|
52
|
+
#
|
53
|
+
# @return [Boolean]
|
54
|
+
#
|
55
|
+
def is_completed
|
56
|
+
[:shipped, :canceled].include? fulfilment.status
|
57
|
+
end
|
58
|
+
|
59
|
+
# List of Parcel object for this UpdateOrderDispatchRequest.
|
60
|
+
# NOTE either Parcels or Exceptions should be specified.
|
61
|
+
# This property is mandatory only if Exceptions property has not been specified.
|
62
|
+
#
|
63
|
+
# @return [Array<Workarea::GlobalE::Parcel>, Nil]
|
64
|
+
#
|
65
|
+
def parcels
|
66
|
+
return unless tracking_number.present?
|
67
|
+
|
68
|
+
@parcels ||= Array.wrap(fulfilment.find_package(tracking_number)).map do |package|
|
69
|
+
GlobalE::Parcel.new(
|
70
|
+
fulfilment,
|
71
|
+
Storefront::PackageViewModel.wrap(package, order: order)
|
72
|
+
)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# List of UpdateOrderDispatchException objects for this the
|
77
|
+
# UpdateOrderDispatchRequest. NOTE either Parcels or Exceptions should be
|
78
|
+
# specified. This property is mandatory only if Parcels property has not
|
79
|
+
# been specified.
|
80
|
+
#
|
81
|
+
# @return [Workarea::GlobalE::UpdateOrderDispatchException, nil]
|
82
|
+
#
|
83
|
+
def exceptions
|
84
|
+
end
|
85
|
+
|
86
|
+
# Tracking information on order level of the parcel in case the merchant
|
87
|
+
# does the shipping by itself.
|
88
|
+
#
|
89
|
+
# @return [Workarea::GlobalE::TrackingDetails nil]
|
90
|
+
#
|
91
|
+
def tracking_details
|
92
|
+
return unless tracking_number.present?
|
93
|
+
|
94
|
+
TrackingDetails.new(tracking_number: tracking_number)
|
95
|
+
end
|
96
|
+
|
97
|
+
private
|
98
|
+
|
99
|
+
def fulfilment
|
100
|
+
@fulfilment ||= Workarea::Fulfillment.find fulfillment_id
|
101
|
+
end
|
102
|
+
|
103
|
+
def order
|
104
|
+
@order ||= Order.find fulfillment_id
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Workarea
|
2
|
+
module GlobalE
|
3
|
+
class UserIdNumberType
|
4
|
+
|
5
|
+
# Code denoting a user identification document type (e.g. Passport, ID
|
6
|
+
# card, etc.) on the Merchant’s site (to be mapped on Global-e side)
|
7
|
+
#
|
8
|
+
# @return [String]
|
9
|
+
#
|
10
|
+
def user_id_number_type_code
|
11
|
+
end
|
12
|
+
|
13
|
+
# Identification document type name
|
14
|
+
#
|
15
|
+
# @return [String]
|
16
|
+
#
|
17
|
+
def name
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,151 @@
|
|
1
|
+
module Workarea
|
2
|
+
module GlobalE
|
3
|
+
class UserDetails
|
4
|
+
# Internal User identifier on the Merchant’s site
|
5
|
+
#
|
6
|
+
# optional
|
7
|
+
#
|
8
|
+
# @return [String]
|
9
|
+
#
|
10
|
+
def user_id
|
11
|
+
end
|
12
|
+
|
13
|
+
# User’s personal ID document number
|
14
|
+
#
|
15
|
+
# optional
|
16
|
+
#
|
17
|
+
# @return [String]
|
18
|
+
#
|
19
|
+
def user_id_number
|
20
|
+
end
|
21
|
+
|
22
|
+
# User’s personal ID document type (e.g. Passport, ID card, etc.)
|
23
|
+
#
|
24
|
+
# optional
|
25
|
+
#
|
26
|
+
# @return [Workarea::GlobalE::UserIdNumberType]
|
27
|
+
#
|
28
|
+
def user_id_number_type
|
29
|
+
end
|
30
|
+
|
31
|
+
# First name
|
32
|
+
#
|
33
|
+
# @return [String]
|
34
|
+
#
|
35
|
+
def first_name
|
36
|
+
end
|
37
|
+
|
38
|
+
# Last name
|
39
|
+
#
|
40
|
+
# @return [String]
|
41
|
+
#
|
42
|
+
def last_name
|
43
|
+
end
|
44
|
+
|
45
|
+
# Middle name
|
46
|
+
#
|
47
|
+
# @return [String
|
48
|
+
#
|
49
|
+
def middle_name
|
50
|
+
end
|
51
|
+
|
52
|
+
# Salutation or title (e.g. Dr., Mr., etc.)
|
53
|
+
#
|
54
|
+
# @return [String]
|
55
|
+
#
|
56
|
+
def salutation
|
57
|
+
end
|
58
|
+
|
59
|
+
# Phone 1
|
60
|
+
#
|
61
|
+
# @return [String]
|
62
|
+
#
|
63
|
+
def phone1
|
64
|
+
end
|
65
|
+
|
66
|
+
# Phone 2
|
67
|
+
#
|
68
|
+
# @return [String]
|
69
|
+
#
|
70
|
+
def phone2
|
71
|
+
end
|
72
|
+
|
73
|
+
# Fax
|
74
|
+
#
|
75
|
+
# @return [String]
|
76
|
+
#
|
77
|
+
def fax
|
78
|
+
end
|
79
|
+
|
80
|
+
# E-mail address
|
81
|
+
#
|
82
|
+
# @return [String]
|
83
|
+
#
|
84
|
+
def email
|
85
|
+
end
|
86
|
+
|
87
|
+
# Company name
|
88
|
+
#
|
89
|
+
# @return [String]
|
90
|
+
#
|
91
|
+
def company
|
92
|
+
end
|
93
|
+
|
94
|
+
# Address line 1
|
95
|
+
#
|
96
|
+
# @return [String]
|
97
|
+
#
|
98
|
+
def address1
|
99
|
+
end
|
100
|
+
|
101
|
+
# Address line 2
|
102
|
+
#
|
103
|
+
# @return [String]
|
104
|
+
#
|
105
|
+
def address2
|
106
|
+
end
|
107
|
+
|
108
|
+
# City name
|
109
|
+
#
|
110
|
+
# @return [String]
|
111
|
+
#
|
112
|
+
def city
|
113
|
+
end
|
114
|
+
|
115
|
+
# State or province name
|
116
|
+
#
|
117
|
+
# @return [String]
|
118
|
+
#
|
119
|
+
def state_or_province
|
120
|
+
end
|
121
|
+
|
122
|
+
# State or province ISO code such as AZ for Arizona (if applicable)
|
123
|
+
#
|
124
|
+
# @return [String]
|
125
|
+
#
|
126
|
+
def state_code
|
127
|
+
end
|
128
|
+
|
129
|
+
# Zip or postal code
|
130
|
+
#
|
131
|
+
# @return [String]
|
132
|
+
#
|
133
|
+
def zip
|
134
|
+
end
|
135
|
+
|
136
|
+
# 2-char ISO country code
|
137
|
+
#
|
138
|
+
# @return [String]
|
139
|
+
#
|
140
|
+
def country_code
|
141
|
+
end
|
142
|
+
|
143
|
+
# Country name
|
144
|
+
#
|
145
|
+
# @return [String]
|
146
|
+
#
|
147
|
+
def country_name
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Workarea
|
2
|
+
module GlobalE
|
3
|
+
class VatCategory
|
4
|
+
|
5
|
+
# Code used to identify the VAT category on the Merchant’s site (to be mapped on Global-e side)
|
6
|
+
#
|
7
|
+
# @return [String]
|
8
|
+
#
|
9
|
+
def vat_category_code
|
10
|
+
end
|
11
|
+
|
12
|
+
# VAT Category name
|
13
|
+
#
|
14
|
+
# @return [String]
|
15
|
+
#
|
16
|
+
def name
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Workarea
|
2
|
+
module GlobalE
|
3
|
+
class VateRateType
|
4
|
+
|
5
|
+
# VAT rate type (or class) code on the Merchant’s site (to be mapped on Global-e side)
|
6
|
+
#
|
7
|
+
# @return [String]
|
8
|
+
#
|
9
|
+
def vat_rate_type_code
|
10
|
+
end
|
11
|
+
|
12
|
+
# VAT rate type name
|
13
|
+
#
|
14
|
+
# @return [String]
|
15
|
+
#
|
16
|
+
def name
|
17
|
+
end
|
18
|
+
|
19
|
+
# VAT rate decimal value
|
20
|
+
#
|
21
|
+
# return [Float]
|
22
|
+
#
|
23
|
+
def rate
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Workarea
|
2
|
+
decorate SaveOrderAnalytics do
|
3
|
+
def all_price_adjustments
|
4
|
+
super + @order.discount_adjustments
|
5
|
+
end
|
6
|
+
|
7
|
+
def discounts_by(field)
|
8
|
+
all_price_adjustments.select(&:discount?).reduce({}) do |memo, price_adjustment|
|
9
|
+
next memo unless price_adjustment.data.has_key? 'discount_id'
|
10
|
+
discount_id = price_adjustment.data['discount_id']
|
11
|
+
|
12
|
+
memo[discount_id] ||= 0
|
13
|
+
memo[discount_id] += price_adjustment.send(field).abs
|
14
|
+
memo
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Workarea
|
2
|
+
decorate Admin::OrderViewModel, with: :global_e do
|
3
|
+
def global_e_api_events
|
4
|
+
@global_e_api_events ||= GlobalE::OrderApiEvents.find model.id rescue nil
|
5
|
+
end
|
6
|
+
|
7
|
+
def total_adjustments
|
8
|
+
return super unless model.global_e?
|
9
|
+
|
10
|
+
model.discount_adjustments
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Workarea
|
2
|
+
decorate Storefront::OrderItemViewModel, with: :global_e do
|
3
|
+
def total_adjustments
|
4
|
+
model.price_adjustments.adjusting("item")
|
5
|
+
end
|
6
|
+
|
7
|
+
def original_price
|
8
|
+
return super unless order.global_e?
|
9
|
+
|
10
|
+
Money.from_amount(
|
11
|
+
international_price_adjustments.first.data['original_price'],
|
12
|
+
order.currency
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Workarea
|
2
|
+
decorate Storefront::OrderViewModel, with: :global_e do
|
3
|
+
def subtotal_price
|
4
|
+
return super unless model.global_e?
|
5
|
+
|
6
|
+
model.international_subtotal_price
|
7
|
+
end
|
8
|
+
|
9
|
+
def total_price
|
10
|
+
return super unless model.global_e?
|
11
|
+
|
12
|
+
model.international_total_price
|
13
|
+
end
|
14
|
+
|
15
|
+
def shipping_total
|
16
|
+
return super unless model.global_e?
|
17
|
+
|
18
|
+
model.international_shipping_total
|
19
|
+
end
|
20
|
+
|
21
|
+
def total_adjustments
|
22
|
+
return super unless model.global_e?
|
23
|
+
|
24
|
+
@total_adjustments ||= international_price_adjustments.reduce_by_description('order')
|
25
|
+
end
|
26
|
+
|
27
|
+
def store_credit_amount
|
28
|
+
if store_credit.present?
|
29
|
+
store_credit.amount
|
30
|
+
else
|
31
|
+
0.to_m(order.currency)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
if Plugin.installed?(:gift_cards)
|
36
|
+
def gift_card_tender_amount
|
37
|
+
if gift_card?
|
38
|
+
gift_card_tender.amount
|
39
|
+
else
|
40
|
+
0.to_m(order.currency)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Workarea
|
2
|
+
decorate Storefront::ProductViewModel, with: :global_e do
|
3
|
+
decorated do
|
4
|
+
delegate :sell_min_fixed_prices, :sell_max_fixed_prices, :original_min_fixed_prices, :original_max_fixed_prices, to: :pricing
|
5
|
+
end
|
6
|
+
|
7
|
+
def current_product?
|
8
|
+
options["controller"] == "workarea/storefront/products" &&
|
9
|
+
options["action"] == "show" &&
|
10
|
+
options["id"] == model.slug
|
11
|
+
end
|
12
|
+
|
13
|
+
# @return [::String, nil]
|
14
|
+
#
|
15
|
+
def country_exceptions_data
|
16
|
+
return unless current_product?
|
17
|
+
|
18
|
+
data = model.country_exceptions.map do |country_exception|
|
19
|
+
[
|
20
|
+
country_exception.country.alpha2,
|
21
|
+
{
|
22
|
+
restricted: country_exception.restricted.presence,
|
23
|
+
vat: country_exception.vat_rate.presence
|
24
|
+
}.compact
|
25
|
+
]
|
26
|
+
end.to_h
|
27
|
+
|
28
|
+
if model.global_e_forbidden?
|
29
|
+
data["all"] = { "forbidden" => true }
|
30
|
+
end
|
31
|
+
|
32
|
+
data.to_json
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
.grid__cell
|
2
|
+
.card{ class: card_classes(:country_exceptions, local_assigns[:active]) }
|
3
|
+
= link_to catalog_product_country_exceptions_path(model), class: 'card__header' do
|
4
|
+
%span.card__header-text= t('workarea.admin.catalog_products.cards.country_exceptions.title')
|
5
|
+
= inline_svg 'workarea/admin/i18n.svg', class: 'card__icon'
|
6
|
+
|
7
|
+
- if local_assigns[:active].blank?
|
8
|
+
.card__body
|
9
|
+
- if model.country_exceptions.empty?
|
10
|
+
%p.card__empty-note= t('workarea.admin.catalog_products.cards.country_exceptions.no_country_exceptions')
|
11
|
+
= link_to catalog_product_country_exceptions_path(model), class: 'card__button' do
|
12
|
+
%span.button.button--small= t('workarea.admin.catalog_products.cards.country_exceptions.add_country_exceptions')
|
13
|
+
- else
|
14
|
+
%ul.list-reset
|
15
|
+
- model.country_exceptions.take(10).each do |country_exception|
|
16
|
+
%li
|
17
|
+
%strong= t('workarea.admin.fields.country')
|
18
|
+
= country_exception.country
|
19
|
+
%li
|
20
|
+
%strong= t('workarea.admin.fields.restricted')
|
21
|
+
= country_exception.restricted
|
22
|
+
|
23
|
+
%li
|
24
|
+
%strong= t('workarea.admin.fields.vat_rate')
|
25
|
+
= country_exception.vat_rate
|
26
|
+
|
27
|
+
%hr.card__hr
|
28
|
+
- if model.country_exceptions.size > 10
|
29
|
+
%li= t('workarea.admin.cards.more', amount: model.country_exceptions.size - 10)
|
30
|
+
= link_to catalog_product_country_exceptions_path(model), class: 'card__button' do
|
31
|
+
%span.button.button--small= t('workarea.admin.catalog_products.cards.country_exceptions.button')
|
@@ -0,0 +1,4 @@
|
|
1
|
+
.grid__cell.grid__cell--25
|
2
|
+
.property
|
3
|
+
%span.property__name= t('workarea.admin.country_exceptions.global_e_forbidden')
|
4
|
+
= toggle_button_for 'product[global_e_forbidden]', @product.global_e_forbidden, title_true: t('workarea.admin.catalog_products.edit.global_e_forbidden'), title_false: t('workarea.admin.catalog_products.edit.not_global_e_forbidden')
|
@@ -0,0 +1,48 @@
|
|
1
|
+
- @page_title = t('workarea.admin.country_exceptions.edit.page_title', product: @product.name)
|
2
|
+
|
3
|
+
.view
|
4
|
+
.view__header
|
5
|
+
.grid
|
6
|
+
.grid__cell.grid__cell--25
|
7
|
+
= render 'workarea/admin/releases/select'
|
8
|
+
.grid__cell.grid__cell--50
|
9
|
+
.view__heading
|
10
|
+
= link_to_index_for(@product)
|
11
|
+
%h1= link_to @product.name, url_for(@product)
|
12
|
+
.grid__cell.grid__cell--25
|
13
|
+
= render_aux_navigation_for(@product)
|
14
|
+
|
15
|
+
.view__container
|
16
|
+
= render_cards_for(@product, :country_exceptions)
|
17
|
+
|
18
|
+
.view__container.view__container
|
19
|
+
= form_tag catalog_product_country_exception_path(@product, @country_exception), method: :patch, data: { unsaved_changes: '' } do
|
20
|
+
|
21
|
+
%table
|
22
|
+
%thead
|
23
|
+
%tr
|
24
|
+
%th= t('workarea.admin.fields.country')
|
25
|
+
%th= t('workarea.admin.fields.vat_rate')
|
26
|
+
%th= t('workarea.admin.fields.restricted')
|
27
|
+
%th
|
28
|
+
%th
|
29
|
+
%tbody
|
30
|
+
- @product.country_exceptions.each do |country_exception|
|
31
|
+
- if country_exception.id == @country_exception.id
|
32
|
+
%tr
|
33
|
+
%td
|
34
|
+
= select_tag "country_exception[country]", options_for_select(global_e_country_options, @country_exception.country.alpha2), title: t('workarea.admin.fields.country')
|
35
|
+
%td
|
36
|
+
= text_field_tag 'country_exception[vat_rate]', @country_exception.vat_rate, class: 'text-box text-box--small', title: t('workarea.admin.fields.vat_rate')
|
37
|
+
%td
|
38
|
+
= toggle_button_for 'country_exception[restricted]', @country_exception.restricted?
|
39
|
+
- else
|
40
|
+
%tr
|
41
|
+
%td= country_exception.country
|
42
|
+
%td= country_exception.vat_rate
|
43
|
+
%td= country_exception.restricted
|
44
|
+
%td
|
45
|
+
|
46
|
+
.workflow-bar
|
47
|
+
.grid.grid--auto.grid--right.grid--middle
|
48
|
+
.grid__cell= button_tag t('workarea.admin.form.save_changes'), value: 'save_country_exception', class: 'workflow-bar__button workflow-bar__button--update'
|
@@ -0,0 +1,47 @@
|
|
1
|
+
- @page_title= t('workarea.admin.country_exceptions.index.page_title', product: @product.name)
|
2
|
+
|
3
|
+
.view
|
4
|
+
.view__header
|
5
|
+
.grid
|
6
|
+
.grid__cell.grid__cell--25
|
7
|
+
= render 'workarea/admin/releases/select'
|
8
|
+
.grid__cell.grid__cell--50
|
9
|
+
.view__heading
|
10
|
+
= link_to_index_for(@product)
|
11
|
+
%h1= link_to @product.name, url_for(@product)
|
12
|
+
.grid__cell.grid__cell--25
|
13
|
+
= render_aux_navigation_for(@product)
|
14
|
+
|
15
|
+
.view__container
|
16
|
+
= render_cards_for(@product, :country_exceptions)
|
17
|
+
|
18
|
+
.section
|
19
|
+
%h2.view__heading= t('workarea.admin.country_exceptions.index.heading')
|
20
|
+
|
21
|
+
%table.index-table
|
22
|
+
%thead
|
23
|
+
%tr
|
24
|
+
%th= t('workarea.admin.fields.country')
|
25
|
+
%th= t('workarea.admin.fields.vat_rate')
|
26
|
+
%th= t('workarea.admin.fields.restricted')
|
27
|
+
%th
|
28
|
+
%tbody
|
29
|
+
- @product.country_exceptions.each do |country_exception|
|
30
|
+
%tr.index-table__row
|
31
|
+
%td= country_exception.country.name
|
32
|
+
%td= country_exception.vat_rate
|
33
|
+
%td
|
34
|
+
- if country_exception.restricted?
|
35
|
+
restricted
|
36
|
+
- else
|
37
|
+
not restricted
|
38
|
+
%td
|
39
|
+
.align-right<
|
40
|
+
= link_to edit_catalog_product_country_exception_path(@product, country_exception), id: dom_id(country_exception, 'edit_action') do
|
41
|
+
= inline_svg('workarea/admin/icons/edit.svg', class: 'svg-icon svg-icon--small', title: t('workarea.admin.actions.edit'))
|
42
|
+
= link_to catalog_product_country_exception_path(@product, country_exception), id: dom_id(country_exception, 'delete_action'), data: { method: 'delete', confirm: t('workarea.admin.actions.delete_confirmation') } do
|
43
|
+
= inline_svg('workarea/admin/icons/delete.svg', class: 'svg-icon svg-icon--small svg-icon--red', title: t('workarea.admin.actions.delete'))
|
44
|
+
.workflow-bar
|
45
|
+
.grid.grid--auto.grid--right.grid--middle
|
46
|
+
.grid__cell
|
47
|
+
= link_to t('workarea.admin.country_exceptions.index.add_new'), new_catalog_product_country_exception_path(@product), class: 'workflow-bar__button workflow-bar__button--create'
|