solidus_paypal_commerce_platform 0.0.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.github/stale.yml +4 -4
  3. data/.github_changelog_generator +2 -0
  4. data/.rubocop.yml +18 -5
  5. data/CHANGELOG.md +181 -0
  6. data/README.md +49 -28
  7. data/app/assets/javascripts/spree/frontend/solidus_paypal_commerce_platform/button_actions.js +14 -4
  8. data/app/assets/javascripts/spree/frontend/solidus_paypal_commerce_platform/buttons.js +6 -3
  9. data/app/controllers/solidus_paypal_commerce_platform/orders_controller.rb +8 -5
  10. data/app/controllers/solidus_paypal_commerce_platform/paypal_orders_controller.rb +3 -1
  11. data/app/decorators/models/solidus_paypal_commerce_platform/spree/address_decorator.rb +17 -0
  12. data/app/jobs/solidus_paypal_commerce_platform/webhook_job.rb +3 -3
  13. data/app/models/solidus_paypal_commerce_platform/gateway.rb +1 -2
  14. data/app/models/solidus_paypal_commerce_platform/payment_method.rb +4 -1
  15. data/app/models/solidus_paypal_commerce_platform/paypal_address.rb +27 -23
  16. data/app/models/solidus_paypal_commerce_platform/paypal_order.rb +3 -3
  17. data/app/models/solidus_paypal_commerce_platform/pricing_options.rb +1 -1
  18. data/app/models/solidus_paypal_commerce_platform/state_guesser.rb +28 -0
  19. data/bin/rails-sandbox +1 -3
  20. data/bin/sandbox +2 -2
  21. data/lib/generators/solidus_paypal_commerce_platform/install/install_generator.rb +14 -5
  22. data/lib/generators/solidus_paypal_commerce_platform/install/templates/initializer.rb +6 -0
  23. data/lib/solidus_paypal_commerce_platform.rb +7 -5
  24. data/lib/solidus_paypal_commerce_platform/client.rb +5 -4
  25. data/lib/solidus_paypal_commerce_platform/configuration.rb +14 -4
  26. data/lib/solidus_paypal_commerce_platform/{factories.rb → testing_support/factories.rb} +0 -0
  27. data/lib/solidus_paypal_commerce_platform/version.rb +1 -1
  28. data/lib/views/frontend/solidus_paypal_commerce_platform/shared/_javascript_sdk_tag.html.erb +6 -0
  29. data/lib/views/frontend/spree/checkout/payment/_paypal_commerce_platform.html.erb +6 -1
  30. data/lib/views/frontend/spree/orders/payment/_paypal_commerce_platform.html.erb +3 -2
  31. data/lib/views/frontend/spree/products/payment/_paypal_commerce_platform.html.erb +3 -2
  32. data/solidus_paypal_commerce_platform.gemspec +7 -6
  33. data/spec/features/frontend/cart_spec.rb +21 -13
  34. data/spec/features/frontend/checkout_spec.rb +21 -13
  35. data/spec/features/frontend/product_spec.rb +27 -15
  36. data/spec/lib/solidus_paypal_commerce_platform/client_spec.rb +1 -1
  37. data/spec/lib/solidus_paypal_commerce_platform/configuration_spec.rb +28 -4
  38. data/spec/models/solidus_paypal_commerce_platform/payment_method_spec.rb +19 -0
  39. data/spec/models/solidus_paypal_commerce_platform/paypal_address_spec.rb +17 -5
  40. data/spec/models/solidus_paypal_commerce_platform/state_guesser_spec.rb +38 -0
  41. data/spec/requests/solidus_paypal_commerce_platform/orders_controller_spec.rb +2 -2
  42. data/spec/requests/solidus_paypal_commerce_platform/shipping_rates_controller_spec.rb +3 -3
  43. data/spec/requests/solidus_paypal_commerce_platform/wizard_controller_spec.rb +1 -1
  44. data/spec/spec_helper.rb +10 -8
  45. data/spec/support/capybara.rb +11 -0
  46. data/spec/support/paypal_sdk_script_tag_helper.rb +13 -0
  47. metadata +46 -15
  48. data/app/decorators/solidus_paypal_commerce_platform/remove_required_phone_from_address.rb +0 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d729015bdddd523c8210fb8276c47d11a79b6a3e91ef1107a51c9ced0e9a840
