workarea-global_e 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2bcc2917f5a64ec8d14456093734b5c4b1a6e1fcf85b0976a66e57a91dc58abc
4
- data.tar.gz: c05824af47f63ca359feaaa9e4a731106ba9f6da1b33c29ecacda078311bfa9b
3
+ metadata.gz: 7609c8b1d109755fdd1f9209e780e17c8dd8cb4019d91a1a334195e147c6799a
4
+ data.tar.gz: 1ec1dde2e420607e6a3fb24361f46d68dcd96f55c8bca1229b0377b068962dad
5
5
  SHA512:
6
- metadata.gz: eb0499af8c77ed655353602d2617a168c61d92290db8f4fb08902a51d4a320613d9aa9f095e1d74b4079c52318ed98ff177569f96722c8ee69d91fe74cd8ec4d
7
- data.tar.gz: e6fa70f2c129fb2a421b6088cfd63b384b00dc0c57ae3e3f043d8bb86daffbc6916c00b65ef1f28fb43ea0d563bcb96793f8b955037808f2c0837c9d08b188fb
6
+ metadata.gz: 6139db47b82de4d54aa7716d230b965fcf29f0e303123bef03ee22893320610ce14d9310b2dc43cf5a7fca75979771db47291375e7e0b5d6a858b790070d4c9f
7
+ data.tar.gz: 8f4efb121bf62a50a5c5ea73cd6226068e4a0e1ba3776f07b63214a54721ffd32c56e6483697dcd03f2da6c1194f1e9f1ec635b9b737220cf97a677a2cce4eaf
data/CHANGELOG.md CHANGED
@@ -1,6 +1,15 @@
1
- Workarea Global E 1.2.1 (2020-01-21)
1
+ Workarea Global E 1.3.0 (2020-01-21)
2
2
  --------------------------------------------------------------------------------
3
3
 
4
+ * Upgrade For Workarea v3.4
5
+
6
+ Allows the Global-e integration to be used with Workarea v3.4 and above.
7
+ It involves mostly minor changes surrounding the differences between the
8
+ former analytics and the new metrics/insights system.
9
+
10
+ GLOBALE-5
11
+ Tom Scott
12
+
4
13
  * Add Discount Adjustments To Admin Order Views
5
14
 
6
15
  The `#discount_adjustments` on an order are now being output to the
data/Gemfile CHANGED
@@ -2,11 +2,10 @@ source 'https://rubygems.org'
2
2
  git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
3
 
4
4
  source 'https://gems.weblinc.com' do
5
- gem 'workarea'
6
5
  gem 'workarea-ci'
7
- gem 'workarea-gift_cards', '~> 3'
8
6
  end
9
7
 
8
+ gem 'workarea-gift_cards', github: 'workarea-commerce/workarea-gift-cards', branch: 'GIFTCARDS-7-backport-missing-via-param' # '~> 3.4.7'
10
9
  gem 'sprockets', '~> 3'
11
10
 
12
11
  gemspec
@@ -1,5 +1,5 @@
1
1
  module Workarea
2
- decorate SaveOrderAnalytics do
2
+ decorate OrderMetrics, with: :global_e do
3
3
  def all_price_adjustments
4
4
  super + @order.discount_adjustments
5
5
  end
@@ -46,7 +46,7 @@ module Workarea
46
46
 
47
47
  def place_order_side_effects
48
48
  CreateFulfillment.new(order, global_e: true).perform
49
- SaveOrderAnalytics.new(order).perform
49
+ SaveOrderMetrics.perform_async(order.id)
50
50
  end
51
51
 
52
52
  def update_order
@@ -14,118 +14,128 @@
14
14
  = render_cards_for(@order, :attributes)
15
15
 
16
16
  .view__container.view__container--narrow
