spree_vpago 2.0.8.pre.beta4 → 2.0.8.pre.beta5

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: 347bcfd7a5120dff061943a3ac91bdc64e22dca81f9bf046b028c06bd7f50521
4
- data.tar.gz: e7261ee32ab96b7e3f43e4089b88f6b7a2505674055e6d48e0da434c90b6dbf5
3
+ metadata.gz: 301cc71a3e4d2b5034d5775a0cb2a38ea99d85d81493f16de91b5e665b9df824
4
+ data.tar.gz: 41b87f4e16cacd0d4ec3fe6e662c4f9eddbf05b01f2d5a09cd30da7d0c72ff57
5
5
  SHA512:
6
- metadata.gz: 3705d3643e441c22533dd68def749c8e7569afe2f78a6a0134046674d82d60d9e8416720817d9cebc7d351b4011081b3fb284822612bf2f324b53ab6f92acf77
7
- data.tar.gz: bb38cab70179348c732fd2358086a8c3e4957f5fad20fa7a9ee18ef8abea2febcb01c9efae211882e8ad7f6fbbdc1803ec5e3d57bed923c0b1d35bdbe4f819cb
6
+ metadata.gz: 76271cbcb8ac7961c5d3cb9c1903c2d1c610e1e070cbcb25731d9eafb27d4dcd846e74c21b5612f9a1a15d08cd70181aaf5cf0945299bf9422145afc2717f4b3
7
+ data.tar.gz: 17342da573c482da7f90214c0bc3230dd52e8c61883cb48cca0524176d5b6ddb8ed5d7b43ef9ada9f84468c261e1e8122ba375c3276bdfb7229ec8776f9ad1eb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- spree_vpago (2.0.8.pre.beta4)
4
+ spree_vpago (2.0.8.pre.beta5)
5
5
  faraday
6
6
  google-cloud-firestore
7
7
  spree_api (>= 4.5)
@@ -2,32 +2,68 @@
2
2
  <% redirect_url = @checkout.generate_payment_urls(params[:platform]) %>
3
3
  <% @payment.user_informer.payment_is_processing(processing: true) %>
4
4
 
5
+ <p id="status-message" class="font-bold text-center my-4 text-primary">xcxcx</p>
6
+
5
7
  <script>
6
8
  document.addEventListener("DOMContentLoaded", () => {
7
9
 
10
+ const firebaseConfigs = <%= Rails.application.credentials.firebase_web_config.to_json.html_safe %>;
11
+
12
+ window.listenToProcessingState({
13
+ firebaseConfigs: firebaseConfigs,
14
+ documentReferencePath: "<%= @payment.user_informer.document_reference_path %>",
15
+
16
+ onPaymentIsProcessing: function (orderState, paymentState, processing, reasonCode, reasonMessage) {
17
+ updateStatusMessage("Payment is processing...");
18
+ },
19
+
20
+ onOrderIsProcessing: function (orderState, paymentState, processing, reasonCode, reasonMessage) {
21
+ updateStatusMessage("Order is processing...");
22
+ },
23
+
24
+ onOrderIsCompleted: function (orderState, paymentState, processing, reasonCode, reasonMessage) {
25
+ updateStatusMessage("Order is completed!");
26
+ },
27
+
28
+ onOrderProcessFailed: function (orderState, paymentState, processing, reasonCode, reasonMessage) {
29
+ updateStatusMessage("Order process failed: " + reasonMessage);
30
+ },
31
+
32
+ onPaymentIsRefunded: function (orderState, paymentState, processing, reasonCode, reasonMessage) {
33
+ updateStatusMessage("Payment has been refunded.");
34
+ },
35
+
36
+ onPaymentProcessFailed: function (orderState, paymentState, processing, reasonCode, reasonMessage) {
37
+ updateStatusMessage("Payment process failed: " + reasonMessage);
38
+ },
39
+
40
+ onCompleted: function (orderState, paymentState, processing, reasonCode, reasonMessage) {
41
+ updateStatusMessage("Completed — redirecting...");
42
+ let successPath = "<%= @payment.success_url %>";
43
+ window.location.href = successPath;
44
+ },
45
+ });
46
+
47
+ const statusMessageElement = document.getElementById("status-message");
48
+
49
+ function updateStatusMessage(message) {
50
+ if (statusMessageElement) {
51
+ statusMessageElement.textContent = message;
52
+ }
53
+ }
54
+
8
55
  const setupConfirmPaymentButton = () => {
9
56
  const confirmButton = document.getElementById("confirm-payment-button");
10
57
  if (!confirmButton) return;
11
58
 
12
59
  confirmButton.addEventListener("click", () => {
13
60
  window.open("<%= j redirect_url %>", "_blank");
61
+ updateStatusMessage("Redirected to payment gateway...");
14
62
  });
15
63
  };
16
64
 
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 %>";
65
+ setupConfirmPaymentButton();
21
66
 
22
- if (window.initPaymentProcessingListener) {
23
- window.initPaymentProcessingListener(firebaseConfigs, documentReferencePath, successUrl);
24
- } else {
25
- console.warn("initPaymentProcessingListener is not defined");
26
- }
27
- };
28
67
 
29
- setupConfirmPaymentButton();
30
- setupPaymentProcessingListener();
31
-
32
68
  });
33
69
  </script>
@@ -1,7 +1,7 @@
1
1
  module SpreeVpago
2
2
  module_function
3
3
 
4
- VERSION = '2.0.8-beta4'.freeze
4
+ VERSION = '2.0.8-beta5'.freeze
5
5
 
6
6
  def version
7
7
  Gem::Version.new VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_vpago
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.8.pre.beta4
4
+ version: 2.0.8.pre.beta5
5
5
  platform: ruby
6
6
  authors:
7
7
  - You