4
- data.tar.gz: ed5a4f61038c0596b75ae0d6914f3a98a225b3408911bdc64eb287d5131fcde7
3
+ metadata.gz: aae67f5e5c8af750b1f887d988b383dfa5ea5f9eb4fea2e3e3560a9179b63842
4
+ data.tar.gz: 0ad40e286a533be1433f73b83c3ed012f7887c5d3eae5ffa036298a8c465930c
5
5
  SHA512:
6
- metadata.gz: 48a8ac2f5d03d0d0e32f0a5d36d53a78ea1baccc6bd4a59e09b24a6d8820d92a4e2a98e0a30fb22c5d969d5bf75a423ed7c8f3bdbbab937ecb7857e270a0778f
7
- data.tar.gz: e714276710dea1c6538cd46e475a0b689060c905ca0d3a69743e0d8236b16dc8d55b5226012ddc365fc8c0339836cc2b4e3c2662be5e77ccf357c7464c9dc7f7
6
+ metadata.gz: a773acc2923435a1765a8c7e2fa6508ef54011455fe4694df163b8a403a8446a8ee6b400c4fea8a1a0c56496db1b1e6fdbf662e83ad114076e9ea33cabe424e0
7
+ data.tar.gz: 61b973cfb34095b9913d0aded13a6510af224718c8a7094117c54e158c249b1f232e0ac3d26c116e4efadb873e3baf758f692302d12eb149822cfb8e056ea317
data/.github/stale.yml CHANGED
@@ -1,17 +1,17 @@
1
1
  # Number of days of inactivity before an issue becomes stale
2
2
  daysUntilStale: 60
3
3
  # Number of days of inactivity before a stale issue is closed
4
- daysUntilClose: 7
4
+ daysUntilClose: false
5
5
  # Issues with these labels will never be considered stale
6
6
  exemptLabels:
7
7
  - pinned
8
8
  - security
9
9
  # Label to use when marking an issue as stale
10
- staleLabel: wontfix
10
+ staleLabel: stale
11
11
  # Comment to post when marking an issue as stale. Set to `false` to disable
12
12
  markComment: >
13
13
  This issue has been automatically marked as stale because it has not had
14
- recent activity. It will be closed if no further activity occurs. Thank you
14
+ recent activity. It might be closed if no further activity occurs. Thank you
15
15
  for your contributions.
16
16
  # Comment to post when closing a stale issue. Set to `false` to disable
17
- closeComment: false
17
+ closeComment: false
@@ -0,0 +1,2 @@
1
+ issues=false
2
+ exclude-labels=infrastructure
data/.rubocop.yml CHANGED
@@ -2,20 +2,18 @@ require:
2
2
  - solidus_dev_support/rubocop
3
3
 
4
4
  AllCops:
5
+ NewCops: enable
5
6
  Exclude:
6
7
  - sandbox/**/*
7
8
  - spec/dummy/**/*
8
9
  - vendor/bundle/**/*
9
10
 
10
- Layout/IndentFirstArgument:
11
+ Layout/FirstArgumentIndentation:
11
12
  EnforcedStyle: consistent
12
13
 
13
- Layout/IndentFirstArrayElement:
14
+ Layout/FirstArrayElementIndentation:
14
15
  EnforcedStyle: consistent
15
16
 
16
- Metrics/LineLength:
17
- Max: 120
18
-
19
17
  # We use this extensively, the alternatives are not viable or desirable.
20
18
  RSpec/AnyInstance:
21
19
  Enabled: false
@@ -45,6 +43,10 @@ RSpec/VerifiedDoubles:
45
43
  # Sometimes you really need an "anything" double
46
44
  IgnoreSymbolicNames: true
47
45
 
46
+ Rspec/Naming/VariableNumber:
47
+ # PayPal uses snake_case, we use normal_case ¯\_(ツ)_/¯
48
+ Enabled: false
49
+
48
50
  Style/FrozenStringLiteralComment:
