@jetthai/cuora 1.1.16 → 1.1.18
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 +4 -0
- package/dist/bundle.mjs +223 -67
- package/package.json +1 -1
- package/src/api/payment.js +8 -4
- package/src/machine/bank_binding_amb.js +0 -1
- package/src/machine/promotions.js +34 -18
- package/src/machine/reward.js +59 -1
- package/src/machine/withdraw_amb.js +13 -13
- package/src/machine/withdraw_vn.js +110 -31
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.18](https://github.com/jetthai/cuora-module/compare/v1.1.17...v1.1.18) (2022-12-28)
|
|
6
|
+
|
|
7
|
+
### [1.1.17](https://github.com/jetthai/cuora-module/compare/v1.1.16...v1.1.17) (2022-12-28)
|
|
8
|
+
|
|
5
9
|
### [1.1.16](https://github.com/jetthai/cuora-module/compare/v1.1.13-4...v1.1.16) (2022-12-28)
|
|
6
10
|
|
|
7
11
|
### [1.1.15](https://github.com/jetthai/cuora-module/compare/v1.1.14...v1.1.15) (2022-12-24)
|
package/dist/bundle.mjs
CHANGED
|
@@ -3846,14 +3846,18 @@ var payment = {
|
|
|
3846
3846
|
params: { transferType: 'WITHDRAW', amount },
|
|
3847
3847
|
}),
|
|
3848
3848
|
getPromotionsList: () => ({ url: `payment/v2/bankWallet/promotions`, method: 'get' }),
|
|
3849
|
+
getWithdrawRulePreview: ({ applyType, applyNo, amount }) => ({
|
|
3850
|
+
url: `payment/v2/bankWallet/promotion/preview`,
|
|
3851
|
+
method: 'post',
|
|
3852
|
+
params: { applyType, applyNo, amount },
|
|
3853
|
+
}),
|
|
3849
3854
|
applyPromotions: ({ promotionsNo, amount }) => ({
|
|
3850
3855
|
url: `payment/v2/bankWallet/promotion/apply`,
|
|
3851
3856
|
method: 'post',
|
|
3852
|
-
params: {
|
|
3853
|
-
promotionsNo,
|
|
3854
|
-
amount,
|
|
3855
|
-
},
|
|
3857
|
+
params: { promotionsNo, amount },
|
|
3856
3858
|
}),
|
|
3859
|
+
giveUp: () => ({ url: 'payment/v2/bankWallet/promotion/giveUp', method: 'post' }),
|
|
3860
|
+
restore: ({ amount }) => ({ url: 'payment/v2/bankWallet/restore', method: 'post', params: { amount } }),
|
|
3857
3861
|
};
|
|
3858
3862
|
|
|
3859
3863
|
var user = {
|
|
@@ -13007,6 +13011,15 @@ function reward (request) {
|
|
|
13007
13011
|
otherRewardList: [],
|
|
13008
13012
|
pointsRewardList: [],
|
|
13009
13013
|
rewardList: [],
|
|
13014
|
+
activityNo: null,
|
|
13015
|
+
receiveNo: null,
|
|
13016
|
+
turnoverLimitStatus: 'NEW',
|
|
13017
|
+
originalTurnoverLimit: 0,
|
|
13018
|
+
originalMaxWithdrawAmount: 0,
|
|
13019
|
+
originalLimitGameDetail: [],
|
|
13020
|
+
newTurnoverLimit: 0,
|
|
13021
|
+
newMaxWithdrawAmount: 0,
|
|
13022
|
+
newLimitGameDetail: [],
|
|
13010
13023
|
callback: () => {},
|
|
13011
13024
|
},
|
|
13012
13025
|
states: {
|
|
@@ -13042,6 +13055,10 @@ function reward (request) {
|
|
|
13042
13055
|
states: {
|
|
13043
13056
|
idle: {
|
|
13044
13057
|
on: {
|
|
13058
|
+
FETCH_WITHDRAW_RULE: {
|
|
13059
|
+
target: 'fetching',
|
|
13060
|
+
actions: 'setRewardData',
|
|
13061
|
+
},
|
|
13045
13062
|
RECEIVE_REWARD: {
|
|
13046
13063
|
target: 'receiving',
|
|
13047
13064
|
actions: 'setCallback',
|
|
@@ -13052,11 +13069,33 @@ function reward (request) {
|
|
|
13052
13069
|
},
|
|
13053
13070
|
},
|
|
13054
13071
|
},
|
|
13072
|
+
fetching: {
|
|
13073
|
+
invoke: {
|
|
13074
|
+
src: 'fetchWithdrawRulePreview',
|
|
13075
|
+
onDone: {
|
|
13076
|
+
target: 'pending',
|
|
13077
|
+
actions: 'setWithdrawRulePreview',
|
|
13078
|
+
},
|
|
13079
|
+
onError: {
|
|
13080
|
+
target: 'idle',
|
|
13081
|
+
},
|
|
13082
|
+
},
|
|
13083
|
+
},
|
|
13084
|
+
pending: {
|
|
13085
|
+
on: {
|
|
13086
|
+
RECEIVE_REWARD: {
|
|
13087
|
+
target: 'receiving',
|
|
13088
|
+
},
|
|
13089
|
+
BACK: {
|
|
13090
|
+
target: 'idle',
|
|
13091
|
+
},
|
|
13092
|
+
},
|
|
13093
|
+
},
|
|
13055
13094
|
receiving: {
|
|
13056
13095
|
invoke: {
|
|
13057
13096
|
src: 'receiveReward',
|
|
13058
13097
|
onDone: {
|
|
13059
|
-
target: '
|
|
13098
|
+
target: 'received',
|
|
13060
13099
|
actions: [send({ type: 'REFRESH' }), 'doCallback'],
|
|
13061
13100
|
},
|
|
13062
13101
|
onError: {
|
|
@@ -13064,6 +13103,11 @@ function reward (request) {
|
|
|
13064
13103
|
},
|
|
13065
13104
|
},
|
|
13066
13105
|
},
|
|
13106
|
+
received: {
|
|
13107
|
+
0: {
|
|
13108
|
+
target: 'idle',
|
|
13109
|
+
},
|
|
13110
|
+
},
|
|
13067
13111
|
allPointsReceiving: {
|
|
13068
13112
|
invoke: {
|
|
13069
13113
|
src: 'receiveAllPoints',
|
|
@@ -13089,6 +13133,13 @@ function reward (request) {
|
|
|
13089
13133
|
rewardList: event.data[2]?.data || [],
|
|
13090
13134
|
}
|
|
13091
13135
|
}),
|
|
13136
|
+
setRewardData: assign((context, event) => {
|
|
13137
|
+
const { activityNo, receiveNo } = event.data;
|
|
13138
|
+
return {
|
|
13139
|
+
activityNo,
|
|
13140
|
+
receiveNo,
|
|
13141
|
+
}
|
|
13142
|
+
}),
|
|
13092
13143
|
setCallback: assign((context, event) => {
|
|
13093
13144
|
return {
|
|
13094
13145
|
callback: event.data?.callback || (() => {}),
|
|
@@ -13097,6 +13148,11 @@ function reward (request) {
|
|
|
13097
13148
|
doCallback: (context, event) => {
|
|
13098
13149
|
context.callback();
|
|
13099
13150
|
},
|
|
13151
|
+
setWithdrawRulePreview: (context, event) => {
|
|
13152
|
+
return {
|
|
13153
|
+
...event.data,
|
|
13154
|
+
}
|
|
13155
|
+
},
|
|
13100
13156
|
},
|
|
13101
13157
|
services: {
|
|
13102
13158
|
fetchRewardList: async (context, event) => {
|
|
@@ -13106,6 +13162,11 @@ function reward (request) {
|
|
|
13106
13162
|
const [otherRewardList, pointsRewardList, rewardList] = await Promise.all([getOtherRewardAPI, getPointsRewardAPI, getRewardAPI]);
|
|
13107
13163
|
return [otherRewardList, pointsRewardList, rewardList]
|
|
13108
13164
|
},
|
|
13165
|
+
fetchWithdrawRulePreview: async (context, event) => {
|
|
13166
|
+
const { receiveNo } = context;
|
|
13167
|
+
const { data } = await request.send(payment.getWithdrawRulePreview({ applyType: 'activity', applyNo: receiveNo, amount: null }));
|
|
13168
|
+
return data
|
|
13169
|
+
},
|
|
13109
13170
|
receiveReward: async (context, event) => {
|
|
13110
13171
|
const { activityNo, receiveNo, attended } = event.data;
|
|
13111
13172
|
return await request.send(activity$2.getReward({ activityNo, receiveNo, appSecret, attended }))
|
|
@@ -14075,7 +14136,6 @@ function bank_binding_amb (request) {
|
|
|
14075
14136
|
on: {
|
|
14076
14137
|
SET_BANK_CODE: {
|
|
14077
14138
|
actions: assign((context, event) => {
|
|
14078
|
-
console.log(event.data);
|
|
14079
14139
|
return {
|
|
14080
14140
|
bank: event.data,
|
|
14081
14141
|
}
|
|
@@ -14721,6 +14781,9 @@ function withdraw_vn (request) {
|
|
|
14721
14781
|
bankList: [],
|
|
14722
14782
|
withdrawLimit: null,
|
|
14723
14783
|
targetWithdrawLimit: null,
|
|
14784
|
+
attachmentType: null, // 'withdraw' or 'pool'
|
|
14785
|
+
maximumWithdrawAmount: 0,
|
|
14786
|
+
enableWithdrawAmount: 0,
|
|
14724
14787
|
|
|
14725
14788
|
amount: null,
|
|
14726
14789
|
bank: null,
|
|
@@ -14771,17 +14834,67 @@ function withdraw_vn (request) {
|
|
|
14771
14834
|
checking: {
|
|
14772
14835
|
always: [{ target: 'convertible', cond: 'isConvertible' }, { target: 'notConvertible' }],
|
|
14773
14836
|
},
|
|
14774
|
-
notConvertible: {
|
|
14837
|
+
notConvertible: {
|
|
14838
|
+
on: {
|
|
14839
|
+
GIVE_UP: {
|
|
14840
|
+
target: 'givingUp',
|
|
14841
|
+
},
|
|
14842
|
+
},
|
|
14843
|
+
},
|
|
14844
|
+
givingUp: {
|
|
14845
|
+
invoke: {
|
|
14846
|
+
src: 'giveUp',
|
|
14847
|
+
onDone: {
|
|
14848
|
+
target: 'gaveUp',
|
|
14849
|
+
},
|
|
14850
|
+
onError: {
|
|
14851
|
+
target: 'convertible',
|
|
14852
|
+
},
|
|
14853
|
+
},
|
|
14854
|
+
},
|
|
14855
|
+
gaveUp: {},
|
|
14775
14856
|
convertible: {
|
|
14776
14857
|
on: {
|
|
14777
14858
|
SUBMIT: {
|
|
14778
14859
|
target: 'converting',
|
|
14779
14860
|
},
|
|
14861
|
+
ATTACH: {
|
|
14862
|
+
target: 'attachment',
|
|
14863
|
+
actions: 'setAttachmentType',
|
|
14864
|
+
},
|
|
14865
|
+
},
|
|
14866
|
+
},
|
|
14867
|
+
attachment: {
|
|
14868
|
+
on: {
|
|
14869
|
+
SET_ATTACHMENT_TYPE: {
|
|
14870
|
+
actions: 'setAttachmentType',
|
|
14871
|
+
},
|
|
14872
|
+
SET_CURRENT_BANK: {
|
|
14873
|
+
actions: assign((context, event) => {
|
|
14874
|
+
return {
|
|
14875
|
+
bank: event.data,
|
|
14876
|
+
}
|
|
14877
|
+
}),
|
|
14878
|
+
},
|
|
14879
|
+
SET_AMOUNT: {
|
|
14880
|
+
actions: assign((context, event) => {
|
|
14881
|
+
return {
|
|
14882
|
+
amount: event.data,
|
|
14883
|
+
}
|
|
14884
|
+
}),
|
|
14885
|
+
},
|
|
14886
|
+
SUBMIT: {
|
|
14887
|
+
target: 'converting',
|
|
14888
|
+
cond: (context, event) => {
|
|
14889
|
+
const { enableWithdrawAmount, amount } = context;
|
|
14890
|
+
return +enableWithdrawAmount >= +amount
|
|
14891
|
+
},
|
|
14892
|
+
},
|
|
14780
14893
|
},
|
|
14781
14894
|
},
|
|
14782
14895
|
converting: {
|
|
14783
14896
|
invoke: {
|
|
14784
|
-
src: '
|
|
14897
|
+
src: 'convertFreeCredit',
|
|
14785
14898
|
onDone: [
|
|
14786
14899
|
{
|
|
14787
14900
|
target: '#withdraw_vn.otp',
|
|
@@ -14795,7 +14908,22 @@ function withdraw_vn (request) {
|
|
|
14795
14908
|
},
|
|
14796
14909
|
},
|
|
14797
14910
|
},
|
|
14798
|
-
converted: {
|
|
14911
|
+
converted: {
|
|
14912
|
+
always: [
|
|
14913
|
+
{ target: '#withdraw_vn.cash.submitting', cond: 'shouldGoToWithdraw' },
|
|
14914
|
+
{ target: 'pooling', cond: 'shouldGoToPool' },
|
|
14915
|
+
],
|
|
14916
|
+
},
|
|
14917
|
+
pooling: {
|
|
14918
|
+
invoke: {
|
|
14919
|
+
src: 'pool',
|
|
14920
|
+
onDone: { target: 'pooled' },
|
|
14921
|
+
onError: {
|
|
14922
|
+
target: 'pooled',
|
|
14923
|
+
},
|
|
14924
|
+
},
|
|
14925
|
+
},
|
|
14926
|
+
pooled: {},
|
|
14799
14927
|
},
|
|
14800
14928
|
},
|
|
14801
14929
|
cash: {
|
|
@@ -14951,6 +15079,7 @@ function withdraw_vn (request) {
|
|
|
14951
15079
|
return {
|
|
14952
15080
|
paymentDetail: event.data.paymentDetail,
|
|
14953
15081
|
bankInfo: event.data.bankInfo,
|
|
15082
|
+
bank: event.data.bankInfo[0],
|
|
14954
15083
|
bonus: event.data.bonus,
|
|
14955
15084
|
bankList: event.data.bankList,
|
|
14956
15085
|
}
|
|
@@ -14977,30 +15106,15 @@ function withdraw_vn (request) {
|
|
|
14977
15106
|
}
|
|
14978
15107
|
}),
|
|
14979
15108
|
updateWithdrawCondition: assign((context, event) => {
|
|
14980
|
-
const
|
|
14981
|
-
|
|
14982
|
-
const { balance, withdrawLimit } = context;
|
|
14983
|
-
const lastMatchedIndex = findLastIndex_1(rules, (rule) => balance >= rule.greaterEqualThen);
|
|
14984
|
-
|
|
14985
|
-
let maxWithdrawAmount = 0,
|
|
14986
|
-
availableWithdrawAmount = 0;
|
|
14987
|
-
|
|
14988
|
-
if (lastMatchedIndex > -1) {
|
|
14989
|
-
rules[lastMatchedIndex].match = true;
|
|
14990
|
-
maxWithdrawAmount = rules[lastMatchedIndex].maxWithdrawAmount;
|
|
14991
|
-
|
|
14992
|
-
if (withdrawLimit === 0) {
|
|
14993
|
-
availableWithdrawAmount = Math.min(balance, maxWithdrawAmount);
|
|
14994
|
-
}
|
|
14995
|
-
} else if (rules.length > 0) {
|
|
14996
|
-
maxWithdrawAmount = rules[0].maxWithdrawAmount;
|
|
14997
|
-
} else {
|
|
14998
|
-
maxWithdrawAmount = balance;
|
|
14999
|
-
}
|
|
15109
|
+
const { differAmountLimit, enableWithdraw, enableWithdrawAmount, maxWithdrawStatus, maximumWithdrawAmount, minimumWithdrawAmount } =
|
|
15110
|
+
event.data;
|
|
15000
15111
|
|
|
15001
15112
|
return {
|
|
15002
|
-
maxWithdrawAmount,
|
|
15003
|
-
availableWithdrawAmount,
|
|
15113
|
+
// maxWithdrawAmount: maximumWithdrawAmount,
|
|
15114
|
+
// availableWithdrawAmount: enableWithdrawAmount,
|
|
15115
|
+
maximumWithdrawAmount,
|
|
15116
|
+
enableWithdrawAmount,
|
|
15117
|
+
amount: +enableWithdrawAmount,
|
|
15004
15118
|
}
|
|
15005
15119
|
}),
|
|
15006
15120
|
setOtp: assign((context, event) => {
|
|
@@ -15026,11 +15140,22 @@ function withdraw_vn (request) {
|
|
|
15026
15140
|
target,
|
|
15027
15141
|
}
|
|
15028
15142
|
}),
|
|
15143
|
+
setAttachmentType: assign((context, event) => {
|
|
15144
|
+
return {
|
|
15145
|
+
attachmentType: event.data,
|
|
15146
|
+
}
|
|
15147
|
+
}),
|
|
15029
15148
|
},
|
|
15030
15149
|
guards: {
|
|
15031
15150
|
isFree: (context, event) => {
|
|
15032
15151
|
return context.userInfo?.withdraw_rule !== 'DEFAULT'
|
|
15033
15152
|
},
|
|
15153
|
+
shouldGoToWithdraw: (context, event) => {
|
|
15154
|
+
return context.attachmentType === 'withdraw'
|
|
15155
|
+
},
|
|
15156
|
+
shouldGoToPool: (context, event) => {
|
|
15157
|
+
return context.attachmentType === 'pool'
|
|
15158
|
+
},
|
|
15034
15159
|
haveProcessing: (context, event) => {
|
|
15035
15160
|
return (context.paymentDetail?.[0]?.processing || []).length > 0
|
|
15036
15161
|
},
|
|
@@ -15043,8 +15168,8 @@ function withdraw_vn (request) {
|
|
|
15043
15168
|
return !context.bankInfo?.length
|
|
15044
15169
|
},
|
|
15045
15170
|
isSubmittable: (context, event) => {
|
|
15046
|
-
const {
|
|
15047
|
-
return
|
|
15171
|
+
const { bank, amount } = context;
|
|
15172
|
+
return bank && amount
|
|
15048
15173
|
},
|
|
15049
15174
|
isConvertible: (context, event) => {
|
|
15050
15175
|
const { balance, withdrawLimit } = context;
|
|
@@ -15095,14 +15220,21 @@ function withdraw_vn (request) {
|
|
|
15095
15220
|
return await request.send(payment.getCurrentWithdrawRule())
|
|
15096
15221
|
},
|
|
15097
15222
|
submitWithdraw: async (context, event) => {
|
|
15098
|
-
const {
|
|
15223
|
+
const { bank, amount } = context;
|
|
15099
15224
|
const { method } = context.paymentDetail[0];
|
|
15100
|
-
const branchTemp =
|
|
15225
|
+
const branchTemp = bank.bankCode === 'GCASH' ? '' : bank.branch;
|
|
15101
15226
|
return await request.send(
|
|
15102
|
-
payment.submitWithdrawTransactionVN({
|
|
15227
|
+
payment.submitWithdrawTransactionVN({
|
|
15228
|
+
method,
|
|
15229
|
+
amount,
|
|
15230
|
+
applyerBankCode: bank.bankCode,
|
|
15231
|
+
applyerAccountNumber: bank.accountNumber,
|
|
15232
|
+
branch: branchTemp,
|
|
15233
|
+
holderName: bank.holderName,
|
|
15234
|
+
})
|
|
15103
15235
|
)
|
|
15104
15236
|
},
|
|
15105
|
-
|
|
15237
|
+
convertFreeCredit: async (context, event) => {
|
|
15106
15238
|
return await request.send(payment.convertFreeCredit({ exchangeType: 1 }))
|
|
15107
15239
|
},
|
|
15108
15240
|
resetOtp: async (context, event) => {
|
|
@@ -15114,6 +15246,13 @@ function withdraw_vn (request) {
|
|
|
15114
15246
|
const code = event.data;
|
|
15115
15247
|
return await request.send(user.otpAcknowledge({ requestId, target, code }))
|
|
15116
15248
|
},
|
|
15249
|
+
pool: async (context, event) => {
|
|
15250
|
+
const { amount } = context;
|
|
15251
|
+
return await request.send(payment.restore({ amount }))
|
|
15252
|
+
},
|
|
15253
|
+
giveUp: async (context, event) => {
|
|
15254
|
+
return await request.send(payment.giveUp())
|
|
15255
|
+
},
|
|
15117
15256
|
},
|
|
15118
15257
|
}
|
|
15119
15258
|
)
|
|
@@ -15619,20 +15758,20 @@ function withdraw_amb (request) {
|
|
|
15619
15758
|
always: [{ target: 'free', cond: 'isFree' }, { target: 'cash' }],
|
|
15620
15759
|
},
|
|
15621
15760
|
free: {
|
|
15622
|
-
initial: '
|
|
15761
|
+
initial: 'checking',
|
|
15623
15762
|
states: {
|
|
15624
|
-
loading: {
|
|
15625
|
-
|
|
15626
|
-
|
|
15627
|
-
|
|
15628
|
-
|
|
15629
|
-
|
|
15630
|
-
|
|
15631
|
-
|
|
15632
|
-
|
|
15633
|
-
|
|
15634
|
-
|
|
15635
|
-
},
|
|
15763
|
+
// loading: {
|
|
15764
|
+
// invoke: {
|
|
15765
|
+
// src: 'fetchWithdrawRules',
|
|
15766
|
+
// onDone: {
|
|
15767
|
+
// target: 'checking',
|
|
15768
|
+
// actions: 'updateWithdrawCondition',
|
|
15769
|
+
// },
|
|
15770
|
+
// onError: {
|
|
15771
|
+
// target: 'notConvertible',
|
|
15772
|
+
// },
|
|
15773
|
+
// },
|
|
15774
|
+
// },
|
|
15636
15775
|
checking: {
|
|
15637
15776
|
always: [{ target: 'convertible', cond: 'isConvertible' }, { target: 'notConvertible' }],
|
|
15638
15777
|
},
|
|
@@ -20134,11 +20273,15 @@ function promotions (request) {
|
|
|
20134
20273
|
withdrawLimitDetail: [],
|
|
20135
20274
|
limitGameDetail: [],
|
|
20136
20275
|
},
|
|
20137
|
-
|
|
20138
|
-
|
|
20276
|
+
turnoverLimitStatus: '',
|
|
20277
|
+
originalTurnoverLimit: 0,
|
|
20278
|
+
originalMaxWithdrawAmount: 0,
|
|
20279
|
+
originalLimitGameDetail: [],
|
|
20280
|
+
newTurnoverLimit: 0,
|
|
20281
|
+
newMaxWithdrawAmount: 0,
|
|
20282
|
+
newLimitGameDetail: [],
|
|
20139
20283
|
promotionsList: [],
|
|
20140
20284
|
selectedPromo: {},
|
|
20141
|
-
joinedPromotion: null,
|
|
20142
20285
|
},
|
|
20143
20286
|
states: {
|
|
20144
20287
|
loading: {
|
|
@@ -20162,13 +20305,24 @@ function promotions (request) {
|
|
|
20162
20305
|
actions: 'setAmount',
|
|
20163
20306
|
},
|
|
20164
20307
|
JOIN: {
|
|
20165
|
-
target: '
|
|
20308
|
+
target: 'fetching',
|
|
20166
20309
|
cond: 'isValidAmount',
|
|
20167
20310
|
},
|
|
20168
20311
|
},
|
|
20169
20312
|
},
|
|
20170
|
-
|
|
20171
|
-
|
|
20313
|
+
fetching: {
|
|
20314
|
+
invoke: {
|
|
20315
|
+
src: 'fetchWithdrawRulePreview',
|
|
20316
|
+
onDone: {
|
|
20317
|
+
target: 'pending',
|
|
20318
|
+
actions: 'setWithdrawRulePreview',
|
|
20319
|
+
},
|
|
20320
|
+
onError: {
|
|
20321
|
+
target: 'loaded',
|
|
20322
|
+
},
|
|
20323
|
+
},
|
|
20324
|
+
},
|
|
20325
|
+
pending: {
|
|
20172
20326
|
on: {
|
|
20173
20327
|
CONFIRM: {
|
|
20174
20328
|
target: 'joinning',
|
|
@@ -20196,11 +20350,10 @@ function promotions (request) {
|
|
|
20196
20350
|
{
|
|
20197
20351
|
actions: {
|
|
20198
20352
|
setInitData: assign((context, event) => {
|
|
20199
|
-
const {
|
|
20353
|
+
const { promotionsList } = event.data;
|
|
20200
20354
|
const { noBonus } = context;
|
|
20201
20355
|
return {
|
|
20202
20356
|
promotionsList,
|
|
20203
|
-
userInfo,
|
|
20204
20357
|
selectedPromo: noBonus,
|
|
20205
20358
|
}
|
|
20206
20359
|
}),
|
|
@@ -20214,17 +20367,14 @@ function promotions (request) {
|
|
|
20214
20367
|
amount: event.data,
|
|
20215
20368
|
}
|
|
20216
20369
|
}),
|
|
20217
|
-
|
|
20370
|
+
setWithdrawRulePreview: assign((context, event) => {
|
|
20218
20371
|
return {
|
|
20219
|
-
|
|
20372
|
+
...event.data,
|
|
20220
20373
|
}
|
|
20221
20374
|
}),
|
|
20222
|
-
|
|
20223
|
-
const { userInfo, selectedPromo, amount } = context;
|
|
20224
|
-
const { turnoverLimitMultiple } = selectedPromo;
|
|
20375
|
+
reset: assign((context, event) => {
|
|
20225
20376
|
return {
|
|
20226
|
-
|
|
20227
|
-
newTargetTurnoverLimit: parseFloat(`${amount}`) * parseFloat(`${turnoverLimitMultiple}`),
|
|
20377
|
+
amount: null,
|
|
20228
20378
|
}
|
|
20229
20379
|
}),
|
|
20230
20380
|
},
|
|
@@ -20236,8 +20386,14 @@ function promotions (request) {
|
|
|
20236
20386
|
},
|
|
20237
20387
|
services: {
|
|
20238
20388
|
fetchInitData: async (context, event) => {
|
|
20239
|
-
|
|
20240
|
-
|
|
20389
|
+
return await request.send(payment.getPromotionsList())
|
|
20390
|
+
},
|
|
20391
|
+
fetchWithdrawRulePreview: async (context, event) => {
|
|
20392
|
+
const { selectedPromo, amount } = context;
|
|
20393
|
+
const { data } = await request.send(
|
|
20394
|
+
payment.getWithdrawRulePreview({ applyType: 'promotions', applyNo: selectedPromo.promotionsNo, amount: parseFloat(amount) })
|
|
20395
|
+
);
|
|
20396
|
+
return data
|
|
20241
20397
|
},
|
|
20242
20398
|
applyPromotion: async (context, event) => {
|
|
20243
20399
|
const { selectedPromo, amount } = context;
|
package/package.json
CHANGED
package/src/api/payment.js
CHANGED
|
@@ -115,12 +115,16 @@ export default {
|
|
|
115
115
|
params: { transferType: 'WITHDRAW', amount },
|
|
116
116
|
}),
|
|
117
117
|
getPromotionsList: () => ({ url: `payment/v2/bankWallet/promotions`, method: 'get' }),
|
|
118
|
+
getWithdrawRulePreview: ({ applyType, applyNo, amount }) => ({
|
|
119
|
+
url: `payment/v2/bankWallet/promotion/preview`,
|
|
120
|
+
method: 'post',
|
|
121
|
+
params: { applyType, applyNo, amount },
|
|
122
|
+
}),
|
|
118
123
|
applyPromotions: ({ promotionsNo, amount }) => ({
|
|
119
124
|
url: `payment/v2/bankWallet/promotion/apply`,
|
|
120
125
|
method: 'post',
|
|
121
|
-
params: {
|
|
122
|
-
promotionsNo,
|
|
123
|
-
amount,
|
|
124
|
-
},
|
|
126
|
+
params: { promotionsNo, amount },
|
|
125
127
|
}),
|
|
128
|
+
giveUp: () => ({ url: 'payment/v2/bankWallet/promotion/giveUp', method: 'post' }),
|
|
129
|
+
restore: ({ amount }) => ({ url: 'payment/v2/bankWallet/restore', method: 'post', params: { amount } }),
|
|
126
130
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { assign, createMachine } from 'xstate'
|
|
2
2
|
import payment from '../api/payment.js'
|
|
3
|
-
import user from '../api/user.js'
|
|
4
3
|
|
|
5
4
|
export default function (request) {
|
|
6
5
|
return createMachine(
|
|
@@ -24,11 +23,15 @@ export default function (request) {
|
|
|
24
23
|
withdrawLimitDetail: [],
|
|
25
24
|
limitGameDetail: [],
|
|
26
25
|
},
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
turnoverLimitStatus: '',
|
|
27
|
+
originalTurnoverLimit: 0,
|
|
28
|
+
originalMaxWithdrawAmount: 0,
|
|
29
|
+
originalLimitGameDetail: [],
|
|
30
|
+
newTurnoverLimit: 0,
|
|
31
|
+
newMaxWithdrawAmount: 0,
|
|
32
|
+
newLimitGameDetail: [],
|
|
29
33
|
promotionsList: [],
|
|
30
34
|
selectedPromo: {},
|
|
31
|
-
joinedPromotion: null,
|
|
32
35
|
},
|
|
33
36
|
states: {
|
|
34
37
|
loading: {
|
|
@@ -52,13 +55,24 @@ export default function (request) {
|
|
|
52
55
|
actions: 'setAmount',
|
|
53
56
|
},
|
|
54
57
|
JOIN: {
|
|
55
|
-
target: '
|
|
58
|
+
target: 'fetching',
|
|
56
59
|
cond: 'isValidAmount',
|
|
57
60
|
},
|
|
58
61
|
},
|
|
59
62
|
},
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
fetching: {
|
|
64
|
+
invoke: {
|
|
65
|
+
src: 'fetchWithdrawRulePreview',
|
|
66
|
+
onDone: {
|
|
67
|
+
target: 'pending',
|
|
68
|
+
actions: 'setWithdrawRulePreview',
|
|
69
|
+
},
|
|
70
|
+
onError: {
|
|
71
|
+
target: 'loaded',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
pending: {
|
|
62
76
|
on: {
|
|
63
77
|
CONFIRM: {
|
|
64
78
|
target: 'joinning',
|
|
@@ -86,11 +100,10 @@ export default function (request) {
|
|
|
86
100
|
{
|
|
87
101
|
actions: {
|
|
88
102
|
setInitData: assign((context, event) => {
|
|
89
|
-
const {
|
|
103
|
+
const { promotionsList } = event.data
|
|
90
104
|
const { noBonus } = context
|
|
91
105
|
return {
|
|
92
106
|
promotionsList,
|
|
93
|
-
userInfo,
|
|
94
107
|
selectedPromo: noBonus,
|
|
95
108
|
}
|
|
96
109
|
}),
|
|
@@ -104,17 +117,14 @@ export default function (request) {
|
|
|
104
117
|
amount: event.data,
|
|
105
118
|
}
|
|
106
119
|
}),
|
|
107
|
-
|
|
120
|
+
setWithdrawRulePreview: assign((context, event) => {
|
|
108
121
|
return {
|
|
109
|
-
|
|
122
|
+
...event.data,
|
|
110
123
|
}
|
|
111
124
|
}),
|
|
112
|
-
|
|
113
|
-
const { userInfo, selectedPromo, amount } = context
|
|
114
|
-
const { turnoverLimitMultiple } = selectedPromo
|
|
125
|
+
reset: assign((context, event) => {
|
|
115
126
|
return {
|
|
116
|
-
|
|
117
|
-
newTargetTurnoverLimit: parseFloat(`${amount}`) * parseFloat(`${turnoverLimitMultiple}`),
|
|
127
|
+
amount: null,
|
|
118
128
|
}
|
|
119
129
|
}),
|
|
120
130
|
},
|
|
@@ -126,8 +136,14 @@ export default function (request) {
|
|
|
126
136
|
},
|
|
127
137
|
services: {
|
|
128
138
|
fetchInitData: async (context, event) => {
|
|
129
|
-
|
|
130
|
-
|
|
139
|
+
return await request.send(payment.getPromotionsList())
|
|
140
|
+
},
|
|
141
|
+
fetchWithdrawRulePreview: async (context, event) => {
|
|
142
|
+
const { selectedPromo, amount } = context
|
|
143
|
+
const { data } = await request.send(
|
|
144
|
+
payment.getWithdrawRulePreview({ applyType: 'promotions', applyNo: selectedPromo.promotionsNo, amount: parseFloat(amount) })
|
|
145
|
+
)
|
|
146
|
+
return data
|
|
131
147
|
},
|
|
132
148
|
applyPromotion: async (context, event) => {
|
|
133
149
|
const { selectedPromo, amount } = context
|
package/src/machine/reward.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createMachine, assign, send } from 'xstate'
|
|
2
2
|
import activity from '../api/activity.js'
|
|
3
|
+
import payment from '../api/payment.js'
|
|
3
4
|
|
|
4
5
|
export default function (request) {
|
|
5
6
|
const { appSecret } = request.config
|
|
@@ -11,6 +12,15 @@ export default function (request) {
|
|
|
11
12
|
otherRewardList: [],
|
|
12
13
|
pointsRewardList: [],
|
|
13
14
|
rewardList: [],
|
|
15
|
+
activityNo: null,
|
|
16
|
+
receiveNo: null,
|
|
17
|
+
turnoverLimitStatus: 'NEW',
|
|
18
|
+
originalTurnoverLimit: 0,
|
|
19
|
+
originalMaxWithdrawAmount: 0,
|
|
20
|
+
originalLimitGameDetail: [],
|
|
21
|
+
newTurnoverLimit: 0,
|
|
22
|
+
newMaxWithdrawAmount: 0,
|
|
23
|
+
newLimitGameDetail: [],
|
|
14
24
|
callback: () => {},
|
|
15
25
|
},
|
|
16
26
|
states: {
|
|
@@ -46,6 +56,10 @@ export default function (request) {
|
|
|
46
56
|
states: {
|
|
47
57
|
idle: {
|
|
48
58
|
on: {
|
|
59
|
+
FETCH_WITHDRAW_RULE: {
|
|
60
|
+
target: 'fetching',
|
|
61
|
+
actions: 'setRewardData',
|
|
62
|
+
},
|
|
49
63
|
RECEIVE_REWARD: {
|
|
50
64
|
target: 'receiving',
|
|
51
65
|
actions: 'setCallback',
|
|
@@ -56,11 +70,33 @@ export default function (request) {
|
|
|
56
70
|
},
|
|
57
71
|
},
|
|
58
72
|
},
|
|
73
|
+
fetching: {
|
|
74
|
+
invoke: {
|
|
75
|
+
src: 'fetchWithdrawRulePreview',
|
|
76
|
+
onDone: {
|
|
77
|
+
target: 'pending',
|
|
78
|
+
actions: 'setWithdrawRulePreview',
|
|
79
|
+
},
|
|
80
|
+
onError: {
|
|
81
|
+
target: 'idle',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
pending: {
|
|
86
|
+
on: {
|
|
87
|
+
RECEIVE_REWARD: {
|
|
88
|
+
target: 'receiving',
|
|
89
|
+
},
|
|
90
|
+
BACK: {
|
|
91
|
+
target: 'idle',
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
59
95
|
receiving: {
|
|
60
96
|
invoke: {
|
|
61
97
|
src: 'receiveReward',
|
|
62
98
|
onDone: {
|
|
63
|
-
target: '
|
|
99
|
+
target: 'received',
|
|
64
100
|
actions: [send({ type: 'REFRESH' }), 'doCallback'],
|
|
65
101
|
},
|
|
66
102
|
onError: {
|
|
@@ -68,6 +104,11 @@ export default function (request) {
|
|
|
68
104
|
},
|
|
69
105
|
},
|
|
70
106
|
},
|
|
107
|
+
received: {
|
|
108
|
+
0: {
|
|
109
|
+
target: 'idle',
|
|
110
|
+
},
|
|
111
|
+
},
|
|
71
112
|
allPointsReceiving: {
|
|
72
113
|
invoke: {
|
|
73
114
|
src: 'receiveAllPoints',
|
|
@@ -93,6 +134,13 @@ export default function (request) {
|
|
|
93
134
|
rewardList: event.data[2]?.data || [],
|
|
94
135
|
}
|
|
95
136
|
}),
|
|
137
|
+
setRewardData: assign((context, event) => {
|
|
138
|
+
const { activityNo, receiveNo } = event.data
|
|
139
|
+
return {
|
|
140
|
+
activityNo,
|
|
141
|
+
receiveNo,
|
|
142
|
+
}
|
|
143
|
+
}),
|
|
96
144
|
setCallback: assign((context, event) => {
|
|
97
145
|
return {
|
|
98
146
|
callback: event.data?.callback || (() => {}),
|
|
@@ -101,6 +149,11 @@ export default function (request) {
|
|
|
101
149
|
doCallback: (context, event) => {
|
|
102
150
|
context.callback()
|
|
103
151
|
},
|
|
152
|
+
setWithdrawRulePreview: (context, event) => {
|
|
153
|
+
return {
|
|
154
|
+
...event.data,
|
|
155
|
+
}
|
|
156
|
+
},
|
|
104
157
|
},
|
|
105
158
|
services: {
|
|
106
159
|
fetchRewardList: async (context, event) => {
|
|
@@ -110,6 +163,11 @@ export default function (request) {
|
|
|
110
163
|
const [otherRewardList, pointsRewardList, rewardList] = await Promise.all([getOtherRewardAPI, getPointsRewardAPI, getRewardAPI])
|
|
111
164
|
return [otherRewardList, pointsRewardList, rewardList]
|
|
112
165
|
},
|
|
166
|
+
fetchWithdrawRulePreview: async (context, event) => {
|
|
167
|
+
const { receiveNo } = context
|
|
168
|
+
const { data } = await request.send(payment.getWithdrawRulePreview({ applyType: 'activity', applyNo: receiveNo, amount: null }))
|
|
169
|
+
return data
|
|
170
|
+
},
|
|
113
171
|
receiveReward: async (context, event) => {
|
|
114
172
|
const { activityNo, receiveNo, attended } = event.data
|
|
115
173
|
return await request.send(activity.getReward({ activityNo, receiveNo, appSecret, attended }))
|
|
@@ -49,20 +49,20 @@ export default function (request) {
|
|
|
49
49
|
always: [{ target: 'free', cond: 'isFree' }, { target: 'cash' }],
|
|
50
50
|
},
|
|
51
51
|
free: {
|
|
52
|
-
initial: '
|
|
52
|
+
initial: 'checking',
|
|
53
53
|
states: {
|
|
54
|
-
loading: {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
},
|
|
54
|
+
// loading: {
|
|
55
|
+
// invoke: {
|
|
56
|
+
// src: 'fetchWithdrawRules',
|
|
57
|
+
// onDone: {
|
|
58
|
+
// target: 'checking',
|
|
59
|
+
// actions: 'updateWithdrawCondition',
|
|
60
|
+
// },
|
|
61
|
+
// onError: {
|
|
62
|
+
// target: 'notConvertible',
|
|
63
|
+
// },
|
|
64
|
+
// },
|
|
65
|
+
// },
|
|
66
66
|
checking: {
|
|
67
67
|
always: [{ target: 'convertible', cond: 'isConvertible' }, { target: 'notConvertible' }],
|
|
68
68
|
},
|
|
@@ -23,6 +23,9 @@ export default function (request) {
|
|
|
23
23
|
bankList: [],
|
|
24
24
|
withdrawLimit: null,
|
|
25
25
|
targetWithdrawLimit: null,
|
|
26
|
+
attachmentType: null, // 'withdraw' or 'pool'
|
|
27
|
+
maximumWithdrawAmount: 0,
|
|
28
|
+
enableWithdrawAmount: 0,
|
|
26
29
|
|
|
27
30
|
amount: null,
|
|
28
31
|
bank: null,
|
|
@@ -73,17 +76,67 @@ export default function (request) {
|
|
|
73
76
|
checking: {
|
|
74
77
|
always: [{ target: 'convertible', cond: 'isConvertible' }, { target: 'notConvertible' }],
|
|
75
78
|
},
|
|
76
|
-
notConvertible: {
|
|
79
|
+
notConvertible: {
|
|
80
|
+
on: {
|
|
81
|
+
GIVE_UP: {
|
|
82
|
+
target: 'givingUp',
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
givingUp: {
|
|
87
|
+
invoke: {
|
|
88
|
+
src: 'giveUp',
|
|
89
|
+
onDone: {
|
|
90
|
+
target: 'gaveUp',
|
|
91
|
+
},
|
|
92
|
+
onError: {
|
|
93
|
+
target: 'convertible',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
gaveUp: {},
|
|
77
98
|
convertible: {
|
|
78
99
|
on: {
|
|
79
100
|
SUBMIT: {
|
|
80
101
|
target: 'converting',
|
|
81
102
|
},
|
|
103
|
+
ATTACH: {
|
|
104
|
+
target: 'attachment',
|
|
105
|
+
actions: 'setAttachmentType',
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
attachment: {
|
|
110
|
+
on: {
|
|
111
|
+
SET_ATTACHMENT_TYPE: {
|
|
112
|
+
actions: 'setAttachmentType',
|
|
113
|
+
},
|
|
114
|
+
SET_CURRENT_BANK: {
|
|
115
|
+
actions: assign((context, event) => {
|
|
116
|
+
return {
|
|
117
|
+
bank: event.data,
|
|
118
|
+
}
|
|
119
|
+
}),
|
|
120
|
+
},
|
|
121
|
+
SET_AMOUNT: {
|
|
122
|
+
actions: assign((context, event) => {
|
|
123
|
+
return {
|
|
124
|
+
amount: event.data,
|
|
125
|
+
}
|
|
126
|
+
}),
|
|
127
|
+
},
|
|
128
|
+
SUBMIT: {
|
|
129
|
+
target: 'converting',
|
|
130
|
+
cond: (context, event) => {
|
|
131
|
+
const { enableWithdrawAmount, amount } = context
|
|
132
|
+
return +enableWithdrawAmount >= +amount
|
|
133
|
+
},
|
|
134
|
+
},
|
|
82
135
|
},
|
|
83
136
|
},
|
|
84
137
|
converting: {
|
|
85
138
|
invoke: {
|
|
86
|
-
src: '
|
|
139
|
+
src: 'convertFreeCredit',
|
|
87
140
|
onDone: [
|
|
88
141
|
{
|
|
89
142
|
target: '#withdraw_vn.otp',
|
|
@@ -97,7 +150,22 @@ export default function (request) {
|
|
|
97
150
|
},
|
|
98
151
|
},
|
|
99
152
|
},
|
|
100
|
-
converted: {
|
|
153
|
+
converted: {
|
|
154
|
+
always: [
|
|
155
|
+
{ target: '#withdraw_vn.cash.submitting', cond: 'shouldGoToWithdraw' },
|
|
156
|
+
{ target: 'pooling', cond: 'shouldGoToPool' },
|
|
157
|
+
],
|
|
158
|
+
},
|
|
159
|
+
pooling: {
|
|
160
|
+
invoke: {
|
|
161
|
+
src: 'pool',
|
|
162
|
+
onDone: { target: 'pooled' },
|
|
163
|
+
onError: {
|
|
164
|
+
target: 'pooled',
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
pooled: {},
|
|
101
169
|
},
|
|
102
170
|
},
|
|
103
171
|
cash: {
|
|
@@ -253,6 +321,7 @@ export default function (request) {
|
|
|
253
321
|
return {
|
|
254
322
|
paymentDetail: event.data.paymentDetail,
|
|
255
323
|
bankInfo: event.data.bankInfo,
|
|
324
|
+
bank: event.data.bankInfo[0],
|
|
256
325
|
bonus: event.data.bonus,
|
|
257
326
|
bankList: event.data.bankList,
|
|
258
327
|
}
|
|
@@ -279,30 +348,15 @@ export default function (request) {
|
|
|
279
348
|
}
|
|
280
349
|
}),
|
|
281
350
|
updateWithdrawCondition: assign((context, event) => {
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
const { balance, withdrawLimit } = context
|
|
285
|
-
const lastMatchedIndex = findLastIndex(rules, (rule) => balance >= rule.greaterEqualThen)
|
|
286
|
-
|
|
287
|
-
let maxWithdrawAmount = 0,
|
|
288
|
-
availableWithdrawAmount = 0
|
|
289
|
-
|
|
290
|
-
if (lastMatchedIndex > -1) {
|
|
291
|
-
rules[lastMatchedIndex].match = true
|
|
292
|
-
maxWithdrawAmount = rules[lastMatchedIndex].maxWithdrawAmount
|
|
293
|
-
|
|
294
|
-
if (withdrawLimit === 0) {
|
|
295
|
-
availableWithdrawAmount = Math.min(balance, maxWithdrawAmount)
|
|
296
|
-
}
|
|
297
|
-
} else if (rules.length > 0) {
|
|
298
|
-
maxWithdrawAmount = rules[0].maxWithdrawAmount
|
|
299
|
-
} else {
|
|
300
|
-
maxWithdrawAmount = balance
|
|
301
|
-
}
|
|
351
|
+
const { differAmountLimit, enableWithdraw, enableWithdrawAmount, maxWithdrawStatus, maximumWithdrawAmount, minimumWithdrawAmount } =
|
|
352
|
+
event.data
|
|
302
353
|
|
|
303
354
|
return {
|
|
304
|
-
maxWithdrawAmount,
|
|
305
|
-
availableWithdrawAmount,
|
|
355
|
+
// maxWithdrawAmount: maximumWithdrawAmount,
|
|
356
|
+
// availableWithdrawAmount: enableWithdrawAmount,
|
|
357
|
+
maximumWithdrawAmount,
|
|
358
|
+
enableWithdrawAmount,
|
|
359
|
+
amount: +enableWithdrawAmount,
|
|
306
360
|
}
|
|
307
361
|
}),
|
|
308
362
|
setOtp: assign((context, event) => {
|
|
@@ -328,11 +382,22 @@ export default function (request) {
|
|
|
328
382
|
target,
|
|
329
383
|
}
|
|
330
384
|
}),
|
|
385
|
+
setAttachmentType: assign((context, event) => {
|
|
386
|
+
return {
|
|
387
|
+
attachmentType: event.data,
|
|
388
|
+
}
|
|
389
|
+
}),
|
|
331
390
|
},
|
|
332
391
|
guards: {
|
|
333
392
|
isFree: (context, event) => {
|
|
334
393
|
return context.userInfo?.withdraw_rule !== 'DEFAULT'
|
|
335
394
|
},
|
|
395
|
+
shouldGoToWithdraw: (context, event) => {
|
|
396
|
+
return context.attachmentType === 'withdraw'
|
|
397
|
+
},
|
|
398
|
+
shouldGoToPool: (context, event) => {
|
|
399
|
+
return context.attachmentType === 'pool'
|
|
400
|
+
},
|
|
336
401
|
haveProcessing: (context, event) => {
|
|
337
402
|
return (context.paymentDetail?.[0]?.processing || []).length > 0
|
|
338
403
|
},
|
|
@@ -345,8 +410,8 @@ export default function (request) {
|
|
|
345
410
|
return !context.bankInfo?.length
|
|
346
411
|
},
|
|
347
412
|
isSubmittable: (context, event) => {
|
|
348
|
-
const {
|
|
349
|
-
return
|
|
413
|
+
const { bank, amount } = context
|
|
414
|
+
return bank && amount
|
|
350
415
|
},
|
|
351
416
|
isConvertible: (context, event) => {
|
|
352
417
|
const { balance, withdrawLimit } = context
|
|
@@ -397,14 +462,21 @@ export default function (request) {
|
|
|
397
462
|
return await request.send(payment.getCurrentWithdrawRule())
|
|
398
463
|
},
|
|
399
464
|
submitWithdraw: async (context, event) => {
|
|
400
|
-
const {
|
|
465
|
+
const { bank, amount } = context
|
|
401
466
|
const { method } = context.paymentDetail[0]
|
|
402
|
-
const branchTemp =
|
|
467
|
+
const branchTemp = bank.bankCode === 'GCASH' ? '' : bank.branch
|
|
403
468
|
return await request.send(
|
|
404
|
-
payment.submitWithdrawTransactionVN({
|
|
469
|
+
payment.submitWithdrawTransactionVN({
|
|
470
|
+
method,
|
|
471
|
+
amount,
|
|
472
|
+
applyerBankCode: bank.bankCode,
|
|
473
|
+
applyerAccountNumber: bank.accountNumber,
|
|
474
|
+
branch: branchTemp,
|
|
475
|
+
holderName: bank.holderName,
|
|
476
|
+
})
|
|
405
477
|
)
|
|
406
478
|
},
|
|
407
|
-
|
|
479
|
+
convertFreeCredit: async (context, event) => {
|
|
408
480
|
return await request.send(payment.convertFreeCredit({ exchangeType: 1 }))
|
|
409
481
|
},
|
|
410
482
|
resetOtp: async (context, event) => {
|
|
@@ -416,6 +488,13 @@ export default function (request) {
|
|
|
416
488
|
const code = event.data
|
|
417
489
|
return await request.send(user.otpAcknowledge({ requestId, target, code }))
|
|
418
490
|
},
|
|
491
|
+
pool: async (context, event) => {
|
|
492
|
+
const { amount } = context
|
|
493
|
+
return await request.send(payment.restore({ amount }))
|
|
494
|
+
},
|
|
495
|
+
giveUp: async (context, event) => {
|
|
496
|
+
return await request.send(payment.giveUp())
|
|
497
|
+
},
|
|
419
498
|
},
|
|
420
499
|
}
|
|
421
500
|
)
|