@jetthai/cuora 1.0.53 → 1.0.55

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.0.55](https://github.com/jetthai/cuora-module/compare/v1.0.54...v1.0.55) (2021-12-14)
6
+
7
+ ### [1.0.54](https://github.com/jetthai/cuora-module/compare/v1.0.53...v1.0.54) (2021-12-13)
8
+
5
9
  ### [1.0.53](https://github.com/jetthai/cuora-module/compare/v1.0.52...v1.0.53) (2021-12-10)
6
10
 
7
11
  ### [1.0.52](https://github.com/jetthai/cuora-module/compare/v1.0.51...v1.0.52) (2021-12-07)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.0.53",
3
+ "version": "1.0.55",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -5,13 +5,13 @@ export default {
5
5
  // getPaymentInfo: () => ({ url: `payment/paymentInfo`, method: 'get' }),
6
6
  getPaymentInfo: () => ({ url: `payment/v2/paymentInfo`, method: 'get' }),
7
7
  updatePaymentInfo: ({ bankCode, bankAccount, firstNameTh, lastNameTh, firstNameEn, lastNameEn, bonus, paymentProvider }) => ({
8
- url: 'payment/updatePaymentInfo',
8
+ url: 'payment/v2/updatePaymentInfo',
9
9
  method: 'post',
10
10
  params: { bankCode, bankAccount, firstNameTh, lastNameTh, firstNameEn, lastNameEn, bonus, paymentProvider },
11
11
  }),
12
- getBankList: (paymentMethod) => ({ url: `payment/${paymentMethod}/getBankList`, method: 'get' }),
12
+ getBankList: (paymentMethod) => ({ url: `payment/v2/${paymentMethod}/getBankList`, method: 'get' }),
13
13
  makeTransaction: ({ type, payload, paymentMethod }) => ({
14
- url: `payment/${paymentMethod}/transaction`,
14
+ url: `payment/v2/${paymentMethod}/transaction`,
15
15
  method: 'post',
16
16
  params: {
17
17
  transferType: type,
@@ -19,10 +19,10 @@ export default {
19
19
  },
20
20
  }),
21
21
  checkTransaction: (paymentMethod) => ({ url: `payment/${paymentMethod}/checkTransaction`, method: 'post' }),
22
- setBonusSetting: ({ bonus }) => ({ url: 'payment/setting', method: 'post', params: { bonus } }),
23
- getCurrentWithdrawRule: () => ({ url: 'payment/getCurrentWithdrawRule', method: 'get' }),
22
+ setBonusSetting: ({ bonus }) => ({ url: 'payment/v2/setting', method: 'post', params: { bonus } }),
23
+ getCurrentWithdrawRule: () => ({ url: 'payment/v2/getCurrentWithdrawRule', method: 'get' }),
24
24
  convertFreeCredit: ({ exchangeType, cryptoNetwork, targetAddress }) => ({
25
- url: 'payment/convertFreeCredit',
25
+ url: 'payment/v2/convertFreeCredit',
26
26
  method: 'post',
27
27
  params: { exchangeType, cryptoNetwork, targetAddress },
28
28
  }),
@@ -4,8 +4,8 @@ import api from '../api/user'
4
4
  export default function (request) {
5
5
  return createMachine(
6
6
  {
7
- id: 'otp',
8
- initial: 'idle',
7
+ id: 'auth_otp',
8
+ initial: 'fetching',
9
9
  context: {
10
10
  userInfo: null,
11
11
  error: null,
@@ -16,16 +16,23 @@ export default function (request) {
16
16
  ttl: 0,
17
17
  },
18
18
  states: {
19
- idle: {
19
+ fetching: {
20
+ invoke: {
21
+ src: 'fetchUserInfo',
22
+ onDone: {
23
+ target: 'checking',
24
+ actions: 'setUserInfo',
25
+ },
26
+ onError: {
27
+ target: 'fail',
28
+ },
29
+ },
30
+ },
31
+ checking: {
20
32
  always: [
21
33
  { target: 'verified', cond: 'isVerified' },
22
34
  { target: 'notVerified', cond: 'isNotVerified' },
23
35
  ],
24
- on: {
25
- SET_USER_INFO: {
26
- actions: 'setUserInfo',
27
- },
28
- },
29
36
  },
30
37
  notVerified: {
31
38
  initial: 'checkingStatus',
@@ -44,7 +51,7 @@ export default function (request) {
44
51
  },
45
52
  },
46
53
  errorChecking: {
47
- always: [{ target: 'phone', cond: 'hasNoPhone' }, { target: '#otp.fail' }],
54
+ always: [{ target: 'phone', cond: 'hasNoPhone' }, { target: '#auth_otp.fail' }],
48
55
  },
49
56
  phone: {
50
57
  on: {
@@ -87,7 +94,7 @@ export default function (request) {
87
94
  target: 'reset',
88
95
  },
89
96
  RESEND_PHONE: {
90
- target: '#otp.notVerified.phone',
97
+ target: '#auth_otp.notVerified.phone',
91
98
  },
92
99
  },
93
100
  },
@@ -95,7 +102,7 @@ export default function (request) {
95
102
  invoke: {
96
103
  src: 'acknowledge',
97
104
  onDone: {
98
- target: '#otp.verified',
105
+ target: '#auth_otp.verified',
99
106
  },
100
107
  onError: {
101
108
  target: 'idle',
@@ -169,6 +176,9 @@ export default function (request) {
169
176
  },
170
177
  },
171
178
  services: {
179
+ fetchUserInfo: async (context, event) => {
180
+ return await request.send(api.getUserInfo())
181
+ },
172
182
  verify: async (context, event) => {
173
183
  return await request.send(api.verify())
174
184
  },