spree_vpago 2.4.0.pre.pre3 → 2.4.0

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.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +26 -27
  3. data/app/assets/config/spree_vpago_manifest.js +2 -0
  4. data/app/assets/javascripts/vpago/wing_mini_app/login.js +75 -0
  5. data/app/assets/javascripts/vpago/wing_mini_app/web_jsbridge.bundle.js +1507 -0
  6. data/app/controllers/concerns/spree/mini_app_concern.rb +25 -0
  7. data/app/controllers/spree/mini_app/acledas_controller.rb +35 -0
  8. data/app/controllers/spree/mini_app/wings_controller.rb +58 -0
  9. data/app/models/spree/gateway/acleda_mini_app.rb +18 -0
  10. data/app/models/spree/gateway/wing_mini_app.rb +58 -0
  11. data/app/models/vpago/payment_decorator.rb +8 -0
  12. data/app/models/vpago/payment_method_decorator.rb +12 -0
  13. data/app/services/vpago/acleda_mini_app/session/create.rb +121 -0
  14. data/app/services/vpago/payment_finder.rb +11 -0
  15. data/app/services/vpago/wing_mini_app/session/create.rb +55 -0
  16. data/app/views/layouts/wing_mini_app.html.erb +20 -0
  17. data/app/views/spree/admin/payments/source_views/_acleda_mini_app.html.erb +6 -0
  18. data/app/views/spree/admin/payments/source_views/_wing_mini_app.html.erb +6 -0
  19. data/app/views/spree/mini_app/wings/show.html.erb +44 -0
  20. data/app/views/spree/vpago_payments/forms/spree/gateway/_acleda_mini_app.html.erb +94 -0
  21. data/app/views/spree/vpago_payments/forms/spree/gateway/_wing_mini_app.html.erb +88 -0
  22. data/app/views/spree/vpago_payments/processing_scripts/spree/gateway/_wing_mini_app.html.erb +15 -0
  23. data/config/routes.rb +14 -0
  24. data/lib/spree_vpago/engine.rb +2 -0
  25. data/lib/spree_vpago/version.rb +1 -1
  26. data/lib/vpago/acleda_mini_app/checkout.rb +19 -0
  27. data/lib/vpago/acleda_mini_app/session_hash_validator.rb +35 -0
  28. data/lib/vpago/wing_mini_app/checkout.rb +60 -0
  29. data/lib/vpago/wing_mini_app/webhook_verifier.rb +78 -0
  30. data/spree_vpago.gemspec +1 -1
  31. metadata +28 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e361db28503471424737c1633bb7e5fcacccdc7c1a63faddd76ad3e226ceb6f7
4
- data.tar.gz: cd5936a07fdfcfb314ac0d068d88b0e6137e6f5cb7e37295aa034368bcea33af
3
+ metadata.gz: 7aa825362489c4aa80a262b6ffc92526b22edaf1d6668e12515ca5c182a397b6
4
+ data.tar.gz: 56a3a03b73b2b6c3f623f2a1ca237531f69238841f971bc60923e0d978f05213
5
5
  SHA512:
6
- metadata.gz: e5691409e7f910c70fd1012358eafc766b45131e4db286106f5a58a8390c0f7bb2ad1fbba892805a6f7ab3b4ec75bb77f8df1e76ccde90f153efadc6e835bed0
7
- data.tar.gz: 874db861928b7f5cd71ccd9d17172057de242748f2cc0c11735b03a49951c80151d02cde118ee4ea21961209113529bb1e89562c9e6e8e843f38c4369ef03f71
6
+ metadata.gz: 1ad194e645b0b2d45f526701dface2d2a128fc9c846c92827eafc0115d7bfff248c808ec38c708eaf8a56570aeaa573b18230f1129b8d603a04ae4e43fdf932b
7
+ data.tar.gz: 5ed8651c5033497bde0b3307daf4c048172f334462a3f29acce1fcfb76bf8382c91f3ee63193905c38dbcd9e12f4dca669e7760a6dec599530de155f98d22c4d
data/Gemfile.lock CHANGED
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- spree_vpago (2.4.0.pre.pre3)
4
+ spree_vpago (2.4.0)
5
5
  faraday
6
6
  google-cloud-firestore
7
7
  spree_api (>= 4.5)
8
8
  spree_backend (>= 4.5)
9
9
  spree_core (>= 4.5)
10
- spree_extension (< 1.0)
10
+ spree_extension
11
11
  spree_multi_vendor (>= 2.4.1)
12
12
 
13
13
  GEM
@@ -128,7 +128,7 @@ GEM
128
128
  babel-source (>= 4.0, < 6)
129
129
  execjs (~> 2.0)
130
130
  base64 (0.3.0)
131
- bcrypt (3.1.22)
131
+ bcrypt (3.1.21)
132
132
  bigdecimal (3.1.8)
133
133
  bootstrap (4.6.2.1)
134
134
  autoprefixer-rails (>= 9.1.0)
@@ -176,11 +176,10 @@ GEM
176
176
  rainbow (>= 2.1.0)
177
177
  diff-lcs (1.5.0)
178
178
  docile (1.4.0)
179
- doorkeeper (5.9.9)
179
+ doorkeeper (5.8.2)
180
180
  railties (>= 5)
181
181
  erubi (1.12.0)
182
- execjs (2.10.2)
183
- json (>= 2)
182
+ execjs (2.10.0)
184
183
  factory_bot (4.11.1)
185
184
  activesupport (>= 3.0.0)
186
185
  faraday (2.7.4)
@@ -189,7 +188,7 @@ GEM
189
188
  faraday-http-cache (2.5.0)
190
189
  faraday (>= 0.8)
191
190
  faraday-net_http (3.0.2)
192
- faraday-retry (2.4.0)
191
+ faraday-retry (2.3.2)
193
192
  faraday (~> 2.0)
194
193
  ffaker (2.21.0)
195
194
  ffi (1.15.5)
@@ -199,7 +198,7 @@ GEM
199
198
  flatpickr (4.6.13.1)
200
199
  friendly_id (5.5.0)
201
200
  activerecord (>= 4.0.0)
202
- gapic-common (1.5.0)
201
+ gapic-common (1.2.0)
203
202
  faraday (>= 1.9, < 3.a)
204
203
  faraday-retry (>= 1.0, < 3.a)
205
204
  google-cloud-env (~> 2.2)
@@ -208,7 +207,7 @@ GEM
208
207
  googleapis-common-protos (~> 1.6)
209
208
  googleapis-common-protos-types (~> 1.15)
210
209
  googleauth (~> 1.12)
211
- grpc (>= 1.83, < 2.a)
210
+ grpc (~> 1.66)
212
211
  gem-release (2.2.2)
213
212
  github_changelog_generator (1.16.4)
214
213
  activesupport
@@ -222,45 +221,45 @@ GEM
222
221
  globalid (1.1.0)
223
222
  activesupport (>= 5.0)
224
223
  glyphicons (1.0.2)
225
- google-cloud-core (1.9.0)
224
+ google-cloud-core (1.8.0)
226
225
  google-cloud-env (>= 1.0, < 3.a)
227
226
  google-cloud-errors (~> 1.0)
228
- google-cloud-env (2.4.0)
227
+ google-cloud-env (2.3.1)
229
228
  base64 (~> 0.2)
230
229
  faraday (>= 1.0, < 3.a)
231
- google-cloud-errors (1.7.0)
232
- google-cloud-firestore (3.2.0)
230
+ google-cloud-errors (1.5.0)
231
+ google-cloud-firestore (3.1.1)
233
232
  bigdecimal (~> 3.0)
234
233
  concurrent-ruby (~> 1.0)
235
234
  google-cloud-core (~> 1.7)
236
235
  google-cloud-firestore-v1 (~> 2.0)
237
236
  rbtree (~> 0.4.2)
238
- google-cloud-firestore-v1 (2.4.0)
239
- gapic-common (~> 1.3)
237
+ google-cloud-firestore-v1 (2.3.0)
238
+ gapic-common (~> 1.2)
240
239
  google-cloud-errors (~> 1.0)
241
240
  google-cloud-location (~> 1.0)
242
- google-cloud-location (1.5.1)
243
- gapic-common (~> 1.3)
241
+ google-cloud-location (1.2.1)
242
+ gapic-common (~> 1.2)
244
243
  google-cloud-errors (~> 1.0)
245
244
  google-logging-utils (0.2.0)
246
- google-protobuf (4.33.6)
245
+ google-protobuf (4.33.4)
247
246
  bigdecimal
248
247
  rake (>= 13)
249
- googleapis-common-protos (1.10.0)
248
+ googleapis-common-protos (1.9.0)
250
249
  google-protobuf (~> 4.26)
251
250
  googleapis-common-protos-types (~> 1.21)
252
251
  grpc (~> 1.41)
253
- googleapis-common-protos-types (1.23.0)
252
+ googleapis-common-protos-types (1.22.0)
254
253
  google-protobuf (~> 4.26)
255
- googleauth (1.17.4)
254
+ googleauth (1.16.1)
256
255
  faraday (>= 1.0, < 3.a)
257
256
  google-cloud-env (~> 2.2)
258
257
  google-logging-utils (~> 0.1)
259
258
  jwt (>= 1.4, < 4.0)
259
+ multi_json (~> 1.11)
260
260
  os (>= 0.9, < 2.0)
261
- pstore (~> 0.1)
262
261
  signet (>= 0.16, < 2.a)
263
- grpc (1.84.0)
262
+ grpc (1.76.0)
264
263
  google-protobuf (>= 3.25, < 5.0)
265
264
  googleapis-common-protos-types (~> 1.0)
266
265
  hashdiff (1.1.0)
@@ -370,7 +369,6 @@ GEM
370
369
  pry (0.14.2)
371
370
  coderay (~> 1.1)
372
371
  method_source (~> 1.0)
373
- pstore (0.2.1)
374
372
  public_suffix (5.0.1)
375
373
  puma (6.2.2)
376
374
  nio4r (~> 2.0)
@@ -414,13 +412,13 @@ GEM
414
412
  activerecord (>= 6.0.4)
415
413
  activesupport (>= 6.0.4)
416
414
  i18n
417
- rbtree (0.4.7)
415
+ rbtree (0.4.6)
418
416
  redis (5.0.6)
419
417
  redis-client (>= 0.9.0)
420
418
  redis-client (0.14.1)
421
419
  connection_pool
422
420
  regexp_parser (2.11.3)
423
- responders (3.2.1)
421
+ responders (3.2.0)
424
422
  actionpack (>= 7.0)
425
423
  railties (>= 7.0)
426
424
  rexml (3.2.9)
@@ -494,10 +492,11 @@ GEM
494
492
  websocket (~> 1.0)
495
493
  shoulda-matchers (6.2.0)
496
494
  activesupport (>= 5.2.0)
497
- signet (0.22.0)
495
+ signet (0.21.0)
498
496
  addressable (~> 2.8)
499
497
  faraday (>= 0.17.5, < 3.a)
500
498
  jwt (>= 1.5, < 4.0)
499
+ multi_json (~> 1.10)
501
500
  simplecov (0.22.0)
502
501
  docile (~> 1.1)
503
502
  simplecov-html (~> 0.11)
@@ -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
+ })();