17
- .grid
18
- .grid__cell.grid__cell--25
19
- %h2= t('workarea.admin.orders.attributes.checkout.title')
20
- %ul.list-reset
21
- - if @order.user.present? || @order.email.present?
22
- %li
23
- %strong= t('workarea.admin.orders.attributes.checkout.customer')
24
- - if @order.user.present?
25
- = link_to @order.user.name, user_path(@order.user)
26
- - else
27
- = @order.email
28
- - if @order.checkout_by.present? && @order.checkout_by != @order.user
17
+ .section
18
+ .grid
19
+ .grid__cell.grid__cell--25
20
+ %h2= t('workarea.admin.orders.attributes.checkout.title')
21
+ %ul.list-reset
22
+ - if @order.user.present? || @order.email.present?
23
+ %li
24
+ %strong= t('workarea.admin.orders.attributes.checkout.customer')
25
+ - if @order.user.present?
26
+ = link_to @order.user.name, user_path(@order.user)
27
+ - else
28
+ = @order.email
29
+ - if @order.checkout_by.present? && @order.checkout_by != @order.user
30
+ %li
31
+ %strong
32
+ = t('workarea.admin.orders.attributes.checkout.placed_by')
33
+ = link_to @order.checkout_by.name, user_path(@order.checkout_by)
34
+ - if @order.source.present?
35
+ %li
36
+ %strong
37
+ = t('workarea.admin.orders.attributes.checkout.source')
38
+ = @order.source.titleize
39
+ - if @order.copied_from.present?
40
+ %li
41
+ %strong
42
+ = t('workarea.admin.fields.copied_from_id')
43
+ = link_to @order.copied_from.name, order_path(@order.copied_from)
44
+ %li
45
+ %strong= t('workarea.admin.orders.attributes.checkout.status')
46
+ = @order.model.status.to_s.titleize
47
+ %li
48
+ %strong= t('workarea.admin.orders.attributes.checkout.promo_codes')
49
+ = @order.promo_codes.join(', ').presence || t('workarea.admin.orders.attributes.checkout.none')
50
+ %li
51
+ %strong= t('workarea.admin.orders.attributes.checkout.placed')
52
+ - if @order.placed?
53
+ = local_time_ago(@order.placed_at)
54
+ %li
55
+ %strong= t('workarea.admin.orders.attributes.checkout.ip_address')
56
+ = @order.ip_address.presence || t('workarea.admin.orders.attributes.checkout.none')
29
57
  %li
30
- %strong
31
- = t('workarea.admin.orders.attributes.checkout.placed_by')
32
- = link_to @order.checkout_by.name, user_path(@order.checkout_by)
33
- - if @order.source.present?
58
+ %strong= t('workarea.admin.orders.attributes.checkout.traffic_referrer')
59
+ = @order.traffic_referrer&.medium.presence || t('workarea.admin.orders.attributes.checkout.none')
34
60
  %li
35
- %strong
36
- = t('workarea.admin.orders.attributes.checkout.source')
37
- = @order.source.titleize
38
- - if @order.copied_from.present?
61
+ %strong= t('workarea.admin.orders.attributes.checkout.traffic_referrer_url')
62
+ - if @order.traffic_referrer&.uri.present?
63
+ = link_to t('workarea.admin.orders.attributes.checkout.view'), '#traffic_referrer_url_tooltip', data: { tooltip: { interactive: true, trigger: 'click' }.to_json }
64
+ #traffic_referrer_url_tooltip.tooltip-content
65
+ .align-center
66
+ %p= text_field_tag nil, @order.traffic_referrer.uri, id: 'traffic_referrer_url', class: 'text-box'
67
+ = button_tag t('workarea.admin.orders.attributes.checkout.copy_url'), data: { copy_to_clipboard: '#traffic_referrer_url' }, class: 'button button--small'
68
+ - else
69
+ = t('workarea.admin.orders.attributes.checkout.none')
39
70
  %li