49
51
  Exclude:
50
52
  - spec/**/*
@@ -54,3 +56,14 @@ Style/FrozenStringLiteralComment:
54
56
  Security/YAMLLoad:
55
57
  Exclude:
56
58
  - spec/**/*
59
+
60
+ RSpec/MultipleMemoizedHelpers:
61
+ Exclude:
62
+ - spec/jobs/solidus_paypal_commerce_platform/webhook_job_spec.rb
63
+ - spec/models/solidus_paypal_commerce_platform/payment_method_spec.rb
64
+ - spec/models/solidus_paypal_commerce_platform/payment_source_spec.rb
65
+
66
+ Rails/Inquiry:
67
+ Enabled: true
68
+ Exclude:
69
+ - spec/lib/solidus_paypal_commerce_platform/configuration_spec.rb
data/CHANGELOG.md ADDED
@@ -0,0 +1,181 @@
1
+ # Changelog
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
+
16
+ ## [v0.2.2](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/tree/v0.2.2) (2020-11-20)
17
+
18
+ [Full Changelog](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/compare/v0.2.1...v0.2.2)
19
+
20
+ **Implemented enhancements:**
21
+
22
+ - Make the PayPal messaging component a bit more modular [\#112](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/112)
23
+ - Implement and QA Paypal credit solutions [\#99](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/99)
24
+
25
+ **Closed issues:**
26
+
27
+ - Simulated Address Info in Live Order [\#104](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/104)
28
+
29
+ **Merged pull requests:**
30
+
31
+ - Relax SolidusWebhooks dependency [\#114](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/114) ([kennyadsl](https://github.com/kennyadsl))
32
+ - Add information about paypal credit messaging to readme [\#113](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/113) ([seand7565](https://github.com/seand7565))
33
+
34
+ ## [v0.2.1](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/tree/v0.2.1) (2020-11-09)
35
+
36
+ [Full Changelog](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/compare/v0.2.0...v0.2.1)
37
+
38
+ **Closed issues:**
39
+
40
+ - There was a problem connecting with paypal. [\#107](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/107)
41
+ - Bad Request \(400\) when opening PayPal Payment Popup \(eg clicking Pay with PayPal during checkout\) [\#103](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/103)
42
+
43
+ **Merged pull requests:**
44
+
45
+ - Move and rename address decorator [\#111](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/111) ([seand7565](https://github.com/seand7565))
46
+ - Constrain solidus\_support to 0.5.1 or greater [\#110](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/110) ([seand7565](https://github.com/seand7565))
47
+ - Add currency to PayPal SDK URL [\#108](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/108) ([seand7565](https://github.com/seand7565))
48
+ - Update specs to comply with new rubocop regulations [\#106](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/106) ([seand7565](https://github.com/seand7565))
49
+ - Add address only to initial PayPal request [\#105](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/105) ([seand7565](https://github.com/seand7565))
50
+
51
+ ## [v0.2.0](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/tree/v0.2.0) (2020-10-13)
52
+
53
+ [Full Changelog](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/compare/v0.1.0...v0.2.0)
54
+
55
+ **Closed issues:**
56
+
57
+ - README lists two different types of PayPal credentials [\#97](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/97)
58
+ - `paypal\_email\_confirmed` is not an actual preference [\#96](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/96)
59
+ - Make this extension the default option for Solidus [\#88](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/88)
60
+
61
+ **Merged pull requests:**
62
+
63
+ - Add PayPal messaging component [\#102](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/102) ([seand7565](https://github.com/seand7565))
64
+ - Add partner ID attribute to SDK javascript tag [\#101](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/101) ([seand7565](https://github.com/seand7565))
65
+ - Set current\_order\_id and token during payment step [\#100](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/100) ([MFRWDesign](https://github.com/MFRWDesign))
66
+ - Remove incorrect/unclear info from README [\#98](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/98) ([seand7565](https://github.com/seand7565))
67
+ - Update the extension with the latest solidus\_dev\_support defaults [\#95](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/95) ([elia](https://github.com/elia))
68
+ - Add skip migration option to installer [\#94](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/94) ([seand7565](https://github.com/seand7565))
69
+ - Update README to reflect referral fee [\#93](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/93) ([seand7565](https://github.com/seand7565))
70
+
71
+ ## [v0.1.0](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/tree/v0.1.0) (2020-09-03)
72
+
73
+ [Full Changelog](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/compare/v0.0.1...v0.1.0)
74
+
75
+ **Merged pull requests:**
76
+
77
+ - Temporarily switch from apparition to cuprite [\#92](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/92) ([elia](https://github.com/elia))
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))
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))
80
+
81
+ ## [v0.0.1](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/tree/v0.0.1) (2020-08-10)
82
+
83
+ [Full Changelog](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/compare/11111204cc53e8bcfd365ae70506c07940446b0c...v0.0.1)
84
+
85
+ **Implemented enhancements:**
86
+
87
+ - Frontend users should be able to check out using PayPal [\#6](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/6)
88
+ - Admin users should be able to style the PayPal buttons on the payment\_method show page [\#5](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/5)
89
+ - Webhooks [\#83](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/83) ([elia](https://github.com/elia))
90
+ - Display paypal email to customer on confirmation [\#54](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/54) ([seand7565](https://github.com/seand7565))
91
+ - Use an env accessor to control live/sandbox urls and classes [\#31](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/31) ([elia](https://github.com/elia))
92
+ - Add response object to API calls to PayPal [\#30](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/30) ([seand7565](https://github.com/seand7565))
93
+
94
+ **Fixed bugs:**
95
+
96
+ - Users can check out with invalid payment [\#19](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/19)
97
+ - Have different nonce for every click of the wizard button [\#87](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/87) ([elia](https://github.com/elia))
98
+ - Correctly communicate errors when updating shipping rates [\#86](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/86) ([elia](https://github.com/elia))
99
+ - Add deface to deps [\#57](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/57) ([elia](https://github.com/elia))
100
+
101
+ **Closed issues:**
102
+
103
+ - Add something to the README about backend payments [\#75](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/75)
104
+ - Explore enabling the payment method by default [\#71](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/71)
105
+ - Explore subscribing to webhooks [\#70](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/70)
106
+ - We're using the wrong ID for paypal\_order\_id [\#69](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/69)
107
+ - Handle instrument declined errors [\#68](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/68)
108
+ - Extend lightbox during customer payment [\#63](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/63)
109
+ - Add this extension to demo store for integration team walkthrough [\#49](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/49)
110
+ - Store PayPal Debug ID [\#48](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/48)
111
+ - PayPal email address needs to be included on the confirm step [\#47](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/47)
112
+ - Digital goods should be set as not requiring shipment [\#46](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/46)
113
+ - Allow checkout on product/cart page to complete the order [\#44](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/44)
114
+ - PayPal uses different states than Solidus for some countries [\#38](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/38)
115
+ - Validate amount charged with PayPal [\#37](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/37)
116
+ - Allow order simulator to be a configurable class [\#36](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/36)
117
+ - Admin users have the option to edit payment amount [\#29](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/29)
118
+ - Add PayPal button to product page [\#27](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/27)
119
+ - Add PayPal button to cart page [\#26](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/26)
120
+ - Add `commit=false` to javascript SDK URL [\#18](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/18)
121
+ - Explore using Rails secrets to encode and decrypt PayPal client id and secret [\#17](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/17)
122
+ - Backend users should be able to checkout & admin payments [\#15](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/15)
123
+ - Change static sandbox URL and objects to dynamic [\#14](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/14)
124
+ - PayPal response address change [\#13](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/13)
125
+ - Ensure the email is verified before activating the payment method [\#9](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/9)
126
+ - Add a URL generator for the PayPal JS SDK [\#8](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/8)
127
+ - Allow users to onboard with PayPal [\#1](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/issues/1)
128
+
129
+ **Merged pull requests:**
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))
132
+ - Use live partner ids [\#85](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/85) ([elia](https://github.com/elia))
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))
134
+ - Replace order simulator with something simpler [\#82](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/82) ([seand7565](https://github.com/seand7565))
135
+ - Cleanup [\#81](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/81) ([elia](https://github.com/elia))
136
+ - Send line\_item and shipping promotions to PayPal [\#80](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/80) ([seand7565](https://github.com/seand7565))
137
+ - Change outstanding\_balance to total in order total checker [\#79](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/79) ([seand7565](https://github.com/seand7565))
138
+ - Add overlay to ease transition to confirmation page [\#78](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/78) ([seand7565](https://github.com/seand7565))
139
+ - Default available\_to\_users to true [\#77](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/77) ([seand7565](https://github.com/seand7565))
140
+ - Add info about PayPal Terminal to README [\#76](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/76) ([seand7565](https://github.com/seand7565))
141
+ - Return a payment declined error on the frontend [\#74](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/74) ([seand7565](https://github.com/seand7565))
142
+ - Only use the necessary data to let the spec pass [\#73](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/73) ([elia](https://github.com/elia))
143
+ - Display capture\_id instead of order\_id to admin user [\#72](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/72) ([seand7565](https://github.com/seand7565))
144
+ - Use options instead of preferences [\#67](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/67) ([seand7565](https://github.com/seand7565))
145
+ - Update README to reflect new preferences [\#66](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/66) ([seand7565](https://github.com/seand7565))
146
+ - Add version to cache\_key [\#65](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/65) ([seand7565](https://github.com/seand7565))
147
+ - Include payment method information in pricing options cache key [\#62](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/62) ([seand7565](https://github.com/seand7565))
148
+ - Only use available payment\_methods [\#61](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/61) ([seand7565](https://github.com/seand7565))
149
+ - Explicitly require deface [\#60](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/60) ([elia](https://github.com/elia))
150
+ - Verify email address is verified before allowing payment method to be available [\#59](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/59) ([seand7565](https://github.com/seand7565))
151
+ - Use the ORB definition of lint-code [\#58](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/58) ([elia](https://github.com/elia))
152
+ - Send amount of payment to PayPal on capture [\#56](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/56) ([seand7565](https://github.com/seand7565))
153
+ - Verify amount to charge with order total [\#55](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/55) ([seand7565](https://github.com/seand7565))
154
+ - Linting the project with rubocop [\#53](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/53) ([elia](https://github.com/elia))
155
+ - Add PayPal Debug ID to log entries [\#52](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/52) ([seand7565](https://github.com/seand7565))
156
+ - Fix PayPal request success message en.yml paths [\#51](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/51) ([seand7565](https://github.com/seand7565))
157
+ - Add configuration options to SolidusPaypalCommercePlatform [\#50](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/50) ([seand7565](https://github.com/seand7565))
158
+ - Add PayPal button to product page [\#45](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/45) ([seand7565](https://github.com/seand7565))
159
+ - Add PayPal Button To Cart Page [\#43](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/43) ([seand7565](https://github.com/seand7565))
160
+ - Add ability to change address on PayPal [\#42](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/42) ([seand7565](https://github.com/seand7565))
161
+ - Add a basic codecov config to show commit status [\#41](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/41) ([elia](https://github.com/elia))
162
+ - Add CI & Coverage badges to the readme [\#40](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/40) ([elia](https://github.com/elia))
163
+ - Rely on sdk request classes [\#39](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/39) ([elia](https://github.com/elia))
164
+ - Use "commit=false" in the JS SDK url when "confirm" step is present [\#33](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/33) ([elia](https://github.com/elia))
165
+ - Renames: Gateway → PaymentMethod / Requests → Gateway [\#32](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/32) ([elia](https://github.com/elia))
166
+ - Add PayPal Virtual Terminal notice to backend [\#25](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/25) ([seand7565](https://github.com/seand7565))
167
+ - Add missing partials necessary for backend [\#24](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/24) ([seand7565](https://github.com/seand7565))
168
+ - Add the ability to void authorized payments [\#23](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/23) ([seand7565](https://github.com/seand7565))
169
+ - Fix order controller response [\#22](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/22) ([seand7565](https://github.com/seand7565))
170
+ - Add refund ability to admin payment management [\#21](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/21) ([seand7565](https://github.com/seand7565))
171
+ - Fixes and refactoring [\#20](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/20) ([elia](https://github.com/elia))
172
+ - Add ability for admin users to customize paypal button [\#16](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/16) ([seand7565](https://github.com/seand7565))
173
+ - Restore the generic bin/rails command [\#11](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/11) ([elia](https://github.com/elia))
174
+ - Add PayPal buttons to frontend checkout flow [\#10](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/10) ([seand7565](https://github.com/seand7565))
175
+ - Update readme to reflect onboarding and wizards 🧙 [\#4](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/4) ([seand7565](https://github.com/seand7565))
176
+ - Add setup wizard for paypal commerce platform [\#3](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/3) ([seand7565](https://github.com/seand7565))
177
+ - Add paypal\_commerce\_platform as a payment method [\#2](https://github.com/solidusio-contrib/solidus_paypal_commerce_platform/pull/2) ([seand7565](https://github.com/seand7565))
178
+
179
+
180
+
181
+ \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
- # SolidusPaypalCommercePlatform
1
+ # Solidus Paypal Commerce Platform
2
2
 
3
- [![CircleCI](https://circleci.com/gh/nebulab/solidus_paypal_commerce_platform.svg?style=shield)](https://circleci.com/gh/nebulab/solidus_paypal_commerce_platform)
4
- [![codecov](https://codecov.io/gh/nebulab/solidus_paypal_commerce_platform/branch/master/graph/badge.svg)](https://codecov.io/gh/nebulab/solidus_paypal_commerce_platform)
3
+ [![CircleCI](https://circleci.com/gh/solidusio-contrib/solidus_paypal_commerce_platform.svg?style=shield)](https://circleci.com/gh/solidusio-contrib/solidus_paypal_commerce_platform)
4
+ [![codecov](https://codecov.io/gh/solidusio-contrib/solidus_paypal_commerce_platform/branch/master/graph/badge.svg)](https://codecov.io/gh/solidusio-contrib/solidus_paypal_commerce_platform)
5
5
 
6
6
  The official PayPal integration of Solidus.
7
7
 
@@ -16,8 +16,7 @@ gem 'solidus_paypal_commerce_platform'
16
16
  Bundle your dependencies and run the installation generator:
17
17
 
18
18
  ```shell
19
- bundle
20
- bundle exec rails g solidus_paypal_commerce_platform:install
19
+ bin/rails generate solidus_paypal_commerce_platform:install
21
20
  ```
22
21
 
23
22
  ### PayPal Sandbox/Live Environment
@@ -26,26 +25,6 @@ This extension will automatically select a PayPal environment based on Rails env
26
25
 
27
26
  If you want to override these values you can either set `SolidusPaypalCommercePlatform.config.env` to `"live"` or `"sandbox"` inside an initializer. Or, alternatively, you can set the `PAYPAL_ENV` environment variable to one of the same two values.
28
27
 
29
- ### Custom PartnerID & PartnerClientID
30
-
31
- You can declare your PayPal Partner-ID and Partner-Client-ID as environment
32
- variables or set their values directly on `SolidusPaypalCommercePlatform.config`
33
- or by using the configuration method detailed in the Customization section.
34
-
35
- #### Use ENV variables
36
-
37
- ```shell
38
- export PAYPAL_PARTNER_ID="xxxxxxxxxxKG2"
39
- export PAYPAL_PARTNER_CLIENT_ID="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxVSX"
40
- ```
41
-
42
- #### Set them directly
43
-
44
- ```ruby
45
- SolidusPaypalCommercePlatform.config.partner_id = "xxxxxxxxxxKG2"
46
- SolidusPaypalCommercePlatform.config.partner_client_id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxVSX"
47
- ```
48
-
49
28
  ## Address Phone Number Validation
50
29
 
51
30
  Since PayPal is being used as the checkout if the user checks out on the product or cart page, and PayPal doesn't collect phone numbers, this extension disables phone number required validation for `Spree::Address`. To turn phone number validation back on, you'll need to either:
@@ -73,7 +52,6 @@ Spree::Config.configure do |config|
73
52
  test_mode: !Rails.env.production?,
74
53
  client_id: ENV['PAYPAL_CLIENT_ID'],
75
54
  client_secret: ENV['PAYPAL_CLIENT_SECRET'],
76
- paypal_email_confirmed: true,
77
55
  display_on_product_page: true,
78
56
  display_on_cart: true,
79
57
  }
@@ -93,6 +71,10 @@ When you return to your app, your payment method should be set up and ready to g
93
71
  A confirmed email is required to get paid by PayPal. You'll need to check `Paypal Email Confirmed` on your new
94
72
  payment method before being able to select `Available To Users`.
95
73
 
74
+ ### Messaging Component
75
+
76
+ PayPal offers a messaging component that displays credit messaging to the user. You can find more information [here.](https://www.paypal.com/us/webapps/mpp/on-site-messaging) This messaging is enabled by default on all pages that use the paypal payment buttons, but can be disabled via preferences. PayPal recommends that this messaging be displayed near product or order totals, so please keep that in mind during implementation.
77
+
96
78
  ## Wizards
97
79
 
98
80
  This gem adds support for payment method wizards to be set up. Payment wizards can be used to automatically set up
@@ -110,6 +92,26 @@ end
110
92
 
111
93
  The instances of your wizard class should respond to `#name` and `#partial_name`, where `partial_name` will return the path to the partial you'd like to display on the wizard setup section. In our case, we just display a button to direct the user to PayPal.
112
94
 
95
+ ## State Guesser
96
+ PayPal users can change their shipping address directly on PayPal, which will
97
+ update their address on Solidus as well. However, in some instances, Solidus
98
+ uses the incorrect subregion level for states, which causes validation problems
99
+ with the addresses that PayPal sends to us.
100
+
101
+ For instance, if your user lives in Pescara, Italy, then PayPal will return
102
+ "Pescara" as the state. However on older version of Solidus, the region
103
+ "Abruzzo" is used, so the address will not be able to validate. To solve this
104
+ issue, we've implented a class that attempts to guess the state of the user
105
+ using Carmen subregions if the state cannot be initially found. You can, of
106
+ course, implement your own state guesser and set it like this:
107
+
108
+ ```ruby
109
+ # config/initializers/use_my_guesser.rb
110
+ SolidusPaypalCommercePlatform.configure do |config|
111
+ config.state_guesser_class = "MyApp::MyStateGuesser"
112
+ end
113
+ ```
114
+
113
115
  ## Custom Checkout Steps
114
116
 
115
117
  With product and cart page checkout, the user is directed to the checkout confirmation step when they return from PayPal. If you've removed the confirmation step, you'll need to override the `SolidusPaypalCommercePlatform.finalizeOrder` JavaScript method to instead complete the order.
@@ -152,7 +154,7 @@ the sandbox app is `./sandbox` and `bin/rails` will forward any Rails commands t
152
154
 
153
155
  Here's an example:
154
156
 
155
- ```shell
157
+ ```
156
158
  $ bin/rails server
157
159
  => Booting Puma
158
160
  => Rails 6.0.2.1 application starting in development
@@ -160,14 +162,33 @@ $ bin/rails server
160
162
  Use Ctrl-C to stop
161
163
  ```
162
164
 
165
+ ### Updating the changelog
166
+
167
+ Before and after releases the changelog should be updated to reflect the up-to-date status of
168
+ the project:
169
+
170
+ ```shell
171
+ bin/rake changelog
172
+ git add CHANGELOG.md
173
+ git commit -m "Update the changelog"
174
+ ```
175
+
163
176
  ### Releasing new versions
164
177
 
165
178
  Your new extension version can be released using `gem-release` like this:
166
179
 
167
180
  ```shell
168
- bundle exec gem bump -v VERSION --tag --push --remote upstream && gem release
181
+ bundle exec gem bump -v 1.6.0
182
+ bin/rake changelog
183
+ git commit -a --amend
184
+ git push
185
+ bundle exec gem release
169
186
  ```
170
187
 
188
+ ## Referral Fee
189
+
190
+ By using this extension, you are giving back to Solidus. PayPal will pay a fee to the maintainers ([Nebulab](https://nebulab.it)) for each order made through the payment gateway.
191
+
171
192
  ## License
172
193
 
173
194
  Copyright (c) 2020 Nebulab srls, released under the New BSD License
@@ -6,6 +6,12 @@ SolidusPaypalCommercePlatform.hideOverlay = function() {
6
6
  document.getElementById("paypal_commerce_platform_overlay").style.display = "none";
7
7
  }
8
8
 
9
+ SolidusPaypalCommercePlatform.handleError = function(error) {
10
+ console.log(error.name, error.message)
11
+ console.log("PayPal Debug ID: " + error.debug_id)
12
+ alert("There was a problem connecting with PayPal.")
13
+ }
14
+
9
15
  SolidusPaypalCommercePlatform.sendOrder = function(payment_method_id) {
10
16
  return Spree.ajax({
11
17
  url: '/solidus_paypal_commerce_platform/paypal_orders/' + Spree.current_order_id,
@@ -14,8 +20,10 @@ SolidusPaypalCommercePlatform.sendOrder = function(payment_method_id) {
14
20
  payment_method_id: payment_method_id,
15
21
  order_token: Spree.current_order_token
16
22
  }
17
- }).then(function(response) {
18
- return response.table.id;
23
+ }).then(function(success_response) {
24
+ return success_response.table.result.table.id
25
+ }, function(failure_response) {
26
+ return failure_response.responseJSON.table.error.table
19
27
  })
20
28
  }
21
29
 
@@ -97,8 +105,10 @@ SolidusPaypalCommercePlatform.shippingChange = function(data, actions) {
97
105
  actions.reject()
98
106
  }
99
107
  }).then(function(response) {
100
- actions.order.patch([response]);
101
- });
108
+ actions.order.patch([response]).catch(function() {
109
+ actions.reject()
110
+ })
111
+ })
102
112
  }
103
113
 
104
114
  SolidusPaypalCommercePlatform.verifyTotal = function(paypal_total) {
@@ -3,7 +3,8 @@ SolidusPaypalCommercePlatform.renderButton = function(payment_method_id, style)
3
3
  style: style,
4
4
  createOrder: SolidusPaypalCommercePlatform.sendOrder.bind(null, payment_method_id),
5
5
  onApprove: SolidusPaypalCommercePlatform.approveOrder,
6
- onShippingChange: SolidusPaypalCommercePlatform.shippingChange
6
+ onShippingChange: SolidusPaypalCommercePlatform.shippingChange,
7
+ onError: SolidusPaypalCommercePlatform.handleError
7
8
  }).render('#paypal-button-container')
8
9
  }
9
10
 
@@ -12,7 +13,8 @@ SolidusPaypalCommercePlatform.renderCartButton = function(payment_method_id, sty
12
13
  style: style,
13
14
  createOrder: SolidusPaypalCommercePlatform.sendOrder.bind(null, payment_method_id),
14
15
  onApprove: SolidusPaypalCommercePlatform.finalizeOrder.bind(null, payment_method_id),
15
- onShippingChange: SolidusPaypalCommercePlatform.shippingChange
16
+ onShippingChange: SolidusPaypalCommercePlatform.shippingChange,
17
+ onError: SolidusPaypalCommercePlatform.handleError
16
18
  }).render('#paypal-button-container')
17
19
  }
18
20
 
@@ -21,6 +23,7 @@ SolidusPaypalCommercePlatform.renderProductButton = function(payment_method_id,
21
23
  style: style,
22
24
  createOrder: SolidusPaypalCommercePlatform.createAndSendOrder.bind(null, payment_method_id),
23
25
  onApprove: SolidusPaypalCommercePlatform.finalizeOrder.bind(null, payment_method_id),
24
- onShippingChange: SolidusPaypalCommercePlatform.shippingChange
26
+ onShippingChange: SolidusPaypalCommercePlatform.shippingChange,
27
+ onError: SolidusPaypalCommercePlatform.handleError
25
28
  }).render('#paypal-button-container')
26
29
  }