@jetthai/cuora 1.0.189 → 1.0.191

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,36 @@
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.0.191](https://github.com/jetthai/cuora-module/compare/v1.0.184-3...v1.0.191) (2022-10-26)
6
+
7
+ ### [1.0.190](https://github.com/jetthai/cuora-module/compare/v1.0.184-2...v1.0.190) (2022-10-18)
8
+
9
+ ### [1.0.189](https://github.com/jetthai/cuora-module/compare/v1.0.188...v1.0.189) (2022-10-17)
10
+
11
+ ### [1.0.188](https://github.com/jetthai/cuora-module/compare/v1.0.187...v1.0.188) (2022-10-17)
12
+
13
+ ### [1.0.187](https://github.com/jetthai/cuora-module/compare/v1.0.186...v1.0.187) (2022-10-07)
14
+
15
+ ### [1.0.186](https://github.com/jetthai/cuora-module/compare/v1.0.185...v1.0.186) (2022-10-07)
16
+
17
+ ### [1.0.185](https://github.com/jetthai/cuora-module/compare/v1.0.184-1.1...v1.0.185) (2022-10-07)
18
+
19
+ ### [1.0.184-1.1](https://github.com/jetthai/cuora-module/compare/v1.0.184-1...v1.0.184-1.1) (2022-10-07)
20
+
21
+ ### [1.0.190](https://github.com/jetthai/cuora-module/compare/v1.0.184-2...v1.0.190) (2022-10-18)
22
+
23
+ ### [1.0.189](https://github.com/jetthai/cuora-module/compare/v1.0.188...v1.0.189) (2022-10-17)
24
+
25
+ ### [1.0.188](https://github.com/jetthai/cuora-module/compare/v1.0.187...v1.0.188) (2022-10-17)
26
+
27
+ ### [1.0.187](https://github.com/jetthai/cuora-module/compare/v1.0.186...v1.0.187) (2022-10-07)
28
+
29
+ ### [1.0.186](https://github.com/jetthai/cuora-module/compare/v1.0.185...v1.0.186) (2022-10-07)
30
+
31
+ ### [1.0.185](https://github.com/jetthai/cuora-module/compare/v1.0.184-1.1...v1.0.185) (2022-10-07)
32
+
33
+ ### [1.0.184-1.1](https://github.com/jetthai/cuora-module/compare/v1.0.184-1...v1.0.184-1.1) (2022-10-07)
34
+
5
35
  ### [1.0.189](https://github.com/jetthai/cuora-module/compare/v1.0.188...v1.0.189) (2022-10-17)
6
36
 
7
37
  ### [1.0.188](https://github.com/jetthai/cuora-module/compare/v1.0.187...v1.0.188) (2022-10-17)
@@ -16,6 +46,12 @@ All notable changes to this project will be documented in this file. See [standa
16
46
 
17
47
  ### [1.0.184-1.1](https://github.com/jetthai/cuora-module/compare/v1.0.184...v1.0.184-1.1) (2022-10-07)
18
48
 
49
+ ### [1.0.184-3](https://github.com/jetthai/cuora-module/compare/v1.0.184-2...v1.0.184-3) (2022-10-19)
50
+
51
+ ### [1.0.184-2](https://github.com/jetthai/cuora-module/compare/v1.0.184-1...v1.0.184-2) (2022-10-18)
52
+
53
+ ### [1.0.184-1](https://github.com/jetthai/cuora-module/compare/v1.0.184...v1.0.184-1) (2022-10-07)
54
+
19
55
  ### [1.0.184](https://github.com/jetthai/cuora-module/compare/v1.0.183...v1.0.184) (2022-10-03)
20
56
 
21
57
  ### [1.0.183](https://github.com/jetthai/cuora-module/compare/v1.0.182...v1.0.183) (2022-10-03)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.0.189",
3
+ "version": "1.0.191",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -7,15 +7,7 @@ export default function (request) {
7
7
  id: 'loadcard',
8
8
  initial: 'loading',
9
9
  context: {
10
- cards: [
11
- { name: 'mobifone', code: 'VMS', category: 'loadcard', methodDescription: 'MOBIFONE' },
12
- { name: 'viettel', code: 'VTT', category: 'loadcard', methodDescription: 'VIETTEL' },
13
- { name: 'vinaphone', code: 'VNP', category: 'loadcard', methodDescription: 'VINAPHONE' },
14
- // { name: 'vietnam mobile', code: 'VNM' },
15
- // { name: 'thẻ zing', code: 'ZING' },
16
- // { name: 'thẻ gate', code: 'GATE' },
17
- // { name: 'thẻ garena', code: 'GARENA' },
18
- ],
10
+ cards: [],
19
11
  options: [],
20
12
 
21
13
  selectedCard: null,
@@ -50,20 +42,37 @@ export default function (request) {
50
42
  actions: 'setCard',
51
43
  },
52
44
  SELECT_AMOUNT: {
53
- target: 'calculable',
45
+ target: 'debouncing',
54
46
  actions: 'setAmount',
55
47
  },
56
48
  },
57
49
  },
50
+ debouncing: {
51
+ on: {
52
+ SELECT_AMOUNT: {
53
+ target: 'debouncing',
54
+ actions: 'setAmount',
55
+ },
56
+ BACK: {
57
+ target: 'loaded',
58
+ },
59
+ },
60
+ after: {
61
+ 1000: {
62
+ target: 'calculating',
63
+ },
64
+ },
65
+ },
58
66
  fail: {},
59
67
  calculable: {
60
68
  entry: 'clearCalculation',
61
69
  on: {
62
70
  SELECT_AMOUNT: {
71
+ target: 'debouncing',
63
72
  actions: 'setAmount',
64
73
  },
65
74
  CALCULATE: {
66
- target: 'calculating',
75
+ target: 'debouncing',
67
76
  },
68
77
  BACK: {
69
78
  target: 'loaded',
@@ -85,7 +94,7 @@ export default function (request) {
85
94
  calculated: {
86
95
  on: {
87
96
  SELECT_AMOUNT: {
88
- target: 'calculable',
97
+ target: 'debouncing',
89
98
  actions: 'setAmount',
90
99
  },
91
100
  CONFIRM: {
@@ -95,7 +104,7 @@ export default function (request) {
95
104
  target: 'loaded',
96
105
  },
97
106
  CLEAR_CALCULATION: {
98
- target: 'calculable',
107
+ target: 'debouncing',
99
108
  actions: 'clearCalculation',
100
109
  },
101
110
  },
@@ -150,18 +159,20 @@ export default function (request) {
150
159
  }),
151
160
  setInitData: assign((context, event) => {
152
161
  const paymentDetails = event.data
153
- const currentPayment = paymentDetails.find((element) => element.category === context.currentCategory)
162
+ const cards = paymentDetails.filter((element) => element.category === context.currentCategory)
154
163
  return {
155
164
  paymentDetails,
156
- currentPayment,
157
- currentMethod: currentPayment.method,
158
- options: currentPayment.optional,
159
- selectedCard: context.cards[0],
165
+ cards,
166
+ selectedCard: cards[0],
167
+ currentMethod: cards[0].method,
168
+ options: cards[0].optional
160
169
  }
161
170
  }),
162
171
  setCard: assign((context, event) => {
163
172
  return {
164
173
  selectedCard: event.data,
174
+ currentMethod: event.data.method,
175
+ options: event.data.optional,
165
176
  }
166
177
  }),
167
178
  setCardNumber: assign((context, event) => {
@@ -198,11 +209,6 @@ export default function (request) {
198
209
  fetchInitData: async (context, event) => {
199
210
  return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
200
211
  },
201
- fetchBanksList: async (context, event) => {
202
- const { paymentDetails, currentCategory } = context
203
- const method = paymentDetails.find((item) => item.category === currentCategory)?.method
204
- return await request.send(payment.getBankList(method))
205
- },
206
212
  fetchCalculation: async (context, event) => {
207
213
  const { currentMethod, selectedAmount } = context
208
214
  return await request.send(
@@ -218,7 +224,7 @@ export default function (request) {
218
224
  payment.submitDepositTransactionLoadcard({
219
225
  method: currentMethod,
220
226
  amount: selectedAmount,
221
- card_type: selectedCard.code,
227
+ card_type: selectedCard.channel_id,
222
228
  card_code: cardNumber,
223
229
  card_seri: serialNumber,
224
230
  })
@@ -199,11 +199,6 @@ export default function (request) {
199
199
  fetchInitData: async (context, event) => {
200
200
  return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
201
201
  },
202
- fetchBanksList: async (context, event) => {
203
- const { paymentDetails, currentCategory } = context
204
- const method = paymentDetails.find((item) => item.category === currentCategory)?.method
205
- return await request.send(payment.getBankList(method))
206
- },
207
202
  fetchCalculation: async (context, event) => {
208
203
  const { currentMethod, selectedAmount } = context
209
204
  return await request.send(