40
- %strong
41
- = t('workarea.admin.fields.copied_from_id')
42
- = link_to @order.copied_from.name, order_path(@order.copied_from)
43
- %li
44
- %strong= t('workarea.admin.orders.attributes.checkout.status')
45
- = @order.model.status.to_s.titleize
46
- %li
47
- %strong= t('workarea.admin.orders.attributes.checkout.promo_codes')
48
- = @order.promo_codes.join(', ').presence || t('workarea.admin.orders.attributes.checkout.none')
49
- %li
50
- %strong= t('workarea.admin.orders.attributes.checkout.placed')
51
- - if @order.placed?
52
- = local_time_ago(@order.placed_at)
53
- %li
54
- %strong= t('workarea.admin.orders.attributes.checkout.ip_address')
55
- = @order.ip_address.presence || t('workarea.admin.orders.attributes.checkout.none')
56
- %li
57
- %strong= t('workarea.admin.fields.updated_at')
58
- #{local_time_ago(@order.updated_at)}
59
- %li
60
- %strong= t('workarea.admin.fields.created_at')
61
- #{local_time_ago(@order.created_at)}
62
- = append_partials('admin.order_attributes', order: @order)
71
+ %strong= t('workarea.admin.fields.updated_at')
72
+ #{local_time_ago(@order.updated_at)}
73
+ %li
74
+ %strong= t('workarea.admin.fields.created_at')
75
+ #{local_time_ago(@order.created_at)}
76
+ = append_partials('admin.order_attributes', order: @order)
63
77
 
64
- .grid__cell.grid__cell--75
65
- %h2= t('workarea.admin.orders.attributes.items.title')
66
- %table
67
- %thead
68
- %tr
69
- %th= t('workarea.admin.orders.attributes.items.product')
70
- %th.align-center= t('workarea.admin.orders.attributes.items.quantity')
71
- %th.align-right= t('workarea.admin.orders.attributes.items.pricing')
72
- %th.align-right= t('workarea.admin.orders.attributs.items.nonadjusted_pricing')
73
- %tbody
74
- - @order.items.each do |item|
78
+ .grid__cell.grid__cell--75
79
+ %h2= t('workarea.admin.orders.attributes.items.title')
80
+ %table
81
+ %thead
75
82
  %tr
76
- %td
77
- .grid.grid--auto
78
- .grid__cell
79
- = link_to image_tag(product_image_url(item.image, :small), alt: item.product.name), catalog_product_url(item.product, sku: item.sku)
80
- .grid__cell
81
- %p= link_to item.product.name, catalog_product_path(item.product, sku: item.sku)
82
- %p= item.sku
83
- - if item.customizations.any?
84
- - item.customizations.each do |name, value|
85
- %p #{name.titleize}: #{value}
86
- = append_partials('admin.order_attributes_item_details', item: item)
87
- %td.align-center= item.quantity
88
- %td.align-right
89
- - item.price_adjustments.each do |adjustment|
90
- %p
91
- %strong= price_adjustment_description_for(adjustment)
92
- %span= number_to_currency(adjustment.amount)
93
- %td.align-right
94
- - if item.nonadjusted_amount.present?
95
- %p
96
- %span= number_to_currency(item.nonadjusted_amount.amount)
97
- .grid.grid--right
98
- .grid__cell.grid__cell--50
99
- %table.data-pairs
100
- %tbody
101
- %tr
102
- %th
103
- %span.data-pairs__name= t('workarea.admin.orders.attributes.totals.subtotal')
104
- %td= number_to_currency @order.subtotal_price
105
- - if @order.total_adjustments.any?
106
- - @order.total_adjustments.each do |adjustment|
107
- %tr
108
- %th
109
- %span= adjustment.description.titleize
110
- %td
111
- - if adjustment.discount?
112
- %strong= number_to_currency(adjustment.amount)
113
- - else
114
- %span= number_to_currency(adjustment.amount)
115
- %tr
116
- %th
117
- %span.data-pairs__name= t('workarea.admin.orders.attributes.totals.shipping')
118
- %td= number_to_currency @order.shipping_total
83
+ %th= t('workarea.admin.orders.attributes.items.product')
84
+ %th.align-center= t('workarea.admin.orders.attributes.items.quantity')
85
+ %th.align-right= t('workarea.admin.orders.attributes.items.pricing')
86
+ %tbody
87
+ - @order.items.each do |item|
119
88
  %tr
120
- %th
121
- %span.data-pairs__name= t('workarea.admin.orders.attributes.totals.tax')
122
- %td= number_to_currency @order.tax_total
123
- %tr
124
- %th
125
- %span.data-pairs__name= t('workarea.admin.orders.attributes.totals.total_price')
126
89
  %td
