solidus_bolt 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f450560bb140e6c7a301138a192a5c8a96016500980580de6866eb1ed79a061d
4
- data.tar.gz: 84ace4cc0e18e06ddb78b72ff4d06460c1bc0eeed5f7ad1beb1c53e0791a8a8f
3
+ metadata.gz: e25dd3c40e487372056178b18ffae03f5cddbd5b56756cf32874a7e0f761a5ac
4
+ data.tar.gz: 74bfbc7db9a0b6b9b47f501cbd67d6c141a9164549266eb99114a3de5a4de840
5
5
  SHA512:
6
- metadata.gz: c2be760b6012c698408e74d73a5b312cd3b9117f8defee100ac4f4234fa404efcff9d8553fa42170764772d2a334162ac7a30a0f3a2d4dbeb8544f29ea354547
7
- data.tar.gz: 171b51d8f32782f81c7d50871161f8a731ccdc308cc9485c21efdb14a03248a8112f27db93cf2a4bebc69a3af2c75aa6389297242c4c00b4dfd2001a9db6b26b
6
+ metadata.gz: 6df41aae33da5dc6d3c070507fe0c7a19410ece8ffabfef114f8dca23a387b5f3cdadb0317ef1121051d95807b08717782db0e802290668e277f7ae492f4464e
7
+ data.tar.gz: 840b8836eaf726ab402b807bed737d536c14adaac70d24d0bba4a030afd58d8677d715ae54ddcd8a2167f3ab4a829a39dcf49e7aefb028064bfd8f539722c49a
@@ -31,6 +31,11 @@ const redirectToNextStep = (frontend) => {
31
31
  }
32
32
  }
33
33
 
34
+ async function getResponseText(response) {
35
+ const text = await response.text();
36
+ return text;
37
+ }
38
+
34
39
  const updateOrder = async (card, paymentMethodId, frontend) => {
35
40
  await fetch(`/api/checkouts/${Spree.current_order_id}`, {
36
41
  method: 'PATCH',
@@ -39,6 +44,7 @@ const updateOrder = async (card, paymentMethodId, frontend) => {
39
44
  'X-Spree-Order-Token': Spree.current_order_token
40
45
  },
41
46
  body: JSON.stringify({
47
+ 'state': 'payment',
42
48
  'order': {
43
49
  'payments_attributes': [{
44
50
  'payment_method_id': paymentMethodId,
@@ -55,8 +61,14 @@ const updateOrder = async (card, paymentMethodId, frontend) => {
55
61
  }
56
62
  })
57
63
  })
58
- .then(() => {
59
- redirectToNextStep(frontend)
64
+ .then((response) => {
65
+ if(response.ok) {
66
+ redirectToNextStep(frontend)
67
+ } else {
68
+ getResponseText(response).then(text => {
69
+ console.error(text);
70
+ });
71
+ }
60
72
  })
61
73
  .catch((response) => {
62
74
  console.log('Error updating order')
@@ -5,6 +5,7 @@ module SolidusBolt
5
5
  def bolt_cart
6
6
  {
7
7
  total_amount: display_total.cents,
8
+ tax_amount: display_tax_total.cents,
8
9
  order_reference: number,
9
10
  currency: currency,
10
11
  shipments: bolt_shipments_payload,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusBolt
4
- VERSION = '0.3.0'
4
+ VERSION = '0.4.0'
5
5
  end
data/solidus_bolt.gemspec CHANGED
@@ -34,7 +34,6 @@ Gem::Specification.new do |spec|
34
34
  spec.add_dependency 'multi_json'
35
35
  spec.add_dependency 'omniauth-bolt'
36
36
  spec.add_dependency 'rails'
37
- spec.add_dependency 'solidus_auth_devise'
38
37
  spec.add_dependency 'solidus_core', ['>= 2.0.0', '< 4']
39
38
  spec.add_dependency 'solidus_social'
40
39
  spec.add_dependency 'solidus_support', '~> 0.5'
@@ -7,6 +7,7 @@ RSpec.describe SolidusBolt::OrderDecorator do
7
7
  it 'returns a hash with line items and price' do
8
8
  result = {
9
9
  total_amount: (order.total * 100).to_i,
10
+ tax_amount: (order.tax_total * 100).to_i,
10
11
  order_reference: order.number,
11
12
  currency: 'USD',
12
13
  shipments: array_including(hash_including(:reference)),
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_bolt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - piyushswain
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2022-07-25 00:00:00.000000000 Z
13
+ date: 2022-07-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: coffee-rails
@@ -96,20 +96,6 @@ dependencies:
96
96
  - - ">="
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
- - !ruby/object:Gem::Dependency
100
- name: solidus_auth_devise
101
- requirement: !ruby/object:Gem::Requirement
102
- requirements:
103
- - - ">="
104
- - !ruby/object:Gem::Version
105
- version: '0'
106
- type: :runtime
107
- prerelease: false
108
- version_requirements: !ruby/object:Gem::Requirement
109
- requirements:
110
- - - ">="
111
- - !ruby/object:Gem::Version
112
- version: '0'
113
99
  - !ruby/object:Gem::Dependency
114
100
  name: solidus_core
115
101
  requirement: !ruby/object:Gem::Requirement