@jetthai/cuora 1.1.488-dev.1 → 1.2.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.
- package/.husky/pre-commit +3 -1
- package/.prettierignore +1 -2
- package/CHANGELOG.md +0 -746
- package/README.md +15 -299
- package/package.json +3 -6
- package/resetGitBranch.sh +101 -0
- package/src/api/activity.js +39 -24
- package/src/api/auth.js +35 -4
- package/src/api/common.js +1 -8
- package/src/api/game.js +10 -0
- package/src/api/index.js +1 -3
- package/src/api/payment.js +55 -18
- package/src/api/user.js +16 -11
- package/src/index.js +2 -2
- package/src/lib/fingerprint_v3_11_12.js +11433 -0
- package/src/machine/activity/activity.js +209 -0
- package/src/machine/activity/activity_cash.js +18 -71
- package/src/machine/activity/diamond_shop_activity_cash.js +1 -0
- package/src/machine/activity/diamond_shop_activity_fc.js +196 -0
- package/src/machine/activity/diamond_shop_activity_vn.js +178 -0
- package/src/machine/activity/fafafa_activity.js +10 -0
- package/src/machine/activity/index.js +12 -0
- package/src/machine/activity/invite_friends_activity.js +114 -0
- package/src/machine/activity/mini_game_activity.js +68 -0
- package/src/machine/activity/return_bonus_activity.js +153 -0
- package/src/machine/activity/roulette_activity_v2.js +0 -5
- package/src/machine/auth.js +140 -192
- package/src/machine/auth_otp_v2.js +177 -0
- package/src/machine/auth_otp_v3.js +32 -111
- package/src/machine/bank_binding.js +2 -2
- package/src/machine/bank_binding_amb.js +145 -0
- package/src/machine/bonus.js +75 -0
- package/src/machine/common.js +91 -27
- package/src/machine/deposit/amb.js +92 -0
- package/src/machine/deposit/crypto_bank.js +325 -0
- package/src/machine/deposit/crypto_bank_cash.js +8 -19
- package/src/machine/deposit/crypto_qrcode.js +148 -0
- package/src/machine/deposit/crypto_qrcode_cash.js +41 -26
- package/src/machine/deposit/crypto_way.js +247 -0
- package/src/machine/deposit/crypto_way_cash.js +32 -52
- package/src/machine/deposit/deposit_fc.js +271 -0
- package/src/machine/deposit/direct.js +310 -0
- package/src/machine/deposit/direct_cash.js +9 -8
- package/src/machine/deposit/float.js +374 -0
- package/src/machine/deposit/index.js +28 -0
- package/src/machine/deposit/krway.js +151 -0
- package/src/machine/deposit/loadcard_cash.js +31 -14
- package/src/machine/deposit/loadcard_vn.js +351 -0
- package/src/machine/deposit/manual_cash.js +10 -8
- package/src/machine/deposit/manual_vn.js +458 -0
- package/src/machine/deposit/qrcode_cash.js +30 -14
- package/src/machine/deposit/qrcode_v2.js +338 -0
- package/src/machine/deposit/usdt.js +144 -0
- package/src/machine/deposit/virtual_bank_cash.js +2 -5
- package/src/machine/deposit/virtual_bank_vn.js +269 -0
- package/src/machine/deposit/vpay.js +367 -0
- package/src/machine/error.js +0 -7
- package/src/machine/game_hot_new.js +79 -0
- package/src/machine/game_info.js +12 -5
- package/src/machine/game_replay.js +46 -0
- package/src/machine/game_search_v2.js +401 -0
- package/src/machine/game_v2_1.js +88 -58
- package/src/machine/honor_board.js +132 -0
- package/src/machine/honor_board_cash.js +18 -15
- package/src/machine/inbox.js +12 -0
- package/src/machine/index.js +32 -0
- package/src/machine/leaderboard.js +11 -8
- package/src/machine/merge.js +57 -0
- package/src/machine/payment_data.js +86 -0
- package/src/machine/promotions.js +170 -0
- package/src/machine/ranking.js +25 -43
- package/src/machine/reward.js +255 -0
- package/src/machine/reward_cash.js +41 -2
- package/src/machine/reward_fc.js +98 -0
- package/src/machine/roulette_v2.js +25 -20
- package/src/machine/side.js +154 -0
- package/src/machine/side_cash.js +2 -3
- package/src/machine/side_v2.js +209 -0
- package/src/machine/user_reset_password.js +15 -4
- package/src/machine/user_sign_up.js +60 -49
- package/src/machine/vip_table.js +57 -0
- package/src/machine/websocket.js +325 -378
- package/src/machine/welcome.js +110 -0
- package/src/machine/withdraw/index.js +6 -0
- package/src/machine/withdraw/withdraw_crypto_cash.js +327 -0
- package/src/machine/withdraw/withdraw_krway.js +222 -0
- package/src/machine/withdraw/withdraw_manual.js +533 -0
- package/src/machine/withdraw/withdraw_manual_cash.js +43 -74
- package/src/request/config.js +0 -2
- package/src/request/request.js +64 -231
- package/src/util/constant.js +2 -12
- package/src/util/deviceToken.js +59 -0
- package/src/util/index.js +4 -2
- package/src/util/math.js +4 -0
- package/.claude/commands/sync-ai-prompts.md +0 -180
- package/.claude/settings.local.json +0 -25
- package/.github/copilot-instructions.md +0 -459
- package/.husky/post-checkout +0 -32
- package/.husky/pre-push +0 -36
- package/AGENTS.md +0 -459
- package/AI_PROMPT_SOURCE.md +0 -457
- package/CLAUDE.md +0 -459
- package/GEMINI.md +0 -459
- package/docs/kibana/crypto-way-deposit-amount-bug-analysis.md +0 -1003
- package/docs/kibana/play-providerId-error.md +0 -202
- package/docs/kibana/play-selectedWalletType.md +0 -1
- package/docs/kibana/play-selectedWalletType_2.md +0 -1
- package/docs/kibana/play-selectedWalletType_analysis.md +0 -565
- package/docs/my-claude/feat-sharon-JT-1790247240-socket/branch-transfer.md +0 -14
- package/docs/my-claude/feat-sharon-JT-1790247240-socket/cash-module-preparation.json +0 -40
- package/docs/my-claude/feat-sharon-JT-1790247240-socket/cash-module-verification.md +0 -41
- package/docs/my-claude/feat-sharon-JT-1790247240-socket/implementation-ledger.md +0 -87
- package/docs/my-claude/feat-sharon-JT-1790247240-socket/module-report.md +0 -73
- package/docs/my-claude/feat-sharon-JT-1790247240-socket/plan.md +0 -309
- package/docs/my-claude/feat-sharon-JT-1790247240-socket/test-cases.md +0 -245
- package/docs/my-claude/feat-sharon-JT-1791180540-onesignal/transfer.md +0 -9
- package/e2e/feature-map.md +0 -19
- package/prepare-for-pr/JT-1776243420.md +0 -85
- package/prepare-for-pr/TI-16026/STATE.md +0 -18
- package/prepare-for-pr/TI-16026/after-prepare-authorization.md +0 -3
- package/prepare-for-pr/TI-16026/analysis.md +0 -38
- package/prepare-for-pr/TI-16026/answer-analyze-01.md +0 -1
- package/prepare-for-pr/TI-16026/answer-commit-01.md +0 -2
- package/prepare-for-pr/TI-16026/answer-commit-02.md +0 -1
- package/prepare-for-pr/TI-16026/bundle.json +0 -18
- package/prepare-for-pr/TI-16026/checklist.md +0 -196
- package/prepare-for-pr/TI-16026/checklist.unit-test-original.md +0 -39
- package/prepare-for-pr/TI-16026/claude-after-model +0 -1
- package/prepare-for-pr/TI-16026/claude-commit-session +0 -1
- package/prepare-for-pr/TI-16026/claude-harvest-session +0 -1
- package/prepare-for-pr/TI-16026/claude-hops/01-analyze.err +0 -1
- package/prepare-for-pr/TI-16026/claude-hops/01-analyze.out +0 -2
- package/prepare-for-pr/TI-16026/claude-hops/02-analyze.err +0 -1
- package/prepare-for-pr/TI-16026/claude-hops/02-analyze.out +0 -4
- package/prepare-for-pr/TI-16026/claude-hops/03-dev.err +0 -1
- package/prepare-for-pr/TI-16026/claude-hops/03-dev.out +0 -4
- package/prepare-for-pr/TI-16026/claude-hops/04-dev.err +0 -1
- package/prepare-for-pr/TI-16026/claude-hops/04-dev.out +0 -4
- package/prepare-for-pr/TI-16026/claude-hops/05-dev.err +0 -1
- package/prepare-for-pr/TI-16026/claude-hops/05-dev.out +0 -3
- package/prepare-for-pr/TI-16026/claude-hops/06-after.err +0 -1
- package/prepare-for-pr/TI-16026/claude-hops/06-after.out +0 -2
- package/prepare-for-pr/TI-16026/claude-hops/07-commit.err +0 -1
- package/prepare-for-pr/TI-16026/claude-hops/07-commit.out +0 -2
- package/prepare-for-pr/TI-16026/claude-hops/08-commit.err +0 -1
- package/prepare-for-pr/TI-16026/claude-hops/08-commit.out +0 -2
- package/prepare-for-pr/TI-16026/claude-hops/09-commit.err +0 -1
- package/prepare-for-pr/TI-16026/claude-hops/09-commit.out +0 -8
- package/prepare-for-pr/TI-16026/claude-hops/10-harvest.err +0 -1
- package/prepare-for-pr/TI-16026/claude-hops/10-harvest.out +0 -3
- package/prepare-for-pr/TI-16026/claude-hops/11-harvest.err +0 -1
- package/prepare-for-pr/TI-16026/claude-hops/11-harvest.out +0 -3
- package/prepare-for-pr/TI-16026/commit-note.md +0 -5
- package/prepare-for-pr/TI-16026/evidence-index.json +0 -215
- package/prepare-for-pr/TI-16026/feature-map.before.md +0 -61
- package/prepare-for-pr/TI-16026/harvest-redaction.json +0 -34
- package/prepare-for-pr/TI-16026/harvest-redaction.out +0 -37
- package/prepare-for-pr/TI-16026/harvest.md +0 -46
- package/prepare-for-pr/TI-16026/lessons.md +0 -5
- package/prepare-for-pr/TI-16026/note-harvest-redaction.md +0 -1
- package/prepare-for-pr/TI-16026/open-questions.md +0 -6
- package/prepare-for-pr/TI-16026/publish.md +0 -32
- package/prepare-for-pr/TI-16026/review-convergence-response.md +0 -3
- package/prepare-for-pr/TI-16026/review-input/scope.md +0 -18
- package/prepare-for-pr/TI-16026/review-log.md +0 -57
- package/prepare-for-pr/TI-16026/review-notes.md +0 -97
- package/prepare-for-pr/TI-16026/review-response-r1.md +0 -7
- package/prepare-for-pr/TI-16026/self-test-report.md +0 -67
- package/prepare-for-pr/TI-16026/spec-proposal.md +0 -34
- package/prepare-for-pr/TI-16026/spec-snapshot.md +0 -291
- package/prepare-for-pr/TI-16026/state-log.md +0 -57
- package/prepare-for-pr/TI-16026/user-messages/01.md +0 -12
- package/prepare-for-pr/TI-16026/user-messages/02.md +0 -20
- package/prepare-for-pr/TI-16026/user-messages/03.md +0 -1
- package/prepare-for-pr/TI-16026/user-messages/04.md +0 -1
- package/prepare-for-pr/TI-16026/user-messages/05.md +0 -1
- package/prepare-for-pr/TI-16026/user-messages/06.md +0 -1
- package/prepare-for-pr/TI-16026/user-messages/07.md +0 -1
- package/prepare-for-pr/TI-16026/user-messages/08.md +0 -1
- package/prepare-for-pr/TI-16026/user-messages/09.md +0 -1
- package/prepare-for-pr/TI-16026/user-messages/10.md +0 -1
- package/prepare-for-pr/TI-16026/user-messages/11.md +0 -1
- package/prepare-for-pr/TI-16026/user-messages/12.md +0 -1
- package/prepare-for-pr/TI-16026/user-messages/13.md +0 -1
- package/prepare-for-pr/TI-16026/user-messages/14.md +0 -1
- package/prepare-for-pr/TI-16026/user-messages/15.md +0 -1
- package/prepare-for-pr/TI-16026/user-messages/16.md +0 -1
- package/prepare-for-pr/TI-16026/user-messages/17.md +0 -1
- package/prepare-for-pr/TI-16026/user-messages/18.md +0 -10
- package/prepare-for-pr/TI-16026/user-messages/19.md +0 -1
- package/prepare-for-pr/TI-16026/user-messages/20.md +0 -1
- package/prepare-for-pr/TI-16026/user-messages/21.md +0 -1
- package/prepare-for-pr/TI-16026/user-messages/22.md +0 -1
- package/prepare-for-pr/TI-16026/user-messages/23.md +0 -8
- package/prepare-for-pr/TI-16026/user-messages/24.md +0 -24
- package/prepare-for-pr/TI-16026/user-question.md +0 -24
- package/prepare-for-pr/TI-16026/verify/metrics-check.json +0 -13
- package/prepare-for-pr/TI-16026/verify/redaction.json +0 -38
- package/prepare-for-pr/TI-16026/verify/row-closure.json +0 -45
- package/prepare-for-pr/TI-16026/verify/s04-ws-capture.md +0 -23
- package/prepare-for-pr/TI-16026/verify-after.md +0 -23
- package/prepare-for-pr/TI-16026/verify.json +0 -80
- package/prepare-for-pr/TI-16026.md +0 -408
- package/scripts/auto-version.js +0 -69
- package/scripts/auto-version.sh +0 -33
- package/scripts/branch-auto-npm-publish.js +0 -36
- package/scripts/check-version.sh +0 -36
- package/scripts/clean-tags.sh +0 -84
- package/src/api/account.js +0 -7
- package/src/api/otp.js +0 -5
- package/src/util/amount.js +0 -8
- package/src/util/err998SentryExtra.js +0 -26
- package/src/util/paramStore.js +0 -139
- package/src/util/socketPolicy.js +0 -57
- package/src/util/tokenStore.js +0 -44
- package/test/auth_otp_v3.test.js +0 -323
- package/test/auth_self_timeout.test.js +0 -171
- package/test/request_self.test.js +0 -288
- package/test/withdraw_manual_cash.test.js +0 -149
- package/tests/session.test.mjs +0 -177
- package/tests/websocket.test.mjs +0 -779
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
import { assign, createMachine } from 'xstate'
|
|
2
|
+
import payment from '../../api/payment.js'
|
|
3
|
+
|
|
4
|
+
export default function (request) {
|
|
5
|
+
const { appSecret } = request.config
|
|
6
|
+
|
|
7
|
+
return createMachine(
|
|
8
|
+
{
|
|
9
|
+
id: 'manual',
|
|
10
|
+
initial: 'loading',
|
|
11
|
+
context: {
|
|
12
|
+
siteConfig: null,
|
|
13
|
+
paymentDetail: [],
|
|
14
|
+
allBankList: [],
|
|
15
|
+
houseBanks: [],
|
|
16
|
+
playerBanks: [],
|
|
17
|
+
|
|
18
|
+
amount: null,
|
|
19
|
+
selectedHouseBank: null,
|
|
20
|
+
selectedUserBank: null,
|
|
21
|
+
userAccountNumber: null,
|
|
22
|
+
userIfscCode: null,
|
|
23
|
+
userAccountName: null,
|
|
24
|
+
userAccountBranchName: null,
|
|
25
|
+
userAccountBranchCode: null,
|
|
26
|
+
transactionId: null,
|
|
27
|
+
depositTime: null,
|
|
28
|
+
receipt: null,
|
|
29
|
+
|
|
30
|
+
currentCategory: 'manual',
|
|
31
|
+
method: null,
|
|
32
|
+
currentPayment: null,
|
|
33
|
+
currentApplyerBank: null,
|
|
34
|
+
|
|
35
|
+
calculation: null,
|
|
36
|
+
processing: null,
|
|
37
|
+
|
|
38
|
+
// use for wallet mode 3
|
|
39
|
+
promotion: null,
|
|
40
|
+
},
|
|
41
|
+
states: {
|
|
42
|
+
loading: {
|
|
43
|
+
initial: 'init1',
|
|
44
|
+
states: {
|
|
45
|
+
init1: {
|
|
46
|
+
invoke: {
|
|
47
|
+
src: 'fetchPaymentDetail',
|
|
48
|
+
onDone: {
|
|
49
|
+
target: 'init2',
|
|
50
|
+
actions: 'setInitData',
|
|
51
|
+
},
|
|
52
|
+
onError: {
|
|
53
|
+
target: '#manual.fail',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
init2: {
|
|
58
|
+
always: [
|
|
59
|
+
{
|
|
60
|
+
target: '#manual.processing',
|
|
61
|
+
cond: 'isProcessing',
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
invoke: {
|
|
65
|
+
src: 'fetchBanks',
|
|
66
|
+
onDone: {
|
|
67
|
+
target: '#manual.step1',
|
|
68
|
+
actions: 'setBanks',
|
|
69
|
+
},
|
|
70
|
+
onError: {
|
|
71
|
+
target: '#manual.fail',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
step1: {
|
|
78
|
+
initial: 'idle',
|
|
79
|
+
states: {
|
|
80
|
+
idle: {},
|
|
81
|
+
calculating: {
|
|
82
|
+
invoke: {
|
|
83
|
+
src: 'fetchCalculation',
|
|
84
|
+
onDone: {
|
|
85
|
+
target: 'idle',
|
|
86
|
+
actions: 'setCalculation',
|
|
87
|
+
},
|
|
88
|
+
onError: {
|
|
89
|
+
target: 'idle',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
debouncing: {
|
|
94
|
+
after: {
|
|
95
|
+
1000: [{ target: 'calculating', cond: 'isCalculable' }, { target: 'idle' }],
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
on: {
|
|
100
|
+
SET_AMOUNT: {
|
|
101
|
+
actions: ['setAmount', 'clearCalculation'],
|
|
102
|
+
},
|
|
103
|
+
CALCULATE: {
|
|
104
|
+
target: '.debouncing',
|
|
105
|
+
},
|
|
106
|
+
SELECT_HOUSE_BANK: {
|
|
107
|
+
actions: 'setHouseBank',
|
|
108
|
+
},
|
|
109
|
+
CLEAR_CALCULATION: {
|
|
110
|
+
target: '.debouncing',
|
|
111
|
+
actions: 'clearCalculation',
|
|
112
|
+
},
|
|
113
|
+
TRANSACT: {
|
|
114
|
+
target: 'checking',
|
|
115
|
+
cond: 'isCalculated',
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
checking: {
|
|
120
|
+
always: [
|
|
121
|
+
{
|
|
122
|
+
target: 'pending',
|
|
123
|
+
cond: (context, event) => {
|
|
124
|
+
const { calculation, promotion } = context
|
|
125
|
+
const { promotionsNo, activityNo } = promotion
|
|
126
|
+
const isNoBonus = promotionsNo === 'none' || activityNo === 'none'
|
|
127
|
+
return !!calculation && !isNoBonus
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
target: '#manual.step2',
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
},
|
|
135
|
+
pending: {
|
|
136
|
+
on: {
|
|
137
|
+
CONFIRM: {
|
|
138
|
+
target: '#manual.step2',
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
step2: {
|
|
143
|
+
initial: 'idle',
|
|
144
|
+
states: {
|
|
145
|
+
idle: {},
|
|
146
|
+
calculating: {
|
|
147
|
+
invoke: {
|
|
148
|
+
src: 'fetchCalculation',
|
|
149
|
+
onDone: {
|
|
150
|
+
target: 'idle',
|
|
151
|
+
actions: 'setCalculation',
|
|
152
|
+
},
|
|
153
|
+
onError: {
|
|
154
|
+
target: 'idle',
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
debouncing: {
|
|
159
|
+
after: {
|
|
160
|
+
1000: [{ target: 'calculating', cond: 'isCalculable' }, { target: 'idle' }],
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
submitting: {
|
|
164
|
+
invoke: {
|
|
165
|
+
src: 'submitDeposit',
|
|
166
|
+
onDone: {
|
|
167
|
+
target: '#manual.submitted',
|
|
168
|
+
actions: 'setProcessing',
|
|
169
|
+
},
|
|
170
|
+
onError: {
|
|
171
|
+
target: 'idle',
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
on: {
|
|
177
|
+
SET_AMOUNT: {
|
|
178
|
+
actions: ['setAmount', 'clearCalculation'],
|
|
179
|
+
},
|
|
180
|
+
CALCULATE: {
|
|
181
|
+
target: '.debouncing',
|
|
182
|
+
},
|
|
183
|
+
SELECT_HOUSE_BANK: {
|
|
184
|
+
actions: 'setHouseBank',
|
|
185
|
+
},
|
|
186
|
+
SELECT_USER_BANK: {
|
|
187
|
+
actions: 'setUserBank',
|
|
188
|
+
},
|
|
189
|
+
INPUT_USER_ACCOUNT_BRANCH_NAME: {
|
|
190
|
+
actions: 'setUserAccountBranchName',
|
|
191
|
+
},
|
|
192
|
+
INPUT_USER_ACCOUNT_BRANCH_CODE: {
|
|
193
|
+
actions: 'setUserAccountBranchCode',
|
|
194
|
+
},
|
|
195
|
+
INPUT_USER_ACCOUNT_NUMBER: {
|
|
196
|
+
actions: 'setUserAccountNumber',
|
|
197
|
+
},
|
|
198
|
+
INPUT_USER_IFSC_CODE: {
|
|
199
|
+
actions: 'setUserIfscCode',
|
|
200
|
+
},
|
|
201
|
+
INPUT_TRANSACTION_ID: {
|
|
202
|
+
actions: 'setTransactionId',
|
|
203
|
+
},
|
|
204
|
+
INPUT_USER_ACCOUNT_NAME: {
|
|
205
|
+
actions: 'setUserAccountName',
|
|
206
|
+
},
|
|
207
|
+
SET_DEPOSIT_TIME: {
|
|
208
|
+
actions: 'setDepositTime',
|
|
209
|
+
},
|
|
210
|
+
SET_RECEIPT: {
|
|
211
|
+
actions: 'setReceipt',
|
|
212
|
+
},
|
|
213
|
+
CLEAR_CALCULATION: {
|
|
214
|
+
target: '.debouncing',
|
|
215
|
+
actions: 'clearCalculation',
|
|
216
|
+
},
|
|
217
|
+
SUBMIT: {
|
|
218
|
+
target: '.submitting',
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
processing: {},
|
|
223
|
+
submitted: {},
|
|
224
|
+
fail: {},
|
|
225
|
+
},
|
|
226
|
+
on: {
|
|
227
|
+
SET_PROMOTION: {
|
|
228
|
+
actions: 'setPromotion',
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
actions: {
|
|
234
|
+
setInitData: assign((context, event) => {
|
|
235
|
+
const paymentDetail = event.data || []
|
|
236
|
+
const currentPayment = paymentDetail.find((element) => element.category === context.currentCategory)
|
|
237
|
+
const { method, banks = [], processing } = currentPayment || {}
|
|
238
|
+
const houseBanks = banks.map((item) => {
|
|
239
|
+
item.bankCode = item.bankName
|
|
240
|
+
return item
|
|
241
|
+
})
|
|
242
|
+
|
|
243
|
+
return {
|
|
244
|
+
paymentDetail,
|
|
245
|
+
currentPayment,
|
|
246
|
+
method,
|
|
247
|
+
houseBanks,
|
|
248
|
+
selectedHouseBank: houseBanks[0],
|
|
249
|
+
processing: processing?.[0],
|
|
250
|
+
}
|
|
251
|
+
}),
|
|
252
|
+
setBanks: assign((context, event) => {
|
|
253
|
+
const { bindingPaymentInfo = {}, bindingPaymentList = {} } = event.data || {}
|
|
254
|
+
const userBankLsit = bindingPaymentInfo.bankList || []
|
|
255
|
+
const allBankList = bindingPaymentList.bankList || []
|
|
256
|
+
const { currentPayment, houseBanks, selectedHouseBank } = context
|
|
257
|
+
const { banks = [] } = currentPayment
|
|
258
|
+
|
|
259
|
+
const formettedPlayerBanks = userBankLsit.map((bank) => {
|
|
260
|
+
bank.shortName = `${bank.bankCode} ${bank.accountNumber.slice(-5)}`
|
|
261
|
+
bank.imageUrl = allBankList.find((item) => item.bankCode === bank.bankCode)?.imageUrl
|
|
262
|
+
return bank
|
|
263
|
+
})
|
|
264
|
+
const playerBanks = [...formettedPlayerBanks, ...allBankList]
|
|
265
|
+
|
|
266
|
+
const newHouseBanks = houseBanks.map((houseBank) => {
|
|
267
|
+
return { ...houseBank, ...allBankList.find((bank) => houseBank.bankName === bank.bankCode) }
|
|
268
|
+
})
|
|
269
|
+
const newSelectedHouseBank = { ...selectedHouseBank, ...allBankList.find((bank) => selectedHouseBank.bankName === bank.bankCode) }
|
|
270
|
+
|
|
271
|
+
return {
|
|
272
|
+
playerBanks,
|
|
273
|
+
houseBanks: newHouseBanks,
|
|
274
|
+
selectedHouseBank: newSelectedHouseBank,
|
|
275
|
+
selectedUserBank: playerBanks[0],
|
|
276
|
+
userAccountNumber: playerBanks[0].accountNumber,
|
|
277
|
+
userIfscCode: playerBanks[0].ifscCode,
|
|
278
|
+
userAccountName: playerBanks[0].holderName,
|
|
279
|
+
userAccountBranchName: playerBanks[0].branch,
|
|
280
|
+
userAccountBranchCode: playerBanks[0].branchCode,
|
|
281
|
+
}
|
|
282
|
+
}),
|
|
283
|
+
setHouseBank: assign((context, event) => {
|
|
284
|
+
return {
|
|
285
|
+
selectedHouseBank: event.data,
|
|
286
|
+
}
|
|
287
|
+
}),
|
|
288
|
+
setAmount: assign((context, event) => {
|
|
289
|
+
return {
|
|
290
|
+
amount: event.data,
|
|
291
|
+
}
|
|
292
|
+
}),
|
|
293
|
+
setCalculation: assign((context, event) => {
|
|
294
|
+
// V2接口轉換中回傳的資料結構不同
|
|
295
|
+
const { data } = event.data
|
|
296
|
+
if (data) {
|
|
297
|
+
return {
|
|
298
|
+
calculation: data,
|
|
299
|
+
}
|
|
300
|
+
} else {
|
|
301
|
+
return {
|
|
302
|
+
calculation: event.data,
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}),
|
|
306
|
+
setProcessing: assign((context, event) => {
|
|
307
|
+
return {
|
|
308
|
+
processing: event.data,
|
|
309
|
+
}
|
|
310
|
+
}),
|
|
311
|
+
clearCalculation: assign((context, event) => {
|
|
312
|
+
return {
|
|
313
|
+
calculation: null,
|
|
314
|
+
}
|
|
315
|
+
}),
|
|
316
|
+
setUserBank: assign((context, event) => {
|
|
317
|
+
const { accountNumber, ifscCode, holderName, branch, branchCode } = event.data
|
|
318
|
+
return {
|
|
319
|
+
selectedUserBank: event.data,
|
|
320
|
+
userAccountNumber: accountNumber,
|
|
321
|
+
userIfscCode: ifscCode,
|
|
322
|
+
userAccountName: holderName,
|
|
323
|
+
userAccountBranchName: branch,
|
|
324
|
+
userAccountBranchCode: branchCode,
|
|
325
|
+
}
|
|
326
|
+
}),
|
|
327
|
+
setUserAccountBranchName: assign((context, event) => {
|
|
328
|
+
return {
|
|
329
|
+
userAccountBranchName: event.data,
|
|
330
|
+
}
|
|
331
|
+
}),
|
|
332
|
+
setUserAccountBranchCode: assign((context, event) => {
|
|
333
|
+
return {
|
|
334
|
+
userAccountBranchCode: event.data,
|
|
335
|
+
}
|
|
336
|
+
}),
|
|
337
|
+
setUserAccountNumber: assign((context, event) => {
|
|
338
|
+
return {
|
|
339
|
+
userAccountNumber: event.data,
|
|
340
|
+
}
|
|
341
|
+
}),
|
|
342
|
+
setUserIfscCode: assign((context, event) => {
|
|
343
|
+
return {
|
|
344
|
+
userIfscCode: event.data,
|
|
345
|
+
}
|
|
346
|
+
}),
|
|
347
|
+
setTransactionId: assign((context, event) => {
|
|
348
|
+
return {
|
|
349
|
+
transactionId: event.data,
|
|
350
|
+
}
|
|
351
|
+
}),
|
|
352
|
+
setUserAccountName: assign((context, event) => {
|
|
353
|
+
return {
|
|
354
|
+
userAccountName: event.data,
|
|
355
|
+
}
|
|
356
|
+
}),
|
|
357
|
+
setDepositTime: assign((context, event) => {
|
|
358
|
+
return {
|
|
359
|
+
depositTime: event.data,
|
|
360
|
+
}
|
|
361
|
+
}),
|
|
362
|
+
setReceipt: assign((context, event) => {
|
|
363
|
+
return {
|
|
364
|
+
receipt: event.data,
|
|
365
|
+
}
|
|
366
|
+
}),
|
|
367
|
+
setPromotion: assign((context, event) => {
|
|
368
|
+
return {
|
|
369
|
+
promotion: event.data,
|
|
370
|
+
}
|
|
371
|
+
}),
|
|
372
|
+
setPromotionDefaultAmount: assign((context, event) => {
|
|
373
|
+
return {
|
|
374
|
+
amount: context.promotion.minimumAmount,
|
|
375
|
+
}
|
|
376
|
+
}),
|
|
377
|
+
},
|
|
378
|
+
guards: {
|
|
379
|
+
isCalculable: (context, event) => {
|
|
380
|
+
const {
|
|
381
|
+
amount,
|
|
382
|
+
currentPayment: { maximum, minimum },
|
|
383
|
+
} = context
|
|
384
|
+
return amount && minimum <= +amount && +amount <= maximum
|
|
385
|
+
},
|
|
386
|
+
isCalculated: (context, event) => {
|
|
387
|
+
return context.calculation
|
|
388
|
+
},
|
|
389
|
+
isProcessing: (context, event) => {
|
|
390
|
+
return context.processing
|
|
391
|
+
},
|
|
392
|
+
hasMinPromotionDeposit: (context, event) => {
|
|
393
|
+
return context.promotion?.minimumAmount
|
|
394
|
+
},
|
|
395
|
+
},
|
|
396
|
+
services: {
|
|
397
|
+
fetchPaymentDetail: async (context, event) => {
|
|
398
|
+
return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
|
|
399
|
+
},
|
|
400
|
+
fetchBanks: async (context, event) => {
|
|
401
|
+
const [bindingPaymentInfo, bindingPaymentList] = await Promise.all([
|
|
402
|
+
request.send(payment.getBindingPaymentInfo({ appSecret })),
|
|
403
|
+
request.send(payment.getBindingPaymentList({ appSecret })),
|
|
404
|
+
])
|
|
405
|
+
|
|
406
|
+
return { bindingPaymentInfo, bindingPaymentList }
|
|
407
|
+
},
|
|
408
|
+
fetchCalculation: async (context, event) => {
|
|
409
|
+
const { method, amount, promotion } = context
|
|
410
|
+
return await request.send(
|
|
411
|
+
payment.getDepositExpectedResult({
|
|
412
|
+
method,
|
|
413
|
+
amount: Number(amount),
|
|
414
|
+
promotionsNo: promotion?.activityNo,
|
|
415
|
+
})
|
|
416
|
+
)
|
|
417
|
+
},
|
|
418
|
+
submitDeposit: async (context, event) => {
|
|
419
|
+
const {
|
|
420
|
+
method,
|
|
421
|
+
amount,
|
|
422
|
+
selectedHouseBank,
|
|
423
|
+
selectedUserBank,
|
|
424
|
+
userAccountNumber,
|
|
425
|
+
userIfscCode,
|
|
426
|
+
userAccountName,
|
|
427
|
+
userAccountBranchName,
|
|
428
|
+
userAccountBranchCode,
|
|
429
|
+
transactionId,
|
|
430
|
+
depositTime,
|
|
431
|
+
receipt,
|
|
432
|
+
promotion,
|
|
433
|
+
} = context
|
|
434
|
+
return await request.send(
|
|
435
|
+
payment.submitDepositTransactionBank({
|
|
436
|
+
method,
|
|
437
|
+
amount,
|
|
438
|
+
targetBankCode: selectedHouseBank.bankName,
|
|
439
|
+
targetAccountNumber: selectedHouseBank.accountNumber,
|
|
440
|
+
targetIfscCode: selectedHouseBank.ifscCode,
|
|
441
|
+
targetUpi: selectedHouseBank.upi,
|
|
442
|
+
applyerBankCode: selectedUserBank.bankCode,
|
|
443
|
+
applyerAccountNumber: userAccountNumber,
|
|
444
|
+
applyerIfscCode: userIfscCode,
|
|
445
|
+
applyerHolderName: userAccountName,
|
|
446
|
+
applyerBranch: userAccountBranchName,
|
|
447
|
+
applyerBranchCode: userAccountBranchCode,
|
|
448
|
+
transactionId,
|
|
449
|
+
depositTime,
|
|
450
|
+
receipt,
|
|
451
|
+
promotionsNo: promotion?.activityNo,
|
|
452
|
+
})
|
|
453
|
+
)
|
|
454
|
+
},
|
|
455
|
+
},
|
|
456
|
+
}
|
|
457
|
+
)
|
|
458
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assign, createMachine } from 'xstate'
|
|
2
2
|
import payment from '../../api/payment.js'
|
|
3
|
-
import {
|
|
3
|
+
import { max } from '../../util'
|
|
4
4
|
|
|
5
5
|
export default function (request, context) {
|
|
6
6
|
const { paymentDetail = [], promotion, selectedAmount } = context || {}
|
|
@@ -46,7 +46,22 @@ export default function (request, context) {
|
|
|
46
46
|
debouncing: {
|
|
47
47
|
entry: 'clearCalculation',
|
|
48
48
|
after: {
|
|
49
|
-
1000: [
|
|
49
|
+
1000: [
|
|
50
|
+
{
|
|
51
|
+
target: 'calculating',
|
|
52
|
+
cond: (context, event) => {
|
|
53
|
+
const { selectedQrcode, selectedAmount } = context
|
|
54
|
+
if (selectedQrcode && selectedAmount) {
|
|
55
|
+
return selectedQrcode.minimum <= selectedAmount && selectedAmount <= selectedQrcode.maximum
|
|
56
|
+
} else {
|
|
57
|
+
return false
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
target: 'loaded',
|
|
63
|
+
},
|
|
64
|
+
],
|
|
50
65
|
},
|
|
51
66
|
},
|
|
52
67
|
calculating: {
|
|
@@ -65,7 +80,6 @@ export default function (request, context) {
|
|
|
65
80
|
on: {
|
|
66
81
|
SUBMIT: {
|
|
67
82
|
target: 'submitting',
|
|
68
|
-
cond: 'isSubmittable',
|
|
69
83
|
},
|
|
70
84
|
},
|
|
71
85
|
},
|
|
@@ -88,7 +102,6 @@ export default function (request, context) {
|
|
|
88
102
|
target: '.debouncing',
|
|
89
103
|
actions: 'setPromotion',
|
|
90
104
|
internal: false,
|
|
91
|
-
cond: 'isPromotionChanged',
|
|
92
105
|
},
|
|
93
106
|
SELECT_QRCODE: {
|
|
94
107
|
target: '.debouncing',
|
|
@@ -110,7 +123,7 @@ export default function (request, context) {
|
|
|
110
123
|
{
|
|
111
124
|
actions: {
|
|
112
125
|
setInitData: assign((context, event) => {
|
|
113
|
-
const { paymentDetail } = context
|
|
126
|
+
const { paymentDetail, selectedAmount, promotion } = context
|
|
114
127
|
const qrcodes = paymentDetail.filter((element) => element.category === context.currentCategory && element.transferType === 'deposit')
|
|
115
128
|
const selectedQrcode = qrcodes[0]
|
|
116
129
|
return {
|
|
@@ -118,22 +131,30 @@ export default function (request, context) {
|
|
|
118
131
|
qrcodes,
|
|
119
132
|
selectedQrcode,
|
|
120
133
|
options: selectedQrcode?.optional,
|
|
134
|
+
selectedAmount: max(promotion?.minimumAmount, selectedQrcode?.minimum, selectedAmount, 0),
|
|
121
135
|
}
|
|
122
136
|
}),
|
|
123
137
|
setPromotion: assign((context, event) => {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
138
|
+
const { selectedAmount } = context
|
|
139
|
+
const promotion = event.data
|
|
140
|
+
const qrcodes = context.qrcodes
|
|
141
|
+
const selectedQrcode = qrcodes[0]
|
|
127
142
|
return {
|
|
128
|
-
promotion
|
|
143
|
+
promotion,
|
|
144
|
+
qrcodes,
|
|
145
|
+
selectedQrcode,
|
|
146
|
+
options: selectedQrcode?.optional,
|
|
147
|
+
selectedAmount: max(promotion.minimumAmount, selectedQrcode?.minimum, selectedAmount, 0),
|
|
129
148
|
calculation: null,
|
|
130
149
|
}
|
|
131
150
|
}),
|
|
132
151
|
setQrcode: assign((context, event) => {
|
|
152
|
+
const { promotion, selectedAmount } = context
|
|
133
153
|
const selectedQrcode = event.data
|
|
134
154
|
return {
|
|
135
155
|
selectedQrcode,
|
|
136
156
|
options: selectedQrcode.optional,
|
|
157
|
+
selectedAmount: max(promotion.minimumAmount, selectedAmount, 0),
|
|
137
158
|
calculation: null,
|
|
138
159
|
}
|
|
139
160
|
}),
|
|
@@ -173,14 +194,9 @@ export default function (request, context) {
|
|
|
173
194
|
}),
|
|
174
195
|
},
|
|
175
196
|
guards: {
|
|
176
|
-
isPromotionChanged: (context, event) => {
|
|
177
|
-
return event.data?.promotionsNo !== context.promotion?.promotionsNo
|
|
178
|
-
},
|
|
179
197
|
hasQrcodeMethods: (context, event) => {
|
|
180
198
|
return context.paymentDetail?.filter((element) => element.category === context.currentCategory).length > 0
|
|
181
199
|
},
|
|
182
|
-
isCalculable: ({ selectedQrcode, selectedAmount }) => isAmountInRange(selectedAmount, selectedQrcode),
|
|
183
|
-
isSubmittable: ({ selectedQrcode, selectedAmount }) => isAmountInRange(selectedAmount, selectedQrcode),
|
|
184
200
|
},
|
|
185
201
|
services: {
|
|
186
202
|
fetchCalculation: async (context, event) => {
|