127
- %strong= number_to_currency @order.total_price
128
- %tr
129
- %th
130
- %span.data-pairs__name= t('workarea.admin.orders.attributes.totals.total_value')
131
- %td= number_to_currency @order.total_value
90
+ .grid.grid--auto
91
+ .grid__cell
92
+ = link_to image_tag(product_image_url(item.image, :small), alt: item.product.name), catalog_product_url(item.product, sku: item.sku)
93
+ .grid__cell
94
+ %p= link_to item.product.name, catalog_product_path(item.product, sku: item.sku)
95
+ %p= item.sku
96
+ - if item.customizations.any?
97
+ - item.customizations.each do |name, value|
98
+ %p #{name.titleize}: #{value}
99
+ = append_partials('admin.order_attributes_item_details', item: item)
100
+ %td.align-center= item.quantity
101
+ %td.align-right
102
+ - item.price_adjustments.each do |adjustment|
103
+ %p
104
+ %strong= price_adjustment_description_for(adjustment)
105
+ %span= number_to_currency(adjustment.amount)
106
+
107
+ .grid.grid--right
108
+ .grid__cell.grid__cell--50
109
+ %table.data-pairs
110
+ %tbody
111
+ %tr
112
+ %th
113
+ %span.data-pairs__name= t('workarea.admin.orders.attributes.totals.subtotal')
114
+ %td= number_to_currency @order.subtotal_price
115
+ - if @order.total_adjustments.any?
116
+ - @order.total_adjustments.each do |adjustment|
117
+ %tr
118
+ %th
119
+ %span= adjustment.description.titleize
120
+ %td
121
+ - if adjustment.discount?
122
+ %strong= number_to_currency(adjustment.amount)
123
+ - else
124
+ %span= number_to_currency(adjustment.amount)
125
+ %tr
126
+ %th
127
+ %span.data-pairs__name= t('workarea.admin.orders.attributes.totals.shipping')
128
+ %td= number_to_currency @order.shipping_total
129
+ %tr
130
+ %th
131
+ %span.data-pairs__name= t('workarea.admin.orders.attributes.totals.tax')
132
+ %td= number_to_currency @order.tax_total
133
+ %tr
134
+ %th
135
+ %span.data-pairs__name= t('workarea.admin.orders.attributes.totals.total_price')
136
+ %td
137
+ %strong= number_to_currency @order.total_price
138
+ %tr
139
+ %th
140
+ %span.data-pairs__name= t('workarea.admin.orders.attributes.totals.total_value')
141
+ %td= number_to_currency @order.total_value
@@ -1,5 +1,5 @@
1
1
  module Workarea
2
2
  module GlobalE
3
- VERSION = "1.2.1"
3
+ VERSION = "1.3.0"
4
4
  end
5
5
  end
@@ -322,7 +322,7 @@ module Workarea
322
322
  "ShippingMethodStatusCode" => "0",
323
323
  "ShippingMethodStatusName" => "undefined",
324
324
  "CardNumberLastFourDigits" => "7854",
325
- "ExpirationDate" => "2023-06-30",
325
+ "ExpirationDate" => "#{next_year}-06-30",
326
326
  "TotalVATAmount" => 11.1400
327
327
  },
328
328
  "PaymentDetails" => nil,
@@ -524,7 +524,7 @@ module Workarea
524
524
  "ShippingMethodStatusCode" => "0",
525
525
  "ShippingMethodStatusName" => "undefined",
526
526
  "CardNumberLastFourDigits" => "7854",
527
- "ExpirationDate" => "2023-06-30",
527
+ "ExpirationDate" => "#{next_year}-06-30",
528
528
  "TotalVATAmount" => 11.1400
529
529
  },
530
530
  "PaymentDetails" => nil,
@@ -48,7 +48,7 @@ module Workarea
48
48
  assert_equal "Visa", payment.global_e_payment.name
49
49
  assert_equal "1", payment.global_e_payment.payment_method_code
50
50
  assert_equal "7854", payment.global_e_payment.last_four
51
- assert_equal "2023-06-30", payment.global_e_payment.expiration_date
51
+ assert_equal "#{next_year}-06-30", payment.global_e_payment.expiration_date
52
52
 
53
53
  api_events = GlobalE::OrderApiEvents.find(order.id)
