1
1
import { getApiRoot } from '@libs/ApiUtils' ;
2
2
import * as NetworkStore from '@libs/Network/NetworkStore' ;
3
+ import * as PolicyUtils from '@libs/PolicyUtils' ;
3
4
import CONST from '@src/CONST' ;
4
5
5
6
type CompanyCardBankConnection = {
@@ -10,22 +11,20 @@ type CompanyCardBankConnection = {
10
11
isNewDot : string ;
11
12
} ;
12
13
13
- // TODO remove this when BE will support bank UI callbacks
14
- const bankUrl = 'https://secure.chase.com/web/auth/#/logon/logon/chaseOnline?redirect_url=' ;
15
-
16
- export default function getCompanyCardBankConnection ( bankName ?: string , domainName ?: string , scrapeMinDate ?: string ) {
14
+ export default function getCompanyCardBankConnection ( policyID ?: string , bankName ?: string , scrapeMinDate ?: string ) {
17
15
const bankConnection = Object . keys ( CONST . COMPANY_CARDS . BANKS ) . find ( ( key ) => CONST . COMPANY_CARDS . BANKS [ key as keyof typeof CONST . COMPANY_CARDS . BANKS ] === bankName ) ;
18
16
19
- // TODO remove this when BE will support bank UI callbacks
20
- if ( ! domainName ) {
21
- return bankUrl ;
22
- }
23
-
24
- if ( ! bankName || ! bankConnection ) {
17
+ if ( ! bankName || ! bankConnection || ! policyID ) {
25
18
return null ;
26
19
}
27
20
const authToken = NetworkStore . getAuthToken ( ) ;
28
- const params : CompanyCardBankConnection = { authToken : authToken ?? '' , isNewDot : 'true' , domainName : domainName ?? '' , isCorporate : 'true' , scrapeMinDate : scrapeMinDate ?? '' } ;
21
+ const params : CompanyCardBankConnection = {
22
+ authToken : authToken ?? '' ,
23
+ isNewDot : 'true' ,
24
+ domainName : PolicyUtils . getDomainNameForPolicy ( policyID ) ,
25
+ isCorporate : 'true' ,
26
+ scrapeMinDate : scrapeMinDate ?? '' ,
27
+ } ;
29
28
const commandURL = getApiRoot ( {
30
29
shouldSkipWebProxy : true ,
31
30
command : '' ,
0 commit comments