be-components 7.5.9 → 7.6.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/lib/commonjs/ApiOverrides/index.js +5 -1
- package/lib/commonjs/ApiOverrides/index.js.map +1 -1
- package/lib/commonjs/BetRouter/components/MyOpportunities.js +14 -9
- package/lib/commonjs/BetRouter/components/MyOpportunities.js.map +1 -1
- package/lib/commonjs/BetRouter/components/OpportunityHistory.js +92 -41
- package/lib/commonjs/BetRouter/components/OpportunityHistory.js.map +1 -1
- package/lib/commonjs/Checkout/api/index.js +11 -3
- package/lib/commonjs/Checkout/api/index.js.map +1 -1
- package/lib/commonjs/Checkout/components/OrderSummaryCard.js +4 -4
- package/lib/commonjs/Checkout/components/OrderSummaryCard.js.map +1 -1
- package/lib/commonjs/Checkout/index.js.map +1 -1
- package/lib/commonjs/Wallet/api/index.js +21 -4
- package/lib/commonjs/Wallet/api/index.js.map +1 -1
- package/lib/commonjs/Wallet/components/LinkAccountManager.js +18 -2
- package/lib/commonjs/Wallet/components/LinkAccountManager.js.map +1 -1
- package/lib/commonjs/Wallet/components/ManageAccountCard.js +32 -2
- package/lib/commonjs/Wallet/components/ManageAccountCard.js.map +1 -1
- package/lib/commonjs/Wallet/components/ManualACHAdd.js +47 -5
- package/lib/commonjs/Wallet/components/ManualACHAdd.js.map +1 -1
- package/lib/commonjs/Wallet/components/WalletActionSelector.js +22 -2
- package/lib/commonjs/Wallet/components/WalletActionSelector.js.map +1 -1
- package/lib/commonjs/Wallet/components/WithdrawCard.js +56 -5
- package/lib/commonjs/Wallet/components/WithdrawCard.js.map +1 -1
- package/lib/commonjs/Wallet/index.js +43 -4
- package/lib/commonjs/Wallet/index.js.map +1 -1
- package/lib/commonjs/types.d.js.map +1 -1
- package/lib/module/ApiOverrides/index.js +5 -1
- package/lib/module/ApiOverrides/index.js.map +1 -1
- package/lib/module/BetRouter/components/MyOpportunities.js +14 -9
- package/lib/module/BetRouter/components/MyOpportunities.js.map +1 -1
- package/lib/module/BetRouter/components/OpportunityHistory.js +93 -42
- package/lib/module/BetRouter/components/OpportunityHistory.js.map +1 -1
- package/lib/module/Checkout/api/index.js +11 -3
- package/lib/module/Checkout/api/index.js.map +1 -1
- package/lib/module/Checkout/components/OrderSummaryCard.js +4 -4
- package/lib/module/Checkout/components/OrderSummaryCard.js.map +1 -1
- package/lib/module/Checkout/index.js.map +1 -1
- package/lib/module/Wallet/api/index.js +21 -4
- package/lib/module/Wallet/api/index.js.map +1 -1
- package/lib/module/Wallet/components/LinkAccountManager.js +18 -2
- package/lib/module/Wallet/components/LinkAccountManager.js.map +1 -1
- package/lib/module/Wallet/components/ManageAccountCard.js +32 -2
- package/lib/module/Wallet/components/ManageAccountCard.js.map +1 -1
- package/lib/module/Wallet/components/ManualACHAdd.js +47 -5
- package/lib/module/Wallet/components/ManualACHAdd.js.map +1 -1
- package/lib/module/Wallet/components/WalletActionSelector.js +22 -2
- package/lib/module/Wallet/components/WalletActionSelector.js.map +1 -1
- package/lib/module/Wallet/components/WithdrawCard.js +55 -5
- package/lib/module/Wallet/components/WithdrawCard.js.map +1 -1
- package/lib/module/Wallet/index.js +43 -4
- package/lib/module/Wallet/index.js.map +1 -1
- package/lib/module/types.d.js.map +1 -1
- package/lib/typescript/lib/commonjs/ApiOverrides/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/BetRouter/components/MyOpportunities.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/BetRouter/components/OpportunityHistory.d.ts +1 -2
- package/lib/typescript/lib/commonjs/BetRouter/components/OpportunityHistory.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Checkout/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Wallet/api/index.d.ts +1 -0
- package/lib/typescript/lib/commonjs/Wallet/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Wallet/components/LinkAccountManager.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Wallet/components/ManageAccountCard.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Wallet/components/ManualACHAdd.d.ts +3 -1
- package/lib/typescript/lib/commonjs/Wallet/components/ManualACHAdd.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Wallet/components/WalletActionSelector.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Wallet/components/WithdrawCard.d.ts +4 -1
- package/lib/typescript/lib/commonjs/Wallet/components/WithdrawCard.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Wallet/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/ApiOverrides/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/BetRouter/components/MyOpportunities.d.ts.map +1 -1
- package/lib/typescript/lib/module/BetRouter/components/OpportunityHistory.d.ts +1 -2
- package/lib/typescript/lib/module/BetRouter/components/OpportunityHistory.d.ts.map +1 -1
- package/lib/typescript/lib/module/Checkout/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Wallet/api/index.d.ts +1 -0
- package/lib/typescript/lib/module/Wallet/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Wallet/components/LinkAccountManager.d.ts.map +1 -1
- package/lib/typescript/lib/module/Wallet/components/ManageAccountCard.d.ts.map +1 -1
- package/lib/typescript/lib/module/Wallet/components/ManualACHAdd.d.ts +3 -1
- package/lib/typescript/lib/module/Wallet/components/ManualACHAdd.d.ts.map +1 -1
- package/lib/typescript/lib/module/Wallet/components/WalletActionSelector.d.ts.map +1 -1
- package/lib/typescript/lib/module/Wallet/components/WithdrawCard.d.ts +4 -1
- package/lib/typescript/lib/module/Wallet/components/WithdrawCard.d.ts.map +1 -1
- package/lib/typescript/lib/module/Wallet/index.d.ts.map +1 -1
- package/lib/typescript/src/ApiOverrides/index.d.ts.map +1 -1
- package/lib/typescript/src/BetRouter/components/MyOpportunities.d.ts.map +1 -1
- package/lib/typescript/src/BetRouter/components/OpportunityHistory.d.ts +1 -1
- package/lib/typescript/src/BetRouter/components/OpportunityHistory.d.ts.map +1 -1
- package/lib/typescript/src/Checkout/api/index.d.ts.map +1 -1
- package/lib/typescript/src/Checkout/index.d.ts.map +1 -1
- package/lib/typescript/src/Wallet/api/index.d.ts +1 -0
- package/lib/typescript/src/Wallet/api/index.d.ts.map +1 -1
- package/lib/typescript/src/Wallet/components/LinkAccountManager.d.ts.map +1 -1
- package/lib/typescript/src/Wallet/components/ManageAccountCard.d.ts.map +1 -1
- package/lib/typescript/src/Wallet/components/ManualACHAdd.d.ts +4 -2
- package/lib/typescript/src/Wallet/components/ManualACHAdd.d.ts.map +1 -1
- package/lib/typescript/src/Wallet/components/WalletActionSelector.d.ts.map +1 -1
- package/lib/typescript/src/Wallet/components/WithdrawCard.d.ts +3 -1
- package/lib/typescript/src/Wallet/components/WithdrawCard.d.ts.map +1 -1
- package/lib/typescript/src/Wallet/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ApiOverrides/index.ts +5 -1
- package/src/BetRouter/components/MyOpportunities.tsx +24 -21
- package/src/BetRouter/components/OpportunityHistory.tsx +72 -36
- package/src/Checkout/api/index.tsx +10 -2
- package/src/Checkout/components/OrderSummaryCard.tsx +4 -4
- package/src/Checkout/index.tsx +0 -1
- package/src/Wallet/api/index.ts +13 -5
- package/src/Wallet/components/LinkAccountManager.tsx +14 -6
- package/src/Wallet/components/ManageAccountCard.tsx +23 -2
- package/src/Wallet/components/ManualACHAdd.tsx +31 -8
- package/src/Wallet/components/WalletActionSelector.tsx +12 -2
- package/src/Wallet/components/WithdrawCard.tsx +41 -5
- package/src/Wallet/index.tsx +28 -1
- package/src/types.d.ts +3 -0
|
@@ -164,9 +164,17 @@ const CheckoutHelpers = {
|
|
|
164
164
|
},
|
|
165
165
|
genItemOrder: (draft_order:ItemOrderProps, items:ItemProps[], account:AccountProps):ItemOrderProps => {
|
|
166
166
|
let amount = parseFloat(draft_order.amount as string);
|
|
167
|
-
let fee_1 = 0
|
|
168
167
|
let no_fee = items.find(i => i.no_fees) ? true : false
|
|
169
|
-
|
|
168
|
+
let item_fees = draft_order.items.reduce((a,b) => {
|
|
169
|
+
let b_item = items.find(i => i.item_id == b.item_id);
|
|
170
|
+
let b_fee = b_item && b_item.processing_fee ? b_item.processing_fee * b.amount : 0
|
|
171
|
+
return a + b_fee
|
|
172
|
+
}, 0);
|
|
173
|
+
let account_fee = Math.round(((account.transaction_fee * amount) + Number.EPSILON) * 100) / 100
|
|
174
|
+
let fee_1 = Math.max(item_fees, account_fee)
|
|
175
|
+
console.log('item fees are')
|
|
176
|
+
console.log(item_fees)
|
|
177
|
+
if(no_fee){ fee_1 = 0 }
|
|
170
178
|
let total_amount = amount + fee_1
|
|
171
179
|
return {
|
|
172
180
|
...draft_order,
|
|
@@ -13,23 +13,23 @@ const OrderSummaryCard = ({ item_order }:OrderSummaryCardProps) => {
|
|
|
13
13
|
<View>
|
|
14
14
|
<View style={{ flexDirection:'row', padding:5, paddingRight:10, paddingLeft:10 }}>
|
|
15
15
|
<Text style={{ flex:1 }} size={14} theme='description'>Subtotal</Text>
|
|
16
|
-
<Text size={14} theme='description'>${item_order.amount}</Text>
|
|
16
|
+
<Text size={14} theme='description'>${Number(item_order.amount).toFixed(2)}</Text>
|
|
17
17
|
</View>
|
|
18
18
|
{item_order.fee_1 ?
|
|
19
19
|
<View style={{ flexDirection:'row', padding:5, paddingRight:10, paddingLeft:10 }}>
|
|
20
20
|
<Text style={{ flex:1 }} size={14} theme='description'>{item_order.fee_1}</Text>
|
|
21
|
-
<Text size={14} theme='description'>${item_order.fee_1_amount}</Text>
|
|
21
|
+
<Text size={14} theme='description'>${item_order.fee_1_amount?.toFixed(2)}</Text>
|
|
22
22
|
</View>
|
|
23
23
|
:<></>}
|
|
24
24
|
{item_order.fee_2 ?
|
|
25
25
|
<View style={{ flexDirection:'row', padding:5, paddingRight:10, paddingLeft:10 }}>
|
|
26
26
|
<Text style={{ flex:1 }} size={14} theme='description'>{item_order.fee_2}</Text>
|
|
27
|
-
<Text size={14} theme='description'>${item_order.fee_2_amount}</Text>
|
|
27
|
+
<Text size={14} theme='description'>${item_order.fee_2_amount?.toFixed(2)}</Text>
|
|
28
28
|
</View>
|
|
29
29
|
:<></>}
|
|
30
30
|
<View style={{ flexDirection:'row', padding:5, paddingRight:10, paddingLeft:10 }}>
|
|
31
31
|
<Text style={{ flex:1 }} size={14} theme='h1'>Total</Text>
|
|
32
|
-
<Text size={14} theme='h1'>${item_order.total_amount}</Text>
|
|
32
|
+
<Text size={14} theme='h1'>${item_order.total_amount.toFixed(2)}</Text>
|
|
33
33
|
</View>
|
|
34
34
|
</View>
|
|
35
35
|
)
|
package/src/Checkout/index.tsx
CHANGED
package/src/Wallet/api/index.ts
CHANGED
|
@@ -114,6 +114,14 @@ const WalletApi = {
|
|
|
114
114
|
const resp = await axios.post(`${WALLET_SVC_API}/v1/accounts/account/ach/add`, { account, ach_detail })
|
|
115
115
|
return { account: resp.data.account, ach_detail: resp.data.ach_detail }
|
|
116
116
|
},
|
|
117
|
+
addACHDetails: async(account_id:string, routing_number:string, account_number:string):Promise<ACHDetailProps | undefined> => {
|
|
118
|
+
try {
|
|
119
|
+
const resp = await axios.post(`${WALLET_SVC_API}/v1/accounts/account/ach/details/add`, { account_id, routing_number, account_number });
|
|
120
|
+
return resp.data.ach_details
|
|
121
|
+
} catch (e) {
|
|
122
|
+
return undefined
|
|
123
|
+
}
|
|
124
|
+
},
|
|
117
125
|
verifyACHAccount: async(account_id:string, amount_1:number, amount_2:number):Promise<{ account:AccountProps, status:'success'|'fail' }> => {
|
|
118
126
|
const resp = await axios.post(`${WALLET_SVC_API}/v1/accounts/account/ach/verify`, { account_id, amount_1, amount_2 })
|
|
119
127
|
return { account: resp.data.account, status:resp.data.status }
|
|
@@ -308,7 +316,6 @@ const ItemOrderHelpers = {
|
|
|
308
316
|
last_update_datetime: ''
|
|
309
317
|
}
|
|
310
318
|
},
|
|
311
|
-
|
|
312
319
|
getDepositAvailable: (deposit_limit:PlayerDepositLimitProps, account:AccountProps) => {
|
|
313
320
|
let deposit_available = 0
|
|
314
321
|
if(deposit_limit){
|
|
@@ -502,10 +509,11 @@ const WalletHelpers = {
|
|
|
502
509
|
if(!account){ console.log('') }
|
|
503
510
|
return [
|
|
504
511
|
{ action_id: '1', action_type: 'deposit', action_title: 'Deposit Funds', action_description: 'Deposit to your BettorEdge balance using this account' },
|
|
505
|
-
{ action_id: '2', action_type: '
|
|
506
|
-
{ action_id: '3', action_type: '
|
|
507
|
-
{ action_id: '4', action_type: '
|
|
508
|
-
{ action_id: '5', action_type: '
|
|
512
|
+
{ action_id: '2', action_type: 'instant_withdraw', action_title: 'Instantly Withdraw Funds (with Fee)', action_description: 'Withdraw funds instantly to this bank account from your BettorEdge balance' },
|
|
513
|
+
{ action_id: '3', action_type: 'withdraw', action_title: 'Withdraw Funds (Free)', action_description: 'Withdraw funds to this bank account from your BettorEdge balance' },
|
|
514
|
+
{ action_id: '4', action_type: 'limits', action_title: 'Account Limits', action_description: 'Set personal deposit limits to manage how much you use BettorEdge' },
|
|
515
|
+
{ action_id: '5', action_type: 'snoozes', action_title: 'Snooze Account', action_description: 'Set snooze for this account to take a break from BettorEdge' },
|
|
516
|
+
{ action_id: '6', action_type: 'remove', action_title: 'Remove Account', action_description: 'Remove and delete this account from your profile' },
|
|
509
517
|
]
|
|
510
518
|
},
|
|
511
519
|
/**
|
|
@@ -134,12 +134,20 @@ const LinkAccountManager = ({ player_addresses, ibt_placeholer_account, onCancel
|
|
|
134
134
|
:!show_addresses.selected_address ?
|
|
135
135
|
<View style={{ marginTop:10, borderRadius:8, padding:20 }}>
|
|
136
136
|
<Text size={14} theme='description'>Before we continue, we will need get the billing address associated with the account to be linked</Text>
|
|
137
|
-
<
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
137
|
+
<View transparent style={{ flexDirection:'row', alignItems:'center', marginTop:10 }}>
|
|
138
|
+
<Button
|
|
139
|
+
title='CANCEL'
|
|
140
|
+
style={{ flex:1, marginRight:4 }}
|
|
141
|
+
type='error'
|
|
142
|
+
onPress={() => onCancel()}
|
|
143
|
+
/>
|
|
144
|
+
<Button
|
|
145
|
+
style={{ flex:2, marginLeft:4 }}
|
|
146
|
+
title={show_addresses.selected_address ?'CHANGE':'ADD BILLING ADDRESS'}
|
|
147
|
+
type='success'
|
|
148
|
+
onPress={() => setShowAddresses({ ...show_addresses, visible:true })}
|
|
149
|
+
/>
|
|
150
|
+
</View>
|
|
143
151
|
</View>
|
|
144
152
|
:<></>}
|
|
145
153
|
<Modal
|
|
@@ -29,13 +29,14 @@ const manage_sections = ['header','actions']
|
|
|
29
29
|
const ManageAccountCard = ({ player, view_mode, insets, wallet_settings, player_balance, account, deposit_limit, withdraw_limit, onAccountUpdate, onTransact, onClose }:ManageAccountCardProps) => {
|
|
30
30
|
const Colors = useColors();
|
|
31
31
|
const [ active_action, setActiveAction ] = useState('select');
|
|
32
|
-
|
|
33
32
|
const account_actions = WalletHelpers.getAccountOptions(account)
|
|
34
33
|
|
|
35
34
|
const renderIcon = (action:AccountActionProps) => {
|
|
36
35
|
switch(action.action_type){
|
|
37
36
|
case 'deposit':
|
|
38
37
|
return <Icons.DepositIcon color={Colors.text.white} size={20} />
|
|
38
|
+
case 'instant_withdraw':
|
|
39
|
+
return <Icons.WithdrawIcon color={Colors.text.gold} size={20} />
|
|
39
40
|
case 'withdraw':
|
|
40
41
|
return <Icons.WithdrawIcon color={Colors.text.white} size={20} />
|
|
41
42
|
case 'limits':
|
|
@@ -55,7 +56,8 @@ const ManageAccountCard = ({ player, view_mode, insets, wallet_settings, player_
|
|
|
55
56
|
if(data.item.action_type == 'remove' && account.ibt_placeholder){ return <></> }
|
|
56
57
|
if(data.item.action_type == 'withdraw' && account.account_type == 'card'){ return <></> }
|
|
57
58
|
if(data.item.action_type == 'remove' && account.account_type === 'paypal'){ return <></> }
|
|
58
|
-
|
|
59
|
+
if(data.item.action_type == 'instant_withdraw' && !account.ach_detail){ return <></> }
|
|
60
|
+
if(data.item.action_type == 'instant_withdraw' && !account.ach_detail?.instant_allowed){ return <></> }
|
|
59
61
|
//if(data.item.action_type == 'deposit' && account.account_type == 'card' && account?.card_detail?.card_type != 'debit'){ return <></> }
|
|
60
62
|
return (
|
|
61
63
|
<Button float style={{ flex:1, minHeight:80, margin:8 }} onPress={() => setActiveAction(data.item.action_type)}>
|
|
@@ -84,6 +86,11 @@ const ManageAccountCard = ({ player, view_mode, insets, wallet_settings, player_
|
|
|
84
86
|
<Text style={{ marginTop:5}} theme='description'>Below are the available actions that can be performed on this account!</Text>
|
|
85
87
|
:<></>}
|
|
86
88
|
</View>
|
|
89
|
+
{account.ach_detail && account.ach_detail.ach_type == 'ibf' ?
|
|
90
|
+
<View transparent style={{ marginLeft:10 }}>
|
|
91
|
+
<Icons.BankInstantIcon color={Colors.text.gold} size={20} />
|
|
92
|
+
</View>
|
|
93
|
+
:<></>}
|
|
87
94
|
</View>
|
|
88
95
|
)
|
|
89
96
|
case 'actions':
|
|
@@ -144,6 +151,20 @@ const ManageAccountCard = ({ player, view_mode, insets, wallet_settings, player_
|
|
|
144
151
|
wallet_settings={wallet_settings}
|
|
145
152
|
player_balance={player_balance}
|
|
146
153
|
account={account}
|
|
154
|
+
onAccountUpdate={onAccountUpdate}
|
|
155
|
+
withdraw_limit={withdraw_limit}
|
|
156
|
+
onTransact={onTransact}
|
|
157
|
+
onCancel={() => setActiveAction('select')}
|
|
158
|
+
/>
|
|
159
|
+
:active_action == 'instant_withdraw'?
|
|
160
|
+
<WithdrawCard
|
|
161
|
+
player={player}
|
|
162
|
+
instant
|
|
163
|
+
deposit_limit={deposit_limit}
|
|
164
|
+
wallet_settings={wallet_settings}
|
|
165
|
+
player_balance={player_balance}
|
|
166
|
+
account={account}
|
|
167
|
+
onAccountUpdate={onAccountUpdate}
|
|
147
168
|
withdraw_limit={withdraw_limit}
|
|
148
169
|
onTransact={onTransact}
|
|
149
170
|
onCancel={() => setActiveAction('select')}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { Checkbox } from '../../Components';
|
|
3
3
|
import { WalletApi, WalletHelpers } from '../api';
|
|
4
|
-
import type { AccountProps, FocusPositionProps, MyPlayerProps } from '../../types';
|
|
4
|
+
import type { AccountProps, ACHDetailProps, FocusPositionProps, MyPlayerProps } from '../../types';
|
|
5
5
|
import { useColors } from '../../constants/useColors';
|
|
6
6
|
import { Button, Text, TextInput, View } from '../../Components/Themed';
|
|
7
7
|
import { FlatList, KeyboardAvoidingView, Platform } from 'react-native';
|
|
@@ -9,13 +9,15 @@ const validator = require('us-bank-account-validator');
|
|
|
9
9
|
|
|
10
10
|
type ManualACHAddProps = {
|
|
11
11
|
player:MyPlayerProps,
|
|
12
|
+
account_id?:string,
|
|
12
13
|
onFocusPosition?:(pos:FocusPositionProps) => void,
|
|
14
|
+
onUpdateAchDetails:(ach_detail:ACHDetailProps) => void,
|
|
13
15
|
onAddAccount:(account:AccountProps) => void,
|
|
14
16
|
onCancel:() => void
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
const ach_sections = ['header','name','bank_name','routing_number','account_number','disclaimer']
|
|
18
|
-
const ManualACHAdd = ({ player, onAddAccount, onCancel, onFocusPosition }:ManualACHAddProps) => {
|
|
20
|
+
const ManualACHAdd = ({ player, account_id, onUpdateAchDetails, onAddAccount, onCancel, onFocusPosition }:ManualACHAddProps) => {
|
|
19
21
|
const Colors = useColors();
|
|
20
22
|
const [ loading, setLoading ] = useState(false);
|
|
21
23
|
const [ error, setError ] = useState<string>();
|
|
@@ -29,8 +31,10 @@ const ManualACHAdd = ({ player, onAddAccount, onCancel, onFocusPosition }:Manual
|
|
|
29
31
|
const bank_valid = ach_details.bank_name ? true : false;
|
|
30
32
|
const routing_valid = validator.routingNumber(ach_details.routing_number);
|
|
31
33
|
const account_valid = validator.accountNumber(ach_details.account_number);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
let valid = routing_valid && account_valid ? true : false
|
|
35
|
+
if(!account_id && !bank_valid){ valid = false }
|
|
36
|
+
if(!account_id && !disclaimer){ valid = false }
|
|
37
|
+
|
|
34
38
|
const handleAddAccount = async() => {
|
|
35
39
|
if(!valid || loading){ return }
|
|
36
40
|
setLoading(true);
|
|
@@ -45,9 +49,27 @@ const ManualACHAdd = ({ player, onAddAccount, onCancel, onFocusPosition }:Manual
|
|
|
45
49
|
setLoading(false);
|
|
46
50
|
}
|
|
47
51
|
|
|
52
|
+
const handleAddAchDetails = async() => {
|
|
53
|
+
if(!valid || loading || !account_id){ return }
|
|
54
|
+
if(!ach_details.account_number || !ach_details.routing_number){ return }
|
|
55
|
+
setLoading(true)
|
|
56
|
+
const new_ach_detail = await WalletApi.addACHDetails(account_id, ach_details.routing_number, ach_details.account_number);
|
|
57
|
+
if(!new_ach_detail){ setError('Sorry, we were not able to confirm this account. Please try again.') }
|
|
58
|
+
else { onUpdateAchDetails(new_ach_detail) }
|
|
59
|
+
setLoading(false)
|
|
60
|
+
}
|
|
61
|
+
|
|
48
62
|
const renderSections = (data:{item:string,index:number}) => {
|
|
49
63
|
switch(data.item){
|
|
50
64
|
case 'header':
|
|
65
|
+
if(account_id){
|
|
66
|
+
return (
|
|
67
|
+
<View type='header' style={{ padding:20 }}>
|
|
68
|
+
<Text theme='h1'>CONFIRM ACCOUNT DETAILS</Text>
|
|
69
|
+
<Text style={{ marginTop:4 }} theme='description'>Please confirm your account details below to continue.</Text>
|
|
70
|
+
</View>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
51
73
|
return (
|
|
52
74
|
<View type='header' style={{ padding:20 }}>
|
|
53
75
|
<Text theme='h1'>MANUAL ACH ACCOUNT</Text>
|
|
@@ -68,6 +90,7 @@ const ManualACHAdd = ({ player, onAddAccount, onCancel, onFocusPosition }:Manual
|
|
|
68
90
|
</View>
|
|
69
91
|
)
|
|
70
92
|
case 'bank_name':
|
|
93
|
+
if(account_id){ return <></> }
|
|
71
94
|
return (
|
|
72
95
|
<View style={{ padding:10 }}>
|
|
73
96
|
<Text size={14} theme='h2'>Bank Name</Text>
|
|
@@ -126,7 +149,6 @@ const ManualACHAdd = ({ player, onAddAccount, onCancel, onFocusPosition }:Manual
|
|
|
126
149
|
return (
|
|
127
150
|
<View style={{ flex:1 }}>
|
|
128
151
|
<KeyboardAvoidingView style={{ flex:1 }} behavior={Platform.OS == 'ios' ? 'padding' : 'height'}>
|
|
129
|
-
|
|
130
152
|
<FlatList
|
|
131
153
|
key='manual_ach_sections'
|
|
132
154
|
keyExtractor={(item) => item}
|
|
@@ -134,13 +156,14 @@ const ManualACHAdd = ({ player, onAddAccount, onCancel, onFocusPosition }:Manual
|
|
|
134
156
|
renderItem={renderSections}
|
|
135
157
|
/>
|
|
136
158
|
</KeyboardAvoidingView>
|
|
137
|
-
|
|
159
|
+
{!account_id ?
|
|
138
160
|
<View>
|
|
139
161
|
<Button style={{ flexDirection:'row', alignItems:'center', paddingLeft:20, paddingRight:20 }} onPress={() => setDisclaimer(!disclaimer)}>
|
|
140
162
|
<Checkbox size={30} checked={disclaimer} disabled onSelect={() => console.log('')}/>
|
|
141
163
|
<Text style={{ marginLeft:10 }} size={14} theme='description'>I understand that by continuing, we will send 2 small deposits to this bank account to confirm ownership. Once received, I will enter the amounts here.</Text>
|
|
142
164
|
</Button>
|
|
143
165
|
</View>
|
|
166
|
+
:<></>}
|
|
144
167
|
{error?
|
|
145
168
|
<View style={{ padding:10 }}>
|
|
146
169
|
<Text size={16} color={Colors.text.warning} textAlign='center' weight='semibold'>{error}</Text>
|
|
@@ -156,12 +179,12 @@ const ManualACHAdd = ({ player, onAddAccount, onCancel, onFocusPosition }:Manual
|
|
|
156
179
|
onPress={() => onCancel()}
|
|
157
180
|
/>
|
|
158
181
|
<Button
|
|
159
|
-
title='ADD ACCOUNT'
|
|
182
|
+
title={account_id? 'CONFIRM ACCOUNT': 'ADD ACCOUNT'}
|
|
160
183
|
style={{ flex:3, opacity:valid&&!loading&&!error?1:0.5 }}
|
|
161
184
|
disabled={!valid || loading || error?true:false}
|
|
162
185
|
loading={loading}
|
|
163
186
|
type='success'
|
|
164
|
-
onPress={() => handleAddAccount()}
|
|
187
|
+
onPress={() => account_id ? handleAddAchDetails() : handleAddAccount()}
|
|
165
188
|
/>
|
|
166
189
|
</View>
|
|
167
190
|
: account.status == 'verify' ?
|
|
@@ -45,7 +45,10 @@ const WalletActionSelector = ({ player, walkthrough_steps, player_balance, accou
|
|
|
45
45
|
action :'deposit', label: "Make A Deposit", icon:<Icons.DepositIcon size={20} color={Colors.text.h1} />, description: 'Fund your BettorEdge real-money balance by making a deposit from an existing account or new one.'
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
|
-
action :'withdraw', label: "
|
|
48
|
+
action :'withdraw', label: "Withdraw Funds (FREE)", icon:<Icons.WithdrawIcon size={20} color={Colors.text.h1} />, description: 'Move funds from your BettorEdge real-money balance to a connected ACH account. (Up to 3 biz days)'
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
action :'instant_withdraw', label: "Instantly Withdraw Funds", icon:<Icons.WithdrawIcon size={20} color={Colors.text.h1} />, description: 'Instantly Move funds from your BettorEdge real-money balance to a connected ACH account.'
|
|
49
52
|
},
|
|
50
53
|
|
|
51
54
|
]
|
|
@@ -59,9 +62,16 @@ const WalletActionSelector = ({ player, walkthrough_steps, player_balance, accou
|
|
|
59
62
|
if(!default_account){ default_account = accounts.find(a => a.account_type == 'paypal')}
|
|
60
63
|
return onActionSelect(action, default_account)
|
|
61
64
|
case 'withdraw':
|
|
62
|
-
let withdraw_account = accounts.find(a => !a.ibt_placeholder && a.account_type == 'ach' && a.status == 'active')
|
|
65
|
+
let withdraw_account = accounts.find(a => !a.ibt_placeholder && a.account_type == 'ach' && a.status == 'active');
|
|
63
66
|
if(!withdraw_account){ return onActionSelect({ action: 'ach_add' }) }
|
|
64
67
|
return onActionSelect(action, withdraw_account)
|
|
68
|
+
case 'instant_withdraw':
|
|
69
|
+
let instant_withdraw_account = accounts.find(a => a.status == 'active' && a.account_type == 'ach' && a.ach_detail?.ach_type == 'ibf');
|
|
70
|
+
if(instant_withdraw_account){ return onActionSelect(action, instant_withdraw_account) }
|
|
71
|
+
//Ok lets get the ibt_placeholder one!
|
|
72
|
+
let ibt_placeholder = accounts.find(a => a.ibt_placeholder);
|
|
73
|
+
if(ibt_placeholder){ return onActionSelect(action, ibt_placeholder) }
|
|
74
|
+
return //Dont do anything if we dont have an ibt acccount possible
|
|
65
75
|
default: onActionSelect(action)
|
|
66
76
|
}
|
|
67
77
|
}
|
|
@@ -5,6 +5,7 @@ import { ItemOrderApi, ItemOrderHelpers } from '../api';
|
|
|
5
5
|
import { Button, Text, TextInput, View } from '../../Components/Themed';
|
|
6
6
|
import { useColors } from '../../constants/useColors';
|
|
7
7
|
import { Icons } from '../../Components';
|
|
8
|
+
import ManualACHAdd from './ManualACHAdd';
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
type WithdrawCardProps = {
|
|
@@ -12,6 +13,8 @@ type WithdrawCardProps = {
|
|
|
12
13
|
wallet_settings:WalletSettingsProps,
|
|
13
14
|
player_balance:PlayerBalanceProps,
|
|
14
15
|
account:AccountProps,
|
|
16
|
+
instant?:boolean,
|
|
17
|
+
onAccountUpdate:(account:AccountProps) => void,
|
|
15
18
|
onFocusPosition?:(pos:FocusPositionProps) => void,
|
|
16
19
|
deposit_limit:PlayerDepositLimitProps,
|
|
17
20
|
withdraw_limit:PlayerWithdrawLimitProps,
|
|
@@ -19,26 +22,38 @@ type WithdrawCardProps = {
|
|
|
19
22
|
onCancel:() => void
|
|
20
23
|
}
|
|
21
24
|
const sections = ['header','input','limits']
|
|
22
|
-
const WithdrawCard = ({ wallet_settings, onTransact, player_balance, account, withdraw_limit, onFocusPosition, deposit_limit , onCancel}:WithdrawCardProps) => {
|
|
25
|
+
const WithdrawCard = ({ player, wallet_settings, onTransact, instant, player_balance, account, withdraw_limit, onAccountUpdate, onFocusPosition, deposit_limit , onCancel}:WithdrawCardProps) => {
|
|
23
26
|
const Colors = useColors();
|
|
24
27
|
const [ draft_order, setDraftOrder ] = useState<ItemOrderProps>();
|
|
25
|
-
|
|
28
|
+
const [ confirm_ach, setConfirmAch ] = useState(false);
|
|
29
|
+
//const [ withdraw_item, setWithdrawItem ] = useState<ItemProps | undefined>(undefined);
|
|
26
30
|
useEffect(() => {
|
|
27
31
|
getItemFromServer()
|
|
28
32
|
},[])
|
|
29
33
|
|
|
30
34
|
const getItemFromServer = async() => {
|
|
31
|
-
const item = await ItemOrderApi.getItemByIdentifier('withdraw')
|
|
35
|
+
const item = await ItemOrderApi.getItemByIdentifier(instant?'instant_withdraw':'withdraw');
|
|
36
|
+
//setWithdrawItem(item);
|
|
32
37
|
setDraftOrder(ItemOrderHelpers.genWithdrawOrder(item, account))
|
|
33
38
|
}
|
|
34
39
|
|
|
35
|
-
|
|
40
|
+
|
|
36
41
|
const { errors, available_for_withdraw } = ItemOrderHelpers.isWithdrawOrderValid(account, withdraw_limit, deposit_limit, player_balance, wallet_settings, draft_order)
|
|
37
42
|
|
|
38
43
|
const handleTransact = () => {
|
|
39
44
|
if(!draft_order){ return }
|
|
40
45
|
if(errors.length > 0){ return }
|
|
41
|
-
|
|
46
|
+
|
|
47
|
+
//OK LETS CHECK THE ACCOUNT TYPE AND IF WE NEED ACCOUNT NUMBER INFORMATION
|
|
48
|
+
if(!instant){
|
|
49
|
+
if(!account.ach_detail?.account_number){
|
|
50
|
+
return setConfirmAch(true);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//Lets get the item
|
|
54
|
+
let draft_item = draft_order.items[0]
|
|
55
|
+
if(!draft_item){ return }
|
|
56
|
+
onTransact({ ...draft_order, total_amount: draft_order.amount as number, items: [{ ...draft_item, amount: draft_order.amount as number }] })
|
|
42
57
|
}
|
|
43
58
|
|
|
44
59
|
|
|
@@ -51,7 +66,9 @@ const WithdrawCard = ({ wallet_settings, onTransact, player_balance, account, wi
|
|
|
51
66
|
return (
|
|
52
67
|
<View nativeID='deposit_rules' style={{ padding:10 }}>
|
|
53
68
|
<Text size={28} textAlign='center' theme='h1'>Withdraw to your bank</Text>
|
|
69
|
+
{!instant ?
|
|
54
70
|
<Text style={{ marginTop:10 }} size={14} textAlign='center' theme='description'>Withdraws can take up to 3 business days</Text>
|
|
71
|
+
:<></>}
|
|
55
72
|
</View>
|
|
56
73
|
)
|
|
57
74
|
case 'input':
|
|
@@ -181,6 +198,25 @@ const WithdrawCard = ({ wallet_settings, onTransact, player_balance, account, wi
|
|
|
181
198
|
onPress={() => handleTransact()}
|
|
182
199
|
/>
|
|
183
200
|
</View>
|
|
201
|
+
{confirm_ach ?
|
|
202
|
+
<View type='blur' style={{ position:'absolute', top:0, left:0, right:0, bottom:0, flex:1, padding:20 }}>
|
|
203
|
+
<ManualACHAdd
|
|
204
|
+
account_id={account.account_id}
|
|
205
|
+
player={player}
|
|
206
|
+
onAddAccount={(account) => console.log(account)}
|
|
207
|
+
onUpdateAchDetails={(ach_detail) => {
|
|
208
|
+
console.log('HERE!!!')
|
|
209
|
+
let new_account = { ...account }
|
|
210
|
+
new_account.ach_detail = ach_detail
|
|
211
|
+
console.log(new_account)
|
|
212
|
+
onAccountUpdate(new_account);
|
|
213
|
+
setConfirmAch(false);
|
|
214
|
+
}}
|
|
215
|
+
onCancel={() => setConfirmAch(false)}
|
|
216
|
+
onFocusPosition={onFocusPosition}
|
|
217
|
+
/>
|
|
218
|
+
</View>
|
|
219
|
+
:<></>}
|
|
184
220
|
</View>
|
|
185
221
|
)
|
|
186
222
|
}
|
package/src/Wallet/index.tsx
CHANGED
|
@@ -291,6 +291,7 @@ const MyWallet = ({ height, new_balance, account_id, view_mode, insets, header_s
|
|
|
291
291
|
:walkthrough.step_action == 'manual_ach' ?
|
|
292
292
|
<ManualACHAdd
|
|
293
293
|
player={player}
|
|
294
|
+
onUpdateAchDetails={(_) => console.log('')}
|
|
294
295
|
onFocusPosition={onFocusPosition}
|
|
295
296
|
onAddAccount={(acct) => {
|
|
296
297
|
setWallet({ ...wallet, accounts: accounts.concat(acct) })
|
|
@@ -343,6 +344,7 @@ const MyWallet = ({ height, new_balance, account_id, view_mode, insets, header_s
|
|
|
343
344
|
{walkthrough.step_action == 'manual_ach' ?
|
|
344
345
|
<ManualACHAdd
|
|
345
346
|
player={player}
|
|
347
|
+
onUpdateAchDetails={(_) => console.log('')}
|
|
346
348
|
onFocusPosition={onFocusPosition}
|
|
347
349
|
onAddAccount={(acct) => setWallet({ ...wallet, accounts: accounts.concat(acct) })}
|
|
348
350
|
onCancel={() => setWalkthrough({ ...walkthrough, step_action: undefined })}
|
|
@@ -485,7 +487,10 @@ const MyWallet = ({ height, new_balance, account_id, view_mode, insets, header_s
|
|
|
485
487
|
account={selected_account}
|
|
486
488
|
deposit_limit={deposit_limit}
|
|
487
489
|
withdraw_limit={withdraw_limit}
|
|
488
|
-
onAccountUpdate={(acct) =>
|
|
490
|
+
onAccountUpdate={(acct) => {
|
|
491
|
+
setWallet({ ...wallet, accounts: accounts.filter(a => a.account_id != acct.account_id).concat(acct) })
|
|
492
|
+
if(selected_account.account_id == acct.account_id){ setSelectedAccount(acct) }
|
|
493
|
+
}}
|
|
489
494
|
onClose={() => setView({active_view:'my_accounts'})}
|
|
490
495
|
onTransact={(o, account_id) => {
|
|
491
496
|
setView({ active_view: 'my_accounts' });
|
|
@@ -516,6 +521,27 @@ const MyWallet = ({ height, new_balance, account_id, view_mode, insets, header_s
|
|
|
516
521
|
wallet_settings={wallet_settings}
|
|
517
522
|
withdraw_limit={withdraw_limit}
|
|
518
523
|
deposit_limit={deposit_limit}
|
|
524
|
+
onAccountUpdate={(acct) => {
|
|
525
|
+
setWallet({ ...wallet, accounts: accounts.filter(a => a.account_id != acct.account_id).concat(acct) })
|
|
526
|
+
if(selected_account.account_id == acct.account_id){ setSelectedAccount(acct) }
|
|
527
|
+
}}
|
|
528
|
+
account={selected_account}
|
|
529
|
+
onTransact={(item_order) => onTransact(item_order, selected_account.account_id)}
|
|
530
|
+
onCancel={() => setView({active_view:'my_accounts'})}
|
|
531
|
+
/>
|
|
532
|
+
:active_view == 'instant_withdraw' && selected_account ?
|
|
533
|
+
<WithdrawCard
|
|
534
|
+
player={player}
|
|
535
|
+
instant
|
|
536
|
+
onFocusPosition={onFocusPosition}
|
|
537
|
+
player_balance={player_balance}
|
|
538
|
+
wallet_settings={wallet_settings}
|
|
539
|
+
withdraw_limit={withdraw_limit}
|
|
540
|
+
deposit_limit={deposit_limit}
|
|
541
|
+
onAccountUpdate={(acct) => {
|
|
542
|
+
setWallet({ ...wallet, accounts: accounts.filter(a => a.account_id != acct.account_id).concat(acct) })
|
|
543
|
+
if(selected_account.account_id == acct.account_id){ setSelectedAccount(acct) }
|
|
544
|
+
}}
|
|
519
545
|
account={selected_account}
|
|
520
546
|
onTransact={(item_order) => onTransact(item_order, selected_account.account_id)}
|
|
521
547
|
onCancel={() => setView({active_view:'my_accounts'})}
|
|
@@ -546,6 +572,7 @@ const MyWallet = ({ height, new_balance, account_id, view_mode, insets, header_s
|
|
|
546
572
|
:active_view == 'add_ach'?
|
|
547
573
|
<ManualACHAdd
|
|
548
574
|
player={player}
|
|
575
|
+
onUpdateAchDetails={(_) => console.log('')}
|
|
549
576
|
onFocusPosition={onFocusPosition}
|
|
550
577
|
onAddAccount={(acct) => setWallet({ ...wallet, accounts: accounts.concat(acct) })}
|
|
551
578
|
onCancel={() => setView({active_view:'my_accounts'})}
|
package/src/types.d.ts
CHANGED
|
@@ -1303,6 +1303,8 @@ export interface ACHDetailProps {
|
|
|
1303
1303
|
account_type: 'checking' | 'savings'
|
|
1304
1304
|
routing_number?:string,
|
|
1305
1305
|
account_number?:string,
|
|
1306
|
+
manual_withdraw_allowed?:boolean,
|
|
1307
|
+
instant_allowed?:boolean,
|
|
1306
1308
|
encryption_iv?:string,
|
|
1307
1309
|
session_id?:string,
|
|
1308
1310
|
payment_provider:'nuvei' | 'payliance',
|
|
@@ -1492,6 +1494,7 @@ export interface ItemProps {
|
|
|
1492
1494
|
color_options?: ColorOptionProps[],
|
|
1493
1495
|
price_editable?:boolean,
|
|
1494
1496
|
location_required?:boolean,
|
|
1497
|
+
processing_fee?:number,
|
|
1495
1498
|
location_restricted?:boolean,
|
|
1496
1499
|
locations_allowed?:string[],
|
|
1497
1500
|
shipping_address_required:boolean,
|