spree_vpago 2.0.8.pre.beta9 → 2.0.8.pre.beta10
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/Gemfile.lock +1 -1
- data/app/models/vpago/payment_decorator.rb +0 -1
- data/app/services/vpago/payment_url_constructor.rb +0 -1
- data/app/views/spree/vpago_payments/forms/spree/gateway/_true_money.html.erb +18 -27
- data/lib/spree_vpago/version.rb +1 -1
- data/lib/vpago/true_money/base.rb +24 -4
- data/lib/vpago/true_money/checkout.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e9b3c7e80175b877d6c95d8a1ea924c6d7723214ae58394820396db3cc4049b
|
4
|
+
data.tar.gz: e1b3b31750424e444ea2c2a050cb5228b169652edffe78d895fd0e72e977abc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 931515056acc1fc08b9df674bb444cbaf2cf9e5dab443bed02f3d64830cbfa7ddb46d8739d5824bd9fc2b2a2214d3bb04b44a8ced041e45d10cd81bb53a3e80f
|
7
|
+
data.tar.gz: 64bb8a501721188459713ac1094834d3558e7afaecdb0b5384b64a7d45234e2509ac4067e21a42780f0a4a2f70433cddc6308b10e241139197dd8fcd469f5688
|
data/Gemfile.lock
CHANGED
@@ -12,7 +12,6 @@ module Vpago
|
|
12
12
|
def checkout_url = "#{base_url}/vpago_payments/checkout?#{query}&platform=app"
|
13
13
|
def web_checkout_url = "#{base_url}/vpago_payments/checkout?#{query}&platform=web"
|
14
14
|
def processing_url = "#{base_url}/vpago_payments/processing?#{query}"
|
15
|
-
def processing_deeplink_url = "#{@payment.payment_method.preferred_return_url_scheme}/vpago_payments/processing?#{query}"
|
16
15
|
def success_url = "#{base_url}/vpago_payments/success?#{query}"
|
17
16
|
def process_payment_url = "#{base_url}/vpago_payments/process_payment?#{query}"
|
18
17
|
|
@@ -4,40 +4,31 @@
|
|
4
4
|
|
5
5
|
<script>
|
6
6
|
document.addEventListener("DOMContentLoaded", () => {
|
7
|
+
const platform = "<%= params[:platform] %>";
|
8
|
+
const redirectUrl = "<%= j redirect_url %>";
|
9
|
+
const confirmButton = document.getElementById("confirm-payment-button");
|
10
|
+
const firebaseConfigs = <%= Rails.application.credentials.firebase_web_config.to_json.html_safe %>;
|
11
|
+
const docRefPath = "<%= @payment.user_informer.document_reference_path %>";
|
12
|
+
const successUrl = "<%= @payment.success_url %>";
|
13
|
+
|
14
|
+
function setupConfirmPaymentButton() {
|
15
|
+
if (platform === "app") {
|
16
|
+
if (confirmButton) confirmButton.style.display = "none";
|
17
|
+
window.open(redirectUrl, "_blank");
|
18
|
+
} else if (confirmButton) {
|
19
|
+
confirmButton.addEventListener("click", () => window.open(redirectUrl, "_blank"));
|
20
|
+
}
|
21
|
+
}
|
7
22
|
|
8
|
-
|
9
|
-
const confirmButton = document.getElementById("confirm-payment-button");
|
10
|
-
if (!confirmButton) return;
|
11
|
-
|
12
|
-
confirmButton.addEventListener("click", () => {
|
13
|
-
window.open("<%= j redirect_url %>", "_blank");
|
14
|
-
});
|
15
|
-
};
|
16
|
-
|
17
|
-
const setupPaymentProcessingListener = () => {
|
18
|
-
const firebaseConfigs = <%= Rails.application.credentials.firebase_web_config.to_json.html_safe %>;
|
19
|
-
const documentReferencePath = "<%= @payment.user_informer.document_reference_path %>";
|
20
|
-
const successUrl = "<%= @payment.success_url %>";
|
21
|
-
|
23
|
+
function setupPaymentProcessingListener() {
|
22
24
|
if (window.initPaymentProcessingListener) {
|
23
|
-
window.initPaymentProcessingListener(firebaseConfigs,
|
25
|
+
window.initPaymentProcessingListener(firebaseConfigs, docRefPath, successUrl);
|
24
26
|
} else {
|
25
27
|
console.warn("initPaymentProcessingListener is not defined");
|
26
28
|
}
|
27
|
-
}
|
29
|
+
}
|
28
30
|
|
29
31
|
setupConfirmPaymentButton();
|
30
32
|
setupPaymentProcessingListener();
|
31
|
-
|
32
33
|
});
|
33
34
|
</script>
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
data/lib/spree_vpago/version.rb
CHANGED
@@ -95,10 +95,6 @@ module Vpago
|
|
95
95
|
{}
|
96
96
|
end
|
97
97
|
|
98
|
-
def payment_method
|
99
|
-
@payment.payment_method
|
100
|
-
end
|
101
|
-
|
102
98
|
def fetch_access_token
|
103
99
|
response = Faraday.post(
|
104
100
|
access_token_url,
|
@@ -115,6 +111,30 @@ module Vpago
|
|
115
111
|
JSON.parse(response.body).fetch('access_token')
|
116
112
|
end
|
117
113
|
|
114
|
+
def return_url_scheme
|
115
|
+
payment_method.preferred_return_url_scheme
|
116
|
+
end
|
117
|
+
|
118
|
+
def return_deeplink
|
119
|
+
"#{return_url_scheme}/vpago_payments/processing?payment_number=#{external_ref_id}&order_number=#{order.number}&order_jwt_token=#{order_jwt_token}"
|
120
|
+
end
|
121
|
+
|
122
|
+
def order_jwt_token
|
123
|
+
@order_jwt_token ||= JWT.encode(jwt_payload, order.token, 'HS256')
|
124
|
+
end
|
125
|
+
|
126
|
+
def order
|
127
|
+
@payment.order
|
128
|
+
end
|
129
|
+
|
130
|
+
def jwt_payload
|
131
|
+
{ order_number: order.number, order_id: order.id }
|
132
|
+
end
|
133
|
+
|
134
|
+
def payment_method
|
135
|
+
@payment.payment_method
|
136
|
+
end
|
137
|
+
|
118
138
|
def algorithm
|
119
139
|
DEFAULT_ALGORITHM
|
120
140
|
end
|
@@ -7,7 +7,7 @@ module Vpago
|
|
7
7
|
request_body = {
|
8
8
|
payment_info: payload.to_json,
|
9
9
|
redirectionType: redirection_type,
|
10
|
-
merchantDeepLink:
|
10
|
+
merchantDeepLink: return_deeplink,
|
11
11
|
merchantAndroidPackageName: android_package_name,
|
12
12
|
refererLink: @payment.processing_url
|
13
13
|
}
|