solidus_paypal_commerce_platform 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/CHANGELOG.md +18 -2
- data/app/models/solidus_paypal_commerce_platform/paypal_address.rb +19 -20
- data/lib/solidus_paypal_commerce_platform/version.rb +1 -1
- data/solidus_paypal_commerce_platform.gemspec +1 -1
- data/spec/models/solidus_paypal_commerce_platform/paypal_address_spec.rb +17 -5
- data/spec/requests/solidus_paypal_commerce_platform/orders_controller_spec.rb +2 -2
- data/spec/requests/solidus_paypal_commerce_platform/wizard_controller_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aae67f5e5c8af750b1f887d988b383dfa5ea5f9eb4fea2e3e3560a9179b63842
|
4
|
+
data.tar.gz: 0ad40e286a533be1433f73b83c3ed012f7887c5d3eae5ffa036298a8c465930c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a773acc2923435a1765a8c7e2fa6508ef54011455fe4694df163b8a403a8446a8ee6b400c4fea8a1a0c56496db1b1e6fdbf662e83ad114076e9ea33cabe424e0
|
7
|
+
data.tar.gz: 61b973cfb34095b9913d0aded13a6510af224718c8a7094117c54e158c249b1f232e0ac3d26c116e4efadb873e3baf758f692302d12eb149822cfb8e056ea317
|
data/.rubocop.yml
CHANGED
@@ -43,6 +43,10 @@ RSpec/VerifiedDoubles:
|
|
43
43
|
# Sometimes you really need an "anything" double
|
44
44
|
IgnoreSymbolicNames: true
|
45
45
|
|
46
|
+
Rspec/Naming/VariableNumber:
|
47
|
+
# PayPal uses snake_case, we use normal_case ¯\_(ツ)_/¯
|
48
|
+
Enabled: false
|
49
|
+
|
46
50
|
Style/FrozenStringLiteralComment:
|
47
51
|
Exclude:
|
48
52
|
- spec/**/*
|
data/CHANGELOG.md
CHANGED
@@ -1,13 +1,29 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v0.3.0](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/tree/v0.3.0) (2021-03-16)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/compare/v0.2.2...v0.3.0)
|
6
|
+
|
7
|
+
**Closed issues:**
|
8
|
+
|
9
|
+
- Prepare Solidus Paypal Commerce Platform for Solidus 3.0 [\#115](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/115)
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- Use new factories loading method [\#118](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/118) ([kennyadsl](https://github.com/kennyadsl))
|
14
|
+
- Update extension for Solidus 3.0 [\#117](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/117) ([seand7565](https://github.com/seand7565))
|
15
|
+
|
3
16
|
## [v0.2.2](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/tree/v0.2.2) (2020-11-20)
|
4
17
|
|
5
18
|
[Full Changelog](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/compare/v0.2.1...v0.2.2)
|
6
19
|
|
7
|
-
**
|
20
|
+
**Implemented enhancements:**
|
8
21
|
|
9
22
|
- Make the PayPal messaging component a bit more modular [\#112](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/112)
|
10
23
|
- Implement and QA Paypal credit solutions [\#99](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/99)
|
24
|
+
|
25
|
+
**Closed issues:**
|
26
|
+
|
11
27
|
- Simulated Address Info in Live Order [\#104](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/104)
|
12
28
|
|
13
29
|
**Merged pull requests:**
|
@@ -59,7 +75,6 @@
|
|
59
75
|
**Merged pull requests:**
|
60
76
|
|
61
77
|
- Temporarily switch from apparition to cuprite [\#92](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/92) ([elia](https://github.com/elia))
|
62
|
-
- Update links after moving the repo to solidusio-contrib [\#91](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/91) ([elia](https://github.com/elia))
|
63
78
|
- Add a configurable state\_guesser class to guess states [\#90](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/90) ([seand7565](https://github.com/seand7565))
|
64
79
|
- Add better error handling to button\_actions.js [\#89](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/89) ([seand7565](https://github.com/seand7565))
|
65
80
|
|
@@ -113,6 +128,7 @@
|
|
113
128
|
|
114
129
|
**Merged pull requests:**
|
115
130
|
|
131
|
+
- Update links after moving the repo to solidusio-contrib [\#91](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/91) ([elia](https://github.com/elia))
|
116
132
|
- Use live partner ids [\#85](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/85) ([elia](https://github.com/elia))
|
117
133
|
- Update README to account for checkouts without a confirmation step [\#84](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/84) ([seand7565](https://github.com/seand7565))
|
118
134
|
- Replace order simulator with something simpler [\#82](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/82) ([seand7565](https://github.com/seand7565))
|
@@ -19,7 +19,7 @@ module SolidusPaypalCommercePlatform
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def update(paypal_address)
|
22
|
-
formatted_address =
|
22
|
+
formatted_address = address_attributes(paypal_address[:updated_address], paypal_address[:recipient])
|
23
23
|
new_address = @order.ship_address.dup || ::Spree::Address.new
|
24
24
|
new_address.assign_attributes(formatted_address)
|
25
25
|
|
@@ -51,36 +51,35 @@ module SolidusPaypalCommercePlatform
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def format_simulated_address(paypal_address)
|
54
|
-
|
55
|
-
|
54
|
+
# Adds fake information for a few fields, so validations can run
|
55
|
+
paypal_address[:address_line_1] = "123 Fake St."
|
56
|
+
|
56
57
|
::Spree::Address.new(
|
57
|
-
|
58
|
-
state: find_state(paypal_address[:state], country),
|
59
|
-
state_name: paypal_address[:state],
|
60
|
-
zipcode: paypal_address[:postal_code],
|
61
|
-
country: country,
|
62
|
-
address1: "123 Fake St.",
|
63
|
-
phone: "123456789",
|
64
|
-
firstname: "Fake"
|
58
|
+
address_attributes(paypal_address, { name: { given_name: "Fake" } })
|
65
59
|
)
|
66
60
|
end
|
67
61
|
|
68
|
-
def
|
69
|
-
address = paypal_address[:updated_address]
|
70
|
-
recipient = paypal_address[:recipient]
|
62
|
+
def address_attributes(address, recipient)
|
71
63
|
country = ::Spree::Country.find_by(iso: address[:country_code])
|
72
64
|
|
73
|
-
{
|
65
|
+
attributes = {
|
74
66
|
address1: address[:address_line_1],
|
75
67
|
address2: address[:address_line_2],
|
76
|
-
state: find_state(address[:admin_area_1], country),
|
77
|
-
state_name: address[:admin_area_1],
|
78
|
-
city: address[:admin_area_2],
|
68
|
+
state: find_state(address[:admin_area_1] || address[:state], country),
|
69
|
+
state_name: address[:admin_area_1] || address[:state],
|
70
|
+
city: address[:admin_area_2] || address[:city],
|
79
71
|
country: country,
|
80
72
|
zipcode: address[:postal_code],
|
81
|
-
firstname: recipient[:name][:given_name],
|
82
|
-
lastname: recipient[:name][:surname]
|
83
73
|
}
|
74
|
+
|
75
|
+
if SolidusSupport.combined_first_and_last_name_in_address?
|
76
|
+
attributes[:name] = "#{recipient[:name][:given_name]} #{recipient[:name][:surname]}"
|
77
|
+
else
|
78
|
+
attributes[:firstname] = recipient[:name][:given_name]
|
79
|
+
attributes[:lastname] = recipient[:name][:surname]
|
80
|
+
end
|
81
|
+
|
82
|
+
attributes
|
84
83
|
end
|
85
84
|
end
|
86
85
|
end
|
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
|
31
31
|
spec.add_dependency 'deface', '~> 1.5'
|
32
32
|
spec.add_dependency 'solidus_core', ['>= 2.0.0', '< 3']
|
33
|
-
spec.add_dependency 'solidus_support', [">= 0.
|
33
|
+
spec.add_dependency 'solidus_support', [">= 0.8.0", "< 1"]
|
34
34
|
spec.add_dependency 'solidus_webhooks', '~> 0.2'
|
35
35
|
|
36
36
|
spec.add_dependency 'paypal-checkout-sdk'
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
RSpec.describe SolidusPaypalCommercePlatform::PaypalAddress, type: :model do
|
4
4
|
let(:order) { create(:order) }
|
5
5
|
let(:original_address) { create(:address) }
|
6
|
-
let(:address) { create(:address) }
|
6
|
+
let(:address) { create(:address, name_attributes) }
|
7
7
|
let(:params) {
|
8
8
|
{
|
9
9
|
updated_address: {
|
@@ -16,8 +16,8 @@ RSpec.describe SolidusPaypalCommercePlatform::PaypalAddress, type: :model do
|
|
16
16
|
},
|
17
17
|
recipient: {
|
18
18
|
name: {
|
19
|
-
given_name:
|
20
|
-
surname:
|
19
|
+
given_name: "Alexander",
|
20
|
+
surname: "Hamilton"
|
21
21
|
}
|
22
22
|
}
|
23
23
|
}
|
@@ -37,8 +37,12 @@ RSpec.describe SolidusPaypalCommercePlatform::PaypalAddress, type: :model do
|
|
37
37
|
expect(subject.address2).to eq address.address2
|
38
38
|
expect(subject.zipcode).to eq address.zipcode
|
39
39
|
expect(subject.country).to eq address.country
|
40
|
-
|
41
|
-
|
40
|
+
if SolidusSupport.combined_first_and_last_name_in_address?
|
41
|
+
expect(subject.name).to eq address.name
|
42
|
+
else
|
43
|
+
expect(subject.firstname).to eq address.firstname
|
44
|
+
expect(subject.lastname).to eq address.lastname
|
45
|
+
end
|
42
46
|
expect(subject.phone).to eq original_address.phone
|
43
47
|
end
|
44
48
|
|
@@ -52,4 +56,12 @@ RSpec.describe SolidusPaypalCommercePlatform::PaypalAddress, type: :model do
|
|
52
56
|
end
|
53
57
|
end
|
54
58
|
end
|
59
|
+
|
60
|
+
def name_attributes
|
61
|
+
if SolidusSupport.combined_first_and_last_name_in_address?
|
62
|
+
{ name: "Alexander Hamilton" }
|
63
|
+
else
|
64
|
+
{ firstname: "Alexander", lastname: "Hamilton" }
|
65
|
+
end
|
66
|
+
end
|
55
67
|
end
|
@@ -15,7 +15,7 @@ RSpec.describe SolidusPaypalCommercePlatform::OrdersController, type: :request d
|
|
15
15
|
|
16
16
|
get solidus_paypal_commerce_platform.verify_total_path, params: params
|
17
17
|
|
18
|
-
expect(response).to have_http_status(
|
18
|
+
expect(response).to have_http_status(:ok)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -29,7 +29,7 @@ RSpec.describe SolidusPaypalCommercePlatform::OrdersController, type: :request d
|
|
29
29
|
|
30
30
|
get solidus_paypal_commerce_platform.verify_total_path, params: params
|
31
31
|
|
32
|
-
expect(response).to have_http_status(
|
32
|
+
expect(response).to have_http_status(:bad_request)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
@@ -38,7 +38,7 @@ RSpec.describe SolidusPaypalCommercePlatform::WizardController, type: :request d
|
|
38
38
|
|
39
39
|
expect(payment_method.preferred_client_id).to eq("CLIENT-ID")
|
40
40
|
expect(payment_method.preferred_client_secret).to eq("CLIENT-SECRET")
|
41
|
-
expect(response).to have_http_status(
|
41
|
+
expect(response).to have_http_status(:created)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -20,7 +20,7 @@ require 'spree/testing_support/order_walkthrough'
|
|
20
20
|
Dir["#{__dir__}/support/**/*.rb"].sort.each { |f| require f }
|
21
21
|
|
22
22
|
# Requires factories defined in lib/solidus_paypal_commerce_platform/testing_support/factories.rb
|
23
|
-
|
23
|
+
SolidusDevSupport::TestingSupport::Factories.load_for(SolidusPaypalCommercePlatform::Engine)
|
24
24
|
|
25
25
|
RSpec.configure do |config|
|
26
26
|
config.infer_spec_type_from_file_location!
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_paypal_commerce_platform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Denny
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-03-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: deface
|
@@ -51,7 +51,7 @@ dependencies:
|
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.8.0
|
55
55
|
- - "<"
|
56
56
|
- !ruby/object:Gem::Version
|
57
57
|
version: '1'
|
@@ -61,7 +61,7 @@ dependencies:
|
|
61
61
|
requirements:
|
62
62
|
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version: 0.
|
64
|
+
version: 0.8.0
|
65
65
|
- - "<"
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '1'
|