spree-paypal_platform 5.1.2 → 5.1.4
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 +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +2 -2
- data/app/models/spree/paypal_platform/gateway/payment_sessions.rb +7 -2
- data/app/models/spree/paypal_platform/gateway.rb +16 -1
- data/app/serializers/spree/api/v3/payment_method_serializer_decorator.rb +20 -0
- data/app/views/spree/admin/payment_methods/configuration_guides/_spree_paypal_platform.html.erb +2 -1
- data/lib/spree/paypal_platform/factories.rb +2 -1
- data/lib/spree/paypal_platform/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 10754110031d42b6574e51b4eef1c1cb1adcc5a0d09b7c203d8620eae06acae8
|
|
4
|
+
data.tar.gz: e7d3ea6129314c8cf7d2083370a8997bdd09aa655cfd826d96145378a60865ae
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0e97ad651a97eba76344f666a171ad211583608a8ce307ca80fd507f5452e6a07ca2e81f04af9f4fce14594a5c507d1e95facce00eb0d334d7ea34c5b499ba2c
|
|
7
|
+
data.tar.gz: 001c8dec98b5eed5f48c20cc398b453daeaca65829b81d49bb7aa40cc33b3b6ab06beeadf2c77b6ab2dd71612216f9f877dde3d8ed3723edec956fd3d5b4a2d9
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.1.4
|
|
4
|
+
|
|
5
|
+
- `enable_card_fields` preference (checkbox, default on).
|
|
6
|
+
- Storefront sees `enable_apple_pay` and `enable_card_fields` on the payment
|
|
7
|
+
method (`public_preferences`) and on the payment session `external_data`.
|
|
8
|
+
- Client token is not requested when Card Fields are disabled.
|
|
9
|
+
|
|
10
|
+
## 5.1.3
|
|
11
|
+
|
|
12
|
+
Remove the unused `apple_pay_domain` preference. Domain registration is
|
|
13
|
+
in the PayPal dashboard, not this field.
|
|
14
|
+
|
|
3
15
|
## 5.1.2
|
|
4
16
|
|
|
5
17
|
- Completing a session GETs the PayPal order first and skips capture when
|
data/README.md
CHANGED
|
@@ -48,8 +48,8 @@ Then add a **PayPal** payment method in admin and set:
|
|
|
48
48
|
| `client_id` / `client_secret` | REST app credentials from the PayPal Developer Dashboard |
|
|
49
49
|
| `webhook_secret` | PayPal webhook ID (used as the verify-webhook `webhook_id`) |
|
|
50
50
|
| `test_mode` | Sandbox vs live |
|
|
51
|
-
| `enable_apple_pay` |
|
|
52
|
-
| `
|
|
51
|
+
| `enable_apple_pay` | Offer Apple Pay on the storefront (default on) |
|
|
52
|
+
| `enable_card_fields` | Offer Card Fields on the storefront (default on) |
|
|
53
53
|
|
|
54
54
|
Webhook URL is the standard Spree v3 payments webhook:
|
|
55
55
|
|
|
@@ -47,8 +47,13 @@ module Spree
|
|
|
47
47
|
|
|
48
48
|
session_data = paypal_response.data.as_json
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
session_data['
|
|
50
|
+
session_data['enable_apple_pay'] = apple_pay_enabled?
|
|
51
|
+
session_data['enable_card_fields'] = card_fields_enabled?
|
|
52
|
+
|
|
53
|
+
if card_fields_enabled?
|
|
54
|
+
client_token = generate_client_token
|
|
55
|
+
session_data['client_token'] = client_token if client_token.present?
|
|
56
|
+
end
|
|
52
57
|
|
|
53
58
|
payment_session_class.create!(
|
|
54
59
|
order: order,
|
|
@@ -23,7 +23,7 @@ module Spree
|
|
|
23
23
|
preference :webhook_secret, :string
|
|
24
24
|
preference :test_mode, :boolean, default: true
|
|
25
25
|
preference :enable_apple_pay, :boolean, default: true
|
|
26
|
-
preference :
|
|
26
|
+
preference :enable_card_fields, :boolean, default: true
|
|
27
27
|
|
|
28
28
|
validates :preferred_client_id, :preferred_client_secret, presence: true
|
|
29
29
|
|
|
@@ -106,6 +106,15 @@ module Spree
|
|
|
106
106
|
preferred_enable_apple_pay
|
|
107
107
|
end
|
|
108
108
|
|
|
109
|
+
##
|
|
110
|
+
# Whether the storefront should offer Card Fields for this method.
|
|
111
|
+
#
|
|
112
|
+
# @return [TrueClass, FalseClass]
|
|
113
|
+
#
|
|
114
|
+
def card_fields_enabled?
|
|
115
|
+
preferred_enable_card_fields
|
|
116
|
+
end
|
|
117
|
+
|
|
109
118
|
##
|
|
110
119
|
# @return [String, NilClass]
|
|
111
120
|
#
|
|
@@ -280,6 +289,12 @@ module Spree
|
|
|
280
289
|
end
|
|
281
290
|
end
|
|
282
291
|
|
|
292
|
+
protected
|
|
293
|
+
|
|
294
|
+
def public_preference_keys
|
|
295
|
+
%i[enable_apple_pay enable_card_fields]
|
|
296
|
+
end
|
|
297
|
+
|
|
283
298
|
private
|
|
284
299
|
|
|
285
300
|
def find_order(order_id)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Spree
|
|
4
|
+
module Api
|
|
5
|
+
module V3
|
|
6
|
+
##
|
|
7
|
+
# Exposes non-secret payment-method preferences to the storefront.
|
|
8
|
+
#
|
|
9
|
+
module PaymentMethodSerializerDecorator
|
|
10
|
+
def self.prepended(base)
|
|
11
|
+
base.attribute :public_preferences, &:public_preferences
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
Spree::Api::V3::PaymentMethodSerializer.prepend(
|
|
19
|
+
Spree::Api::V3::PaymentMethodSerializerDecorator
|
|
20
|
+
)
|
data/app/views/spree/admin/payment_methods/configuration_guides/_spree_paypal_platform.html.erb
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
<strong>Apple Pay</strong> is a funding source of this same PayPal method, not a second payment method.
|
|
12
12
|
Register every storefront domain that will show the Apple Pay button in the
|
|
13
13
|
<%= external_link_to 'PayPal Apple Pay domain registration', 'https://developer.paypal.com/docs/checkout/apm/apple-pay/', class: 'alert-link' %>
|
|
14
|
-
dashboard
|
|
14
|
+
dashboard. Use the checkboxes below to offer Card Fields and Apple Pay
|
|
15
|
+
on the storefront. The Apple Pay button only renders in Safari over HTTPS.
|
|
15
16
|
</p>
|
|
16
17
|
</div>
|
|
@@ -9,7 +9,8 @@ FactoryBot.define do
|
|
|
9
9
|
client_id: ENV.fetch('PAYPAL_CLIENT_ID', 'client_id_test'),
|
|
10
10
|
client_secret: ENV.fetch('PAYPAL_CLIENT_SECRET', 'client_secret_test'),
|
|
11
11
|
test_mode: true,
|
|
12
|
-
enable_apple_pay: true
|
|
12
|
+
enable_apple_pay: true,
|
|
13
|
+
enable_card_fields: true
|
|
13
14
|
}
|
|
14
15
|
end
|
|
15
16
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spree-paypal_platform
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.1.
|
|
4
|
+
version: 5.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Aypex
|
|
@@ -131,6 +131,7 @@ files:
|
|
|
131
131
|
- app/models/spree/paypal_platform/payment_sources/paypal.rb
|
|
132
132
|
- app/models/spree/paypal_platform/store_decorator.rb
|
|
133
133
|
- app/presenters/spree/paypal_platform/order_presenter.rb
|
|
134
|
+
- app/serializers/spree/api/v3/payment_method_serializer_decorator.rb
|
|
134
135
|
- app/services/spree/paypal_platform/capture_order.rb
|
|
135
136
|
- app/services/spree/paypal_platform/create_payment.rb
|
|
136
137
|
- app/services/spree/paypal_platform/create_source.rb
|