54
54
  assert api_events.receive_order.present?
@@ -13,7 +13,6 @@ module Workarea
13
13
  customizations: 'gift_card',
14
14
  variants: [{ sku: 'GIFTCARD', regular: 10.to_m }]
15
15
  )
16
-
17
16
  cart = create_cart(
18
17
  items: [
19
18
  { product: product, sku: product.skus.first, quantity: 1 }
@@ -58,13 +58,12 @@ module Workarea
58
58
  order = Workarea::Order.first
59
59
  assert_equal user.id.to_s, order.user_id
60
60
 
61
- cookies.delete "user_id"
61
+ travel_to Workarea.config.customer_session_timeout.from_now do
62
+ get storefront.checkout_path
62
63
 
63
- get storefront.checkout_path
64
- assert_redirected_to storefront.ge_checkout_url
65
-
66
- order.reload
67
- assert_nil order.user_id
64
+ assert_redirected_to storefront.ge_checkout_url
65
+ assert_nil order.reload.user_id
66
+ end
68
67
  end
69
68
  end
70
69
  end
@@ -17,7 +17,7 @@ module Workarea
17
17
  name: "Visa",
18
18
  payment_method_code: "1",
19
19
  last_four: "1111",
20
- expiration_date: "2023-06-04"
20
+ expiration_date: "#{next_year}-06-04"
21
21
  }
22
22
  )
23
23
 
@@ -12,5 +12,5 @@ Gem::Specification.new do |spec|
12
12
  spec.license = "MIT"
13
13
  spec.files = `git ls-files`.split("\n")
14
14
 
15
- spec.add_dependency 'workarea', '~> 3.x', "< 3.4"
15
+ spec.add_dependency 'workarea', '~> 3.4.25'
16
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workarea-global_e
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Pigeon
@@ -16,20 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 3.x
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '3.4'
19
+ version: 3.4.25
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: 3.x
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '3.4'
26
+ version: 3.4.25
33
27
  description: Global E integration for Workarea Platform
34
28
  email:
35
29
  - epigeon@weblinc.com
@@ -92,6 +86,7 @@ files:
92
86
  - app/models/workarea/shipping.decorator
93
87
  - app/models/workarea/shipping/sku.decorator
94
88
  - app/models/workarea/user.decorator
89
+ - app/queries/workarea/order_metrics.decorator
95
90
  - app/seeds/workarea/global_e_seeds.rb
96
91
  - app/services/workarea/create_fulfillment.decorator
97
92
  - app/services/workarea/global_e/address_details.rb
@@ -139,7 +134,6 @@ files:
139
134
  - app/services/workarea/global_e/users_details.rb
140
135
  - app/services/workarea/global_e/vat_category.rb
141
136
  - app/services/workarea/global_e/vat_rate_type.rb
142
- - app/services/workarea/save_order_analytics.decorator
143
137
  - app/view_models/workarea/admin/order_view_model.decorator
144
138
  - app/view_models/workarea/storefront/cart_view_model.decorator
145
139
  - app/view_models/workarea/storefront/order_item_view_model.decorator
@@ -263,7 +257,6 @@ files:
263
257
  - test/system/workarea/storefront/global_e_order_history_system_test.rb
264
258
  - test/teaspoon_env.rb
265
259
  - test/test_helper.rb
266
- - test/view_models/workarea/admin/global_e_order_view_model_test.rb
267
260
  - test/workers/workarea/global_e/update_order_dispatch_test.rb
268
261
  - test/workers/workarea/global_e_save_user_order_details_test.rb
269
262
  - workarea-global_e.gemspec
@@ -1,22 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Workarea
4
- module Admin
5
- class GlobalEOrderViewModelTest < Workarea::TestCase
6
- def test_discount_total
7
- product = create_product
8
- order = create_order
9
-
10
- order.add_item(sku: product.skus.first, quantity: 1)
11
- order.discount_adjustments.create!(
12
- price: 'item',
13
- amount: -5.to_m
14
- )
15
-
16
- view_model = OrderViewModel.wrap(order)
17
-
18
- assert_equal(5.to_m, view_model.discount_total)
19
- end
20
- end
21
- end
22
- end