@jetthai/cuora 1.1.42 → 1.1.44

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.1.44](https://github.com/jetthai/cuora-module/compare/v1.1.43...v1.1.44) (2023-01-20)
6
+
7
+ ### [1.1.43](https://github.com/jetthai/cuora-module/compare/v1.1.42...v1.1.43) (2023-01-20)
8
+
5
9
  ### [1.1.42](https://github.com/jetthai/cuora-module/compare/v1.1.41...v1.1.42) (2023-01-19)
6
10
 
7
11
  ### [1.1.41](https://github.com/jetthai/cuora-module/compare/v1.1.40...v1.1.41) (2023-01-19)
package/dist/bundle.mjs CHANGED
@@ -16233,7 +16233,7 @@ function manual_vn (request) {
16233
16233
  processing: null,
16234
16234
 
16235
16235
  // use for wallet mode 3
16236
- promotionsNo: null,
16236
+ promotion: null,
16237
16237
  },
16238
16238
  states: {
16239
16239
  loading: {
@@ -16272,8 +16272,20 @@ function manual_vn (request) {
16272
16272
  },
16273
16273
  },
16274
16274
  step1: {
16275
- initial: 'idle',
16275
+ initial: 'promotion',
16276
16276
  states: {
16277
+ promotion: {
16278
+ always: [
16279
+ {
16280
+ target: 'calculating',
16281
+ actions: 'setPromotionDefaultAmount',
16282
+ cond: 'hasMinPromotionDeposit',
16283
+ },
16284
+ {
16285
+ target: 'idle',
16286
+ },
16287
+ ],
16288
+ },
16277
16289
  idle: {},
16278
16290
  calculating: {
16279
16291
  invoke: {
@@ -16388,7 +16400,7 @@ function manual_vn (request) {
16388
16400
  },
16389
16401
  on: {
16390
16402
  SET_PROMOTION: {
16391
- actions: 'setPromotionsNo',
16403
+ actions: 'setPromotion',
16392
16404
  },
16393
16405
  },
16394
16406
  },
@@ -16492,9 +16504,14 @@ function manual_vn (request) {
16492
16504
  receipt: event.data,
16493
16505
  }
16494
16506
  }),
16495
- setPromotionsNo: assign((context, event) => {
16507
+ setPromotion: assign((context, event) => {
16508
+ return {
16509
+ promotion: event.data,
16510
+ }
16511
+ }),
16512
+ setPromotionDefaultAmount: assign((context, event) => {
16496
16513
  return {
16497
- promotionsNo: event.data,
16514
+ amount: context.promotion.minimumAmount,
16498
16515
  }
16499
16516
  }),
16500
16517
  },
@@ -16516,6 +16533,9 @@ function manual_vn (request) {
16516
16533
  isProcessing: (context, event) => {
16517
16534
  return context.processing
16518
16535
  },
16536
+ hasMinPromotionDeposit: (context, event) => {
16537
+ return context.promotion?.minimumAmount
16538
+ },
16519
16539
  },
16520
16540
  services: {
16521
16541
  fetchInitData: async (context, event) => {
@@ -16533,12 +16553,17 @@ function manual_vn (request) {
16533
16553
  return await request.send(payment.getBankList(method))
16534
16554
  },
16535
16555
  fetchCalculation: async (context, event) => {
16536
- const { method, amount, promotionsNo } = context;
16537
- return await request.send(payment.getDepositExpectedResult({ method, amount, promotionsNo }))
16556
+ const { method, amount, promotion } = context;
16557
+ return await request.send(
16558
+ payment.getDepositExpectedResult({
16559
+ method,
16560
+ amount,
16561
+ promotionsNo: promotion?.activityNo,
16562
+ })
16563
+ )
16538
16564
  },
16539
16565
  submitDeposit: async (context, event) => {
16540
- const { method, amount, selectedHouseBank, selectedUserBank, userAccountNumber, userAccountName, depositTime, receipt, promotionsNo } =
16541
- context;
16566
+ const { method, amount, selectedHouseBank, selectedUserBank, userAccountNumber, userAccountName, depositTime, receipt, promotion } = context;
16542
16567
  return await request.send(
16543
16568
  payment.submitDepositTransactionBank({
16544
16569
  method,
@@ -16550,7 +16575,7 @@ function manual_vn (request) {
16550
16575
  applyerHolderName: userAccountName,
16551
16576
  depositTime,
16552
16577
  receipt,
16553
- promotionsNo,
16578
+ promotionsNo: promotion?.activityNo,
16554
16579
  })
16555
16580
  )
16556
16581
  },
@@ -16963,7 +16988,7 @@ function qrcode_v2 (request) {
16963
16988
  grandTotalEnable: 1,
16964
16989
 
16965
16990
  // use for wallet mode 3
16966
- promotionsNo: null,
16991
+ promotion: null,
16967
16992
  },
16968
16993
  states: {
16969
16994
  loading: {
@@ -16979,7 +17004,15 @@ function qrcode_v2 (request) {
16979
17004
  },
16980
17005
  },
16981
17006
  checking: {
16982
- always: [{ target: 'newWalletMode', cond: 'isNewWalletMode' }, { target: 'defaultMode' }],
17007
+ always: [
17008
+ { target: 'newWalletMode', cond: 'isNewWalletMode' },
17009
+ {
17010
+ target: 'debouncing',
17011
+ actions: 'setPromotionDefaultAmount',
17012
+ cond: 'hasMinPromotionDeposit',
17013
+ },
17014
+ { target: 'defaultMode' },
17015
+ ],
16983
17016
  },
16984
17017
  newWalletMode: {
16985
17018
  initial: 'loaded',
@@ -17118,9 +17151,16 @@ function qrcode_v2 (request) {
17118
17151
  defaultMode: {
17119
17152
  entry: 'reset',
17120
17153
  on: {
17121
- SELECT_QRCODE: {
17122
- actions: 'setQrcode',
17123
- },
17154
+ SELECT_QRCODE: [
17155
+ {
17156
+ target: 'debouncing',
17157
+ actions: ['setQrcode', 'setPromotionDefaultAmount'],
17158
+ cond: 'hasMinPromotionDeposit',
17159
+ },
17160
+ {
17161
+ actions: 'setQrcode',
17162
+ },
17163
+ ],
17124
17164
  SELECT_AMOUNT: [
17125
17165
  {
17126
17166
  target: 'debouncing',
@@ -17256,7 +17296,7 @@ function qrcode_v2 (request) {
17256
17296
  },
17257
17297
  on: {
17258
17298
  SET_PROMOTION: {
17259
- actions: 'setPromotionsNo',
17299
+ actions: 'setPromotion',
17260
17300
  },
17261
17301
  },
17262
17302
  },
@@ -17316,9 +17356,15 @@ function qrcode_v2 (request) {
17316
17356
  result: event.data,
17317
17357
  }
17318
17358
  }),
17319
- setPromotionsNo: assign((context, event) => {
17359
+ setPromotion: assign((context, event) => {
17360
+ const promotion = event.data;
17361
+ return {
17362
+ promotion,
17363
+ }
17364
+ }),
17365
+ setPromotionDefaultAmount: assign((context, event) => {
17320
17366
  return {
17321
- promotionsNo: event.data,
17367
+ selectedAmount: context.promotion.minimumAmount,
17322
17368
  }
17323
17369
  }),
17324
17370
  },
@@ -17326,6 +17372,9 @@ function qrcode_v2 (request) {
17326
17372
  isNewWalletMode: (context, event) => {
17327
17373
  return context.siteConfig?.walletMode === '2'
17328
17374
  },
17375
+ hasMinPromotionDeposit: (context, event) => {
17376
+ return context.promotion?.minimumAmount
17377
+ },
17329
17378
  },
17330
17379
  services: {
17331
17380
  fetchInitData: async (context, event) => {
@@ -17337,22 +17386,22 @@ function qrcode_v2 (request) {
17337
17386
  return { siteConfig, paymentDetail }
17338
17387
  },
17339
17388
  fetchCalculation: async (context, event) => {
17340
- const { currentMethod, selectedAmount, promotionsNo } = context;
17389
+ const { currentMethod, selectedAmount, promotion } = context;
17341
17390
  return await request.send(
17342
17391
  payment.getDepositExpectedResult({
17343
17392
  method: currentMethod,
17344
17393
  amount: selectedAmount,
17345
- promotionsNo,
17394
+ promotionsNo: promotion?.activityNo,
17346
17395
  })
17347
17396
  )
17348
17397
  },
17349
17398
  submitDeposit: async (context, event) => {
17350
- const { currentMethod, selectedAmount, promotionsNo } = context;
17399
+ const { currentMethod, selectedAmount, promotion } = context;
17351
17400
  return await request.send(
17352
17401
  payment.submitDepositTransaction({
17353
17402
  method: currentMethod,
17354
17403
  amount: selectedAmount,
17355
- promotionsNo,
17404
+ promotionsNo: promotion?.activityNo,
17356
17405
  })
17357
17406
  )
17358
17407
  },
@@ -18692,7 +18741,7 @@ function direct (request) {
18692
18741
  result: null,
18693
18742
 
18694
18743
  // use for wallet mode 3
18695
- promotionsNo: null,
18744
+ promotion: null,
18696
18745
  },
18697
18746
  states: {
18698
18747
  loading: {
@@ -18714,7 +18763,7 @@ function direct (request) {
18714
18763
  invoke: {
18715
18764
  src: 'fetchBanksList',
18716
18765
  onDone: {
18717
- target: '#direct.loaded',
18766
+ target: '#direct.promotion',
18718
18767
  actions: 'setBanks',
18719
18768
  },
18720
18769
  onError: {
@@ -18724,6 +18773,18 @@ function direct (request) {
18724
18773
  },
18725
18774
  },
18726
18775
  },
18776
+ promotion: {
18777
+ always: [
18778
+ {
18779
+ target: 'calculating',
18780
+ actions: 'setPromotionDefaultAmount',
18781
+ cond: 'hasMinPromotionDeposit',
18782
+ },
18783
+ {
18784
+ target: 'loaded',
18785
+ },
18786
+ ],
18787
+ },
18727
18788
  loaded: {
18728
18789
  on: {
18729
18790
  SELECT_DIRECT: {
@@ -18778,7 +18839,7 @@ function direct (request) {
18778
18839
  },
18779
18840
  on: {
18780
18841
  SET_PROMOTION: {
18781
- actions: 'setPromotionsNo',
18842
+ actions: 'setPromotion',
18782
18843
  },
18783
18844
  },
18784
18845
  },
@@ -18842,9 +18903,14 @@ function direct (request) {
18842
18903
  result: event.data,
18843
18904
  }
18844
18905
  }),
18845
- setPromotionsNo: assign((context, event) => {
18906
+ setPromotion: assign((context, event) => {
18907
+ return {
18908
+ promotion: event.data,
18909
+ }
18910
+ }),
18911
+ setPromotionDefaultAmount: assign((context, event) => {
18846
18912
  return {
18847
- promotionsNo: event.data,
18913
+ amount: context.promotion.minimumAmount,
18848
18914
  }
18849
18915
  }),
18850
18916
  },
@@ -18861,6 +18927,9 @@ function direct (request) {
18861
18927
  const { amount, currentMethod, selectedBank } = context;
18862
18928
  return amount && currentMethod && selectedBank?.bankCode
18863
18929
  },
18930
+ hasMinPromotionDeposit: (context, event) => {
18931
+ return context.promotion?.minimumAmount
18932
+ },
18864
18933
  },
18865
18934
  services: {
18866
18935
  fetchInitData: async (context, event) => {
@@ -18872,24 +18941,24 @@ function direct (request) {
18872
18941
  return await request.send(payment.getBankList(method))
18873
18942
  },
18874
18943
  fetchCalculation: async (context, event) => {
18875
- const { currentMethod, amount, promotionsNo } = context;
18944
+ const { currentMethod, amount, promotion } = context;
18876
18945
 
18877
18946
  return await request.send(
18878
18947
  payment.getDepositExpectedResult({
18879
18948
  method: currentMethod,
18880
18949
  amount,
18881
- promotionsNo,
18950
+ promotionsNo: promotion?.activityNo,
18882
18951
  })
18883
18952
  )
18884
18953
  },
18885
18954
  submitDeposit: async (context, event) => {
18886
- const { currentMethod, amount, selectedBank, promotionsNo } = context;
18955
+ const { currentMethod, amount, selectedBank, promotion } = context;
18887
18956
  return await request.send(
18888
18957
  payment.submitDepositTransactionBank({
18889
18958
  method: currentMethod,
18890
18959
  amount,
18891
18960
  applyerBankCode: selectedBank.bankCode,
18892
- promotionsNo,
18961
+ promotionsNo: promotion?.activityNo,
18893
18962
  })
18894
18963
  )
18895
18964
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.42",
3
+ "version": "1.1.44",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -19,7 +19,7 @@ export default function (request) {
19
19
  result: null,
20
20
 
21
21
  // use for wallet mode 3
22
- promotionsNo: null,
22
+ promotion: null,
23
23
  },
24
24
  states: {
25
25
  loading: {
@@ -41,7 +41,7 @@ export default function (request) {
41
41
  invoke: {
42
42
  src: 'fetchBanksList',
43
43
  onDone: {
44
- target: '#direct.loaded',
44
+ target: '#direct.promotion',
45
45
  actions: 'setBanks',
46
46
  },
47
47
  onError: {
@@ -51,6 +51,18 @@ export default function (request) {
51
51
  },
52
52
  },
53
53
  },
54
+ promotion: {
55
+ always: [
56
+ {
57
+ target: 'calculating',
58
+ actions: 'setPromotionDefaultAmount',
59
+ cond: 'hasMinPromotionDeposit',
60
+ },
61
+ {
62
+ target: 'loaded',
63
+ },
64
+ ],
65
+ },
54
66
  loaded: {
55
67
  on: {
56
68
  SELECT_DIRECT: {
@@ -105,7 +117,7 @@ export default function (request) {
105
117
  },
106
118
  on: {
107
119
  SET_PROMOTION: {
108
- actions: 'setPromotionsNo',
120
+ actions: 'setPromotion',
109
121
  },
110
122
  },
111
123
  },
@@ -169,9 +181,14 @@ export default function (request) {
169
181
  result: event.data,
170
182
  }
171
183
  }),
172
- setPromotionsNo: assign((context, event) => {
184
+ setPromotion: assign((context, event) => {
173
185
  return {
174
- promotionsNo: event.data,
186
+ promotion: event.data,
187
+ }
188
+ }),
189
+ setPromotionDefaultAmount: assign((context, event) => {
190
+ return {
191
+ amount: context.promotion.minimumAmount,
175
192
  }
176
193
  }),
177
194
  },
@@ -188,6 +205,9 @@ export default function (request) {
188
205
  const { amount, currentMethod, selectedBank } = context
189
206
  return amount && currentMethod && selectedBank?.bankCode
190
207
  },
208
+ hasMinPromotionDeposit: (context, event) => {
209
+ return context.promotion?.minimumAmount
210
+ },
191
211
  },
192
212
  services: {
193
213
  fetchInitData: async (context, event) => {
@@ -199,24 +219,24 @@ export default function (request) {
199
219
  return await request.send(payment.getBankList(method))
200
220
  },
201
221
  fetchCalculation: async (context, event) => {
202
- const { currentMethod, amount, promotionsNo } = context
222
+ const { currentMethod, amount, promotion } = context
203
223
 
204
224
  return await request.send(
205
225
  payment.getDepositExpectedResult({
206
226
  method: currentMethod,
207
227
  amount,
208
- promotionsNo,
228
+ promotionsNo: promotion?.activityNo,
209
229
  })
210
230
  )
211
231
  },
212
232
  submitDeposit: async (context, event) => {
213
- const { currentMethod, amount, selectedBank, promotionsNo } = context
233
+ const { currentMethod, amount, selectedBank, promotion } = context
214
234
  return await request.send(
215
235
  payment.submitDepositTransactionBank({
216
236
  method: currentMethod,
217
237
  amount,
218
238
  applyerBankCode: selectedBank.bankCode,
219
- promotionsNo,
239
+ promotionsNo: promotion?.activityNo,
220
240
  })
221
241
  )
222
242
  },
@@ -30,7 +30,7 @@ export default function (request) {
30
30
  processing: null,
31
31
 
32
32
  // use for wallet mode 3
33
- promotionsNo: null,
33
+ promotion: null,
34
34
  },
35
35
  states: {
36
36
  loading: {
@@ -69,8 +69,20 @@ export default function (request) {
69
69
  },
70
70
  },
71
71
  step1: {
72
- initial: 'idle',
72
+ initial: 'promotion',
73
73
  states: {
74
+ promotion: {
75
+ always: [
76
+ {
77
+ target: 'calculating',
78
+ actions: 'setPromotionDefaultAmount',
79
+ cond: 'hasMinPromotionDeposit',
80
+ },
81
+ {
82
+ target: 'idle',
83
+ },
84
+ ],
85
+ },
74
86
  idle: {},
75
87
  calculating: {
76
88
  invoke: {
@@ -185,7 +197,7 @@ export default function (request) {
185
197
  },
186
198
  on: {
187
199
  SET_PROMOTION: {
188
- actions: 'setPromotionsNo',
200
+ actions: 'setPromotion',
189
201
  },
190
202
  },
191
203
  },
@@ -289,9 +301,14 @@ export default function (request) {
289
301
  receipt: event.data,
290
302
  }
291
303
  }),
292
- setPromotionsNo: assign((context, event) => {
304
+ setPromotion: assign((context, event) => {
293
305
  return {
294
- promotionsNo: event.data,
306
+ promotion: event.data,
307
+ }
308
+ }),
309
+ setPromotionDefaultAmount: assign((context, event) => {
310
+ return {
311
+ amount: context.promotion.minimumAmount,
295
312
  }
296
313
  }),
297
314
  },
@@ -313,6 +330,9 @@ export default function (request) {
313
330
  isProcessing: (context, event) => {
314
331
  return context.processing
315
332
  },
333
+ hasMinPromotionDeposit: (context, event) => {
334
+ return context.promotion?.minimumAmount
335
+ },
316
336
  },
317
337
  services: {
318
338
  fetchInitData: async (context, event) => {
@@ -330,12 +350,17 @@ export default function (request) {
330
350
  return await request.send(payment.getBankList(method))
331
351
  },
332
352
  fetchCalculation: async (context, event) => {
333
- const { method, amount, promotionsNo } = context
334
- return await request.send(payment.getDepositExpectedResult({ method, amount, promotionsNo }))
353
+ const { method, amount, promotion } = context
354
+ return await request.send(
355
+ payment.getDepositExpectedResult({
356
+ method,
357
+ amount,
358
+ promotionsNo: promotion?.activityNo,
359
+ })
360
+ )
335
361
  },
336
362
  submitDeposit: async (context, event) => {
337
- const { method, amount, selectedHouseBank, selectedUserBank, userAccountNumber, userAccountName, depositTime, receipt, promotionsNo } =
338
- context
363
+ const { method, amount, selectedHouseBank, selectedUserBank, userAccountNumber, userAccountName, depositTime, receipt, promotion } = context
339
364
  return await request.send(
340
365
  payment.submitDepositTransactionBank({
341
366
  method,
@@ -347,7 +372,7 @@ export default function (request) {
347
372
  applyerHolderName: userAccountName,
348
373
  depositTime,
349
374
  receipt,
350
- promotionsNo,
375
+ promotionsNo: promotion?.activityNo,
351
376
  })
352
377
  )
353
378
  },
@@ -27,7 +27,7 @@ export default function (request) {
27
27
  grandTotalEnable: 1,
28
28
 
29
29
  // use for wallet mode 3
30
- promotionsNo: null,
30
+ promotion: null,
31
31
  },
32
32
  states: {
33
33
  loading: {
@@ -43,7 +43,15 @@ export default function (request) {
43
43
  },
44
44
  },
45
45
  checking: {
46
- always: [{ target: 'newWalletMode', cond: 'isNewWalletMode' }, { target: 'defaultMode' }],
46
+ always: [
47
+ { target: 'newWalletMode', cond: 'isNewWalletMode' },
48
+ {
49
+ target: 'debouncing',
50
+ actions: 'setPromotionDefaultAmount',
51
+ cond: 'hasMinPromotionDeposit',
52
+ },
53
+ { target: 'defaultMode' },
54
+ ],
47
55
  },
48
56
  newWalletMode: {
49
57
  initial: 'loaded',
@@ -182,9 +190,16 @@ export default function (request) {
182
190
  defaultMode: {
183
191
  entry: 'reset',
184
192
  on: {
185
- SELECT_QRCODE: {
186
- actions: 'setQrcode',
187
- },
193
+ SELECT_QRCODE: [
194
+ {
195
+ target: 'debouncing',
196
+ actions: ['setQrcode', 'setPromotionDefaultAmount'],
197
+ cond: 'hasMinPromotionDeposit',
198
+ },
199
+ {
200
+ actions: 'setQrcode',
201
+ },
202
+ ],
188
203
  SELECT_AMOUNT: [
189
204
  {
190
205
  target: 'debouncing',
@@ -320,7 +335,7 @@ export default function (request) {
320
335
  },
321
336
  on: {
322
337
  SET_PROMOTION: {
323
- actions: 'setPromotionsNo',
338
+ actions: 'setPromotion',
324
339
  },
325
340
  },
326
341
  },
@@ -380,9 +395,15 @@ export default function (request) {
380
395
  result: event.data,
381
396
  }
382
397
  }),
383
- setPromotionsNo: assign((context, event) => {
398
+ setPromotion: assign((context, event) => {
399
+ const promotion = event.data
384
400
  return {
385
- promotionsNo: event.data,
401
+ promotion,
402
+ }
403
+ }),
404
+ setPromotionDefaultAmount: assign((context, event) => {
405
+ return {
406
+ selectedAmount: context.promotion.minimumAmount,
386
407
  }
387
408
  }),
388
409
  },
@@ -390,6 +411,9 @@ export default function (request) {
390
411
  isNewWalletMode: (context, event) => {
391
412
  return context.siteConfig?.walletMode === '2'
392
413
  },
414
+ hasMinPromotionDeposit: (context, event) => {
415
+ return context.promotion?.minimumAmount
416
+ },
393
417
  },
394
418
  services: {
395
419
  fetchInitData: async (context, event) => {
@@ -401,22 +425,22 @@ export default function (request) {
401
425
  return { siteConfig, paymentDetail }
402
426
  },
403
427
  fetchCalculation: async (context, event) => {
404
- const { currentMethod, selectedAmount, promotionsNo } = context
428
+ const { currentMethod, selectedAmount, promotion } = context
405
429
  return await request.send(
406
430
  payment.getDepositExpectedResult({
407
431
  method: currentMethod,
408
432
  amount: selectedAmount,
409
- promotionsNo,
433
+ promotionsNo: promotion?.activityNo,
410
434
  })
411
435
  )
412
436
  },
413
437
  submitDeposit: async (context, event) => {
414
- const { currentMethod, selectedAmount, promotionsNo } = context
438
+ const { currentMethod, selectedAmount, promotion } = context
415
439
  return await request.send(
416
440
  payment.submitDepositTransaction({
417
441
  method: currentMethod,
418
442
  amount: selectedAmount,
419
- promotionsNo,
443
+ promotionsNo: promotion?.activityNo,
420
444
  })
421
445
  )
422
446
  },