spree_vpago 2.4.0.pre.pre2 → 2.4.0.pre.pre4
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 +2 -0
- data/app/assets/javascripts/vpago/wing_mini_app/login.js +75 -0
- data/app/assets/javascripts/vpago/wing_mini_app/web_jsbridge.bundle.js +1507 -0
- data/app/controllers/concerns/spree/mini_app_concern.rb +25 -0
- data/app/controllers/spree/admin/payment_acleda_v2_base_controller.rb +21 -0
- data/app/controllers/spree/admin/payment_acleda_v2_checkers_controller.rb +26 -0
- data/app/controllers/spree/admin/payment_acleda_v2_queriers_controller.rb +38 -0
- data/app/controllers/spree/admin/payment_payway_queriers_controller.rb +7 -0
- data/app/controllers/spree/admin/payment_vattanac_base_controller.rb +21 -0
- data/app/controllers/spree/admin/payment_vattanac_checkers_controller.rb +26 -0
- data/app/controllers/spree/admin/payment_vattanac_queriers_controller.rb +38 -0
- data/app/controllers/spree/{miniapp → mini_app}/acledas_controller.rb +12 -6
- data/app/controllers/spree/mini_app/wings_controller.rb +58 -0
- data/app/controllers/spree/vpago_payments_controller.rb +15 -3
- data/app/helpers/vpago/vpago_payments_helper.rb +6 -0
- data/app/models/spree/gateway/acleda_mini_app.rb +4 -6
- data/app/models/spree/gateway/wing_mini_app.rb +58 -0
- data/app/models/vpago/payment_decorator.rb +4 -0
- data/app/models/vpago/payment_method_decorator.rb +14 -0
- data/app/serializers/spree/v2/storefront/payment_method_serializer_decorator.rb +6 -0
- data/app/services/vpago/acleda_mini_app/session/create.rb +45 -23
- data/app/services/vpago/payment_finder.rb +11 -0
- data/app/services/vpago/wing_mini_app/session/create.rb +55 -0
- data/app/views/layouts/wing_mini_app.html.erb +20 -0
- data/app/views/spree/admin/payments/source_views/_acleda_v2.html.erb +2 -2
- data/app/views/spree/admin/payments/source_views/_vattanac.html.erb +3 -3
- data/app/views/spree/admin/payments/source_views/_wing_mini_app.html.erb +6 -0
- data/app/views/spree/mini_app/wings/show.html.erb +44 -0
- data/app/views/spree/vpago_payments/_success_script.html.erb +7 -0
- data/app/views/spree/vpago_payments/forms/spree/gateway/_acleda_mini_app.html.erb +80 -79
- data/app/views/spree/vpago_payments/forms/spree/gateway/_wing_mini_app.html.erb +88 -0
- data/app/views/spree/vpago_payments/processing_scripts/spree/gateway/_wing_mini_app.html.erb +15 -0
- data/app/views/spree/vpago_payments/success.html.erb +2 -0
- data/config/locales/en.yml +1 -0
- data/config/locales/km.yml +1 -0
- data/config/routes.rb +17 -4
- data/lib/spree_vpago/engine.rb +1 -0
- data/lib/spree_vpago/version.rb +1 -1
- data/lib/vpago/acleda_mini_app/checkout.rb +5 -9
- data/lib/vpago/acleda_mini_app/session_hash_validator.rb +35 -0
- data/lib/vpago/acleda_v2/payment_request_updater.rb +54 -0
- data/lib/vpago/http_timeouts.rb +6 -0
- data/lib/vpago/payway_v2/payment_request_updater.rb +5 -0
- data/lib/vpago/payway_v2/transaction_status.rb +2 -0
- data/lib/vpago/payway_v2/transaction_status_v2.rb +2 -0
- data/lib/vpago/true_money/base.rb +1 -1
- data/lib/vpago/true_money/transaction_status.rb +1 -1
- data/lib/vpago/vattanac/base.rb +3 -2
- data/lib/vpago/vattanac/payment_request_updater.rb +54 -0
- data/lib/vpago/vattanac/transaction_status.rb +17 -1
- data/lib/vpago/wing_mini_app/checkout.rb +60 -0
- data/lib/vpago/wing_mini_app/webhook_verifier.rb +78 -0
- metadata +27 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e6aa04b95597fa95d61728c47d6d01ae60aa9115f7c6abf841722a00470a67d8
|
|
4
|
+
data.tar.gz: f20f863945029f326146aab3bd05204c9b91b217879821838440adafe6fa1003
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d942b7ea7ceeb0de4cee4b999c9e372f4782561dbb2ff269bb3b2cc8198e136b3d8173e5448ba957f4edb400a9b5ecab5d6aa7dad962987d65d4c938715cfde6
|
|
7
|
+
data.tar.gz: 1713ce0c8712c50c50a551903f094298ba3cae5bdf5be33f5ddf894a04c513ecbe03a9725799188cd6e492f4f5849877bff22069178a6b030740a99c952e0d39
|
data/Gemfile.lock
CHANGED
|
@@ -2,3 +2,5 @@
|
|
|
2
2
|
//= link vpago/vpago_payments/check_transaction_periodically.js
|
|
3
3
|
//= link vpago/vpago_payments/request_process_payment.js
|
|
4
4
|
//= link vpago/vpago_payments/user_informers/firebase.js
|
|
5
|
+
//= link vpago/wing_mini_app/web_jsbridge.bundle.js
|
|
6
|
+
//= link vpago/wing_mini_app/login.js
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Wing Mini App login (Wing Web JS Bridge SDK spec, Native API #1 getProfile).
|
|
2
|
+
//
|
|
3
|
+
// The bridge only exists inside Wing's WebView, so this only ever runs there —
|
|
4
|
+
// getProfile() asks the host app for the signed customer profile, we hand it to
|
|
5
|
+
// our own server to verify and mint a session, then hand the browser off to the
|
|
6
|
+
// storefront on the client host.
|
|
7
|
+
(function () {
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
function showStatus(message) {
|
|
11
|
+
var status = document.getElementById('wing-mini-app-status');
|
|
12
|
+
if (status) {
|
|
13
|
+
status.textContent = message;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Any status shown via this path is a failure to sign in — stop the spinner
|
|
18
|
+
// (nothing left to wait for) and mark the text as an error rather than
|
|
19
|
+
// routine progress.
|
|
20
|
+
function showError(message) {
|
|
21
|
+
var spinner = document.getElementById('wing-mini-app-spinner');
|
|
22
|
+
if (spinner) {
|
|
23
|
+
spinner.style.display = 'none';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var status = document.getElementById('wing-mini-app-status');
|
|
27
|
+
if (status) {
|
|
28
|
+
status.classList.add('wing-mini-app-error');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
showStatus(message);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
var bridge = window.WebJSBridge && window.WebJSBridge.$bridge;
|
|
35
|
+
|
|
36
|
+
if (!bridge || !bridge.isAvailable()) {
|
|
37
|
+
showError('This page only works inside the Wing app.');
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
bridge
|
|
42
|
+
.callHandler('getProfile', {})
|
|
43
|
+
.then(function (profile) {
|
|
44
|
+
return fetch('/mini_app/wing', {
|
|
45
|
+
method: 'POST',
|
|
46
|
+
headers: {
|
|
47
|
+
'Content-Type': 'application/json'
|
|
48
|
+
},
|
|
49
|
+
body: JSON.stringify({ profile: profile })
|
|
50
|
+
});
|
|
51
|
+
})
|
|
52
|
+
.then(function (response) {
|
|
53
|
+
return response.json().then(function (data) {
|
|
54
|
+
return { ok: response.ok, data: data };
|
|
55
|
+
});
|
|
56
|
+
})
|
|
57
|
+
.then(function (result) {
|
|
58
|
+
if (!result.ok) {
|
|
59
|
+
showError(result.data.error || 'Login failed.');
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Top frame, because window.location here was found to be intercepted by iOS
|
|
64
|
+
// Universal Links / Android App Links and handed to the native BookMe+ app
|
|
65
|
+
// instead of continuing inside Wing's WebView.
|
|
66
|
+
//
|
|
67
|
+
// replace, not href: this splash has nothing to come back to, and assigning href
|
|
68
|
+
// leaves it in the back stack — the customer pressing back on the home page lands
|
|
69
|
+
// on "Signing you in..." and has to press back twice to leave the mini app.
|
|
70
|
+
window.top.location.replace(result.data.miniAppUrl);
|
|
71
|
+
})
|
|
72
|
+
.catch(function (error) {
|
|
73
|
+
showError('Error: ' + error.message);
|
|
74
|
+
});
|
|
75
|
+
})();
|