spree_vpago 2.2.2.pre.pre21 → 2.2.2.pre.pre22

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '05536639cc3731496d0e01bd7ecccb56062d2b412ca795b7a924deac49c9c9a5'
4
- data.tar.gz: f2dbe115e30add8edc1188b3c8a8ae855235d88197d45683615cb5dbe4b17445
3
+ metadata.gz: 2d70bc15b67880e1692ffb0c280621daafd28df520510b0fff216a53b7bb1710
4
+ data.tar.gz: 19d5a1cbafe2721e7cbbb3b8083e16dd459e700161f9c7e303f18373c47c956d
5
5
  SHA512:
6
- metadata.gz: 43688b89eab0f758808875722761c47b35d460c2c76501b3ff0218ea25b60d2b7859183cf4733a66704ae0f10b72b4f7bc9a75a6b1e97a1139f893c08b5cf008
7
- data.tar.gz: 5642262ac80774489724678f53fb027e09c2257dbed79ae9fa32c3cf9f806baee60315120053f97feb272779d8fda1b3497c4cdf7e0941e1c9c9dbffbd838012
6
+ metadata.gz: 8780510cf6589ccf04f91e90d4c733e362990a7c7b411a395a204aae35b465718a88b95f212f2187d615e2c44763813024dddf5435d47cb2b5f0fa8bdc809374
7
+ data.tar.gz: ba85a0bf2a52acac93d1bc278baa09fa69925f328b1110c4003dee2f51a693ad54615bcb5436724ffed34c4027608a3db24e6a257a323019a724cb1e6e9bf051
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- spree_vpago (2.2.2.pre.pre21)
4
+ spree_vpago (2.2.2.pre.pre22)
5
5
  faraday
6
6
  google-cloud-firestore
7
7
  spree_api (>= 4.5)
@@ -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 }
@@ -7,4 +7,4 @@
7
7
  onSuccess: () => window.location.replace(processingUrl),
8
8
  });
9
9
  });
10
- </script>
10
+ </script>
@@ -11,5 +11,5 @@
11
11
  </button>
12
12
  </div>
13
13
 
14
- <%= render partial: "spree/vpago_payments/forms/#{@payment.payment_method.class.to_s.underscore}" %>
15
- <%= render partial: 'spree/vpago_payments/transaction_checker' %>
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 %>
@@ -1,7 +1,7 @@
1
1
  module SpreeVpago
2
2
  module_function
3
3
 
4
- VERSION = '2.2.2-pre21'.freeze
4
+ VERSION = '2.2.2-pre22'.freeze
5
5
 
6
6
  def version
7
7
  Gem::Version.new VERSION
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.pre21
4
+ version: 2.2.2.pre.pre22
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-19 00:00:00.000000000 Z
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