spree_vpago 2.2.2.pre.pre21 → 2.2.2.pre.pre23
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/assets/config/spree_vpago_manifest.js +1 -1
- data/app/assets/javascripts/vpago/vpago_payments/check_transaction_periodically.js +2 -2
- data/app/controllers/spree/vpago_payments_controller.rb +1 -1
- data/app/helpers/vpago/vpago_payments_helper.rb +18 -0
- data/app/models/spree/gateway/payway_v2.rb +3 -0
- data/app/views/spree/vpago_payments/_transaction_checker.html.erb +1 -1
- data/app/views/spree/vpago_payments/checkout.html.erb +2 -2
- data/app/views/spree/vpago_payments/processing.html.erb +3 -21
- data/app/views/spree/vpago_payments/processing_scripts/spree/gateway/_payway_v2.html.erb +27 -0
- data/lib/spree_vpago/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 182dc9c63268c7b5c5704def40f386a654ef8edd8df465ca511091b8db4ae6a6
|
|
4
|
+
data.tar.gz: 8c1b3a4358cabd6e6014190de8716607bc6c4696414fd56cefaab8164820e88e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 24db9836c7b47a9c78f1f7ee7b32b4548a06fef20f62e5cafc298dd051d95ebf5ba4be5c39896227c33dc29a0d8346b8af2b74801f1e19b3793679997b852fe7
|
|
7
|
+
data.tar.gz: 93143d07f00d5db37a71724ad4c27a189a5c53c502b7d825d26605fcf89d3c2705d697fa497259198e15eba30972b7a097ee9688cb051479d8d05861bed97359
|
data/Gemfile.lock
CHANGED
|
@@ -11,9 +11,9 @@ async function checkTransactionPeriodically({
|
|
|
11
11
|
checkTransactionUrl,
|
|
12
12
|
onSuccess,
|
|
13
13
|
onFailure,
|
|
14
|
+
maxDurationMs = 10 * 60 * 1000,
|
|
15
|
+
pollIntervalMs = 5000,
|
|
14
16
|
}) {
|
|
15
|
-
var pollIntervalMs = 5000;
|
|
16
|
-
var maxDurationMs = 10 * 60 * 1000;
|
|
17
17
|
var shouldPoll = true;
|
|
18
18
|
var intervalId;
|
|
19
19
|
var startTime = Date.now();
|
|
@@ -39,7 +39,7 @@ module Spree
|
|
|
39
39
|
def check_transaction
|
|
40
40
|
@payment = Vpago::PaymentFinder.new(params.permit!.to_h).find_and_verify
|
|
41
41
|
raise ActiveRecord::RecordNotFound unless @payment.present?
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
return render json: { status: :success }, status: :ok if @payment.completed?
|
|
44
44
|
return render json: { status: :failed }, status: :ok if @payment.failed?
|
|
45
45
|
|
|
@@ -4,6 +4,24 @@ module Vpago
|
|
|
4
4
|
'firebase'
|
|
5
5
|
end
|
|
6
6
|
|
|
7
|
+
# eg. forms/spree/gateway/payway_v2
|
|
8
|
+
def render_checkout_form
|
|
9
|
+
render partial: "spree/vpago_payments/forms/#{@payment.payment_method.class.to_s.underscore}"
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def render_transaction_checker
|
|
13
|
+
render partial: 'spree/vpago_payments/transaction_checker'
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Each payment method may have their own additional processing script,
|
|
17
|
+
# so we will look for the partial based on the payment method class name.
|
|
18
|
+
#
|
|
19
|
+
# eg. processing_scripts/spree/gateway/payway_v2
|
|
20
|
+
def render_additional_processing_script(payment)
|
|
21
|
+
processing_script_partial_path = "spree/vpago_payments/processing_scripts/#{payment.payment_method.class.to_s.underscore}"
|
|
22
|
+
render partial: processing_script_partial_path if lookup_context.exists?(processing_script_partial_path, [], true)
|
|
23
|
+
end
|
|
24
|
+
|
|
7
25
|
# when return nil, each payment method should use their default URL.
|
|
8
26
|
# eg. PayWayV2 will use the continue_success_url as deeplink back URL.
|
|
9
27
|
def custom_return_deeplink_url
|
|
@@ -12,6 +12,9 @@ module Spree
|
|
|
12
12
|
preference :public_key, :text
|
|
13
13
|
preference :abapay_khqr_deeplink_option, :string, default: 'open_both'
|
|
14
14
|
|
|
15
|
+
# For reviewing purpose, not used in actual flow
|
|
16
|
+
preference :reviewing, :boolean, default: false
|
|
17
|
+
|
|
15
18
|
validates :preferred_public_key, presence: true, if: :enable_pre_auth?
|
|
16
19
|
validates :preferred_abapay_khqr_deeplink_option, inclusion: { in: ABAPAY_KHQR_DEEPLINK_OPTIONS }, if: :abapay_khqr_deeplink?
|
|
17
20
|
validates :preferred_payment_option, inclusion: { in: PAYMENT_OPTIONS }
|
|
@@ -11,5 +11,5 @@
|
|
|
11
11
|
</button>
|
|
12
12
|
</div>
|
|
13
13
|
|
|
14
|
-
<%=
|
|
15
|
-
<%=
|
|
14
|
+
<%= render_checkout_form %>
|
|
15
|
+
<%= render_transaction_checker %>
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
<p id="processing"></p>
|
|
4
4
|
<p id="reason_message"></p>
|
|
5
5
|
|
|
6
|
+
<%= render_additional_processing_script(@payment) %>
|
|
7
|
+
|
|
6
8
|
<script>
|
|
7
9
|
document.addEventListener("DOMContentLoaded", function() {
|
|
8
10
|
let firebaseConfigs = <%= Rails.application.credentials.firebase_web_config.to_json.html_safe %>;
|
|
@@ -14,29 +16,9 @@
|
|
|
14
16
|
retryDelayMs: 1000,
|
|
15
17
|
})
|
|
16
18
|
|
|
17
|
-
// This block in /processing is purely JUST for review/audit purposes (ABA requirement).
|
|
18
|
-
// It checks the bank transaction status periodically without actually
|
|
19
|
-
// triggering payment processing again. By the time the user lands
|
|
20
|
-
// on this page, the transaction is normally complete or failed.
|
|
21
|
-
//
|
|
22
|
-
// What it does:
|
|
23
|
-
// 1. Logs or updates the UI with transaction status for review.
|
|
24
|
-
// 2. Provides reassurance that the bank transaction was confirmed.
|
|
25
|
-
// 3. Optionally, could allow a manual retry button if needed.
|
|
26
|
-
//
|
|
27
|
-
// What it does NOT do:
|
|
28
|
-
// - It does NOT call requestProcessPayment again (payment job is
|
|
29
|
-
// already unique and idempotent elsewhere).
|
|
30
|
-
// - It does NOT retry processing unnecessarily.
|
|
31
|
-
window.checkTransactionPeriodically({
|
|
32
|
-
checkTransactionUrl: "<%= raw @payment.check_transaction_url %>",
|
|
33
|
-
onFailure: () => console.log("Bank transaction failed"),
|
|
34
|
-
onSuccess: () => console.log("Bank transaction confirmed"),
|
|
35
|
-
})
|
|
36
|
-
|
|
37
19
|
window.listenToProcessingState({
|
|
38
20
|
firebaseConfigs: firebaseConfigs,
|
|
39
|
-
documentReferencePath: "<%= payment.user_informer.document_reference_path %>",
|
|
21
|
+
documentReferencePath: "<%= @payment.user_informer.document_reference_path %>",
|
|
40
22
|
onPaymentIsProcessing: function (orderState, paymentState, processing, reasonCode, reasonMessage) {
|
|
41
23
|
document.getElementById("status").innerText = "Payment is processing";
|
|
42
24
|
document.getElementById("reason_code").innerText = reasonCode;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<% if @payment.payment_method.preferred_reviewing? %>
|
|
2
|
+
<script>
|
|
3
|
+
// This block in /processing is purely JUST for review/audit purposes (ABA requirement).
|
|
4
|
+
// It checks the bank transaction status periodically without actually
|
|
5
|
+
// triggering payment processing again. By the time the user lands
|
|
6
|
+
// on this page, the transaction is normally complete or failed.
|
|
7
|
+
//
|
|
8
|
+
// What it does:
|
|
9
|
+
// 1. Logs or updates the UI with transaction status for review.
|
|
10
|
+
// 2. Provides reassurance that the bank transaction was confirmed.
|
|
11
|
+
// 3. Optionally, could allow a manual retry button if needed.
|
|
12
|
+
//
|
|
13
|
+
// What it does NOT do:
|
|
14
|
+
// - It does NOT call requestProcessPayment again (payment job is
|
|
15
|
+
// already unique and idempotent elsewhere).
|
|
16
|
+
// - It does NOT retry processing unnecessarily.
|
|
17
|
+
document.addEventListener("DOMContentLoaded", function() {
|
|
18
|
+
window.checkTransactionPeriodically({
|
|
19
|
+
checkTransactionUrl: "<%= raw @payment.check_transaction_url %>",
|
|
20
|
+
onFailure: () => console.log("Bank transaction failed"),
|
|
21
|
+
onSuccess: () => console.log("Bank transaction confirmed"),
|
|
22
|
+
maxDurationMs: 5 * 60 * 1000, // 5 minutes,
|
|
23
|
+
pollIntervalMs: 5000, // 5 seconds
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
</script>
|
|
27
|
+
<% end %>
|
data/lib/spree_vpago/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spree_vpago
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.2.2.pre.
|
|
4
|
+
version: 2.2.2.pre.pre23
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- You
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-03-
|
|
11
|
+
date: 2026-03-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -336,6 +336,7 @@ files:
|
|
|
336
336
|
- app/views/spree/vpago_payments/forms/spree/gateway/_vattanac.html.erb
|
|
337
337
|
- app/views/spree/vpago_payments/forms/spree/gateway/_vattanac_mini_app.html.erb
|
|
338
338
|
- app/views/spree/vpago_payments/processing.html.erb
|
|
339
|
+
- app/views/spree/vpago_payments/processing_scripts/spree/gateway/_payway_v2.html.erb
|
|
339
340
|
- app/views/spree/vpago_payments/success.html.erb
|
|
340
341
|
- app/views/spree/wing_redirects/show.html.erb
|
|
341
342
|
- bin/rails
|