-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathplatforms.ts
250 lines (224 loc) · 19.5 KB
/
platforms.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
import Service from "../service";
import Client from "../client";
import PlatformsAccount, { AccountTypesEnum } from "./resource/platforms/account";
import getJsonResponse from "./../helpers/getJsonResponse";
import PlatformsFund from "./resource/platforms/fund";
import PlatformsHostedOnboardingPage from "./resource/platforms/hop";
import PlatformsNotificationConfiguration from "./resource/platforms/notificationConfiguration";
import {
GetAccountHolderRequest,
GetUploadedDocumentsRequest,
GetAccountHolderResponse,
GetUploadedDocumentsResponse,
CreateAccountHolderRequest,
CreateAccountHolderResponse,
CloseAccountHolderRequest,
CloseAccountHolderResponse,
CreateAccountRequest,
CreateAccountResponse,
DeleteBankAccountRequest,
GenericResponse,
DeletePayoutMethodRequest,
UpdateAccountRequest,
UpdateAccountResponse,
UploadDocumentRequest,
UnSuspendAccountHolderRequest,
UnSuspendAccountHolderResponse,
CloseAccountRequest,
CloseAccountResponse,
SuspendAccountHolderRequest,
SuspendAccountHolderResponse,
UpdateAccountHolderRequest,
UpdateAccountHolderResponse,
DeleteShareholderRequest,
PerformVerificationRequest,
UpdateAccountHolderStateRequest,
GetAccountHolderStatusResponse,
GetTaxFormRequest,
GetTaxFormResponse,
} from "../typings/platformsAccount/models";
import {
GetOnboardingUrlRequest,
GetOnboardingUrlResponse,
GetPciUrlRequest,
GetPciUrlResponse
} from "../typings/platformsHostedOnboardingPage/models";
import { DebitAccountHolderRequest, DebitAccountHolderResponse } from "../typings/platformsFund/models";
type AccountType = AccountTypesEnum.Accounts;
type VerificationType = AccountTypesEnum.Verification;
type AccountHoldersType = AccountTypesEnum.AccountHolders;
type AccountsAccount = PlatformsAccount<AccountType>;
type AccountsVerification = PlatformsAccount<VerificationType>;
type AccountsAccountHolders = PlatformsAccount<AccountHoldersType>;
type PlatformsTypes = AccountsAccount | AccountsVerification | AccountsAccountHolders | PlatformsFund | PlatformsHostedOnboardingPage;
class Platforms extends Service {
/* PlatformsAccount */
// Accounts
private readonly _closeAccount: PlatformsAccount<AccountType>;
private readonly _updateAccount: PlatformsAccount<AccountType>;
private readonly _createAccount: PlatformsAccount<AccountType>;
// Verification
private readonly _uploadDocument: PlatformsAccount<VerificationType>;
private readonly _getUploadedDocuments: PlatformsAccount<VerificationType>;
private readonly _deleteBankAccounts: PlatformsAccount<VerificationType>;
private readonly _deletePayoutMethods: PlatformsAccount<VerificationType>;
private readonly _deleteShareholders: PlatformsAccount<VerificationType>;
private readonly _checkAccountHolder: PlatformsAccount<VerificationType>;
// Account Holders
private readonly _createAccountHolder: PlatformsAccount<AccountHoldersType>;
private readonly _getAccountHolder: PlatformsAccount<AccountHoldersType>;
private readonly _updateAccountHolder: PlatformsAccount<AccountHoldersType>;
private readonly _updateAccountHolderState: PlatformsAccount<AccountHoldersType>;
private readonly _suspendAccountHolder: PlatformsAccount<AccountHoldersType>;
private readonly _unSuspendAccountHolder: PlatformsAccount<AccountHoldersType>;
private readonly _closeAccountHolder: PlatformsAccount<AccountHoldersType>;
private readonly _getTaxForm: PlatformsAccount<AccountHoldersType>;
/* PlatformsFund */
private readonly _accountHolderBalance: PlatformsFund;
private readonly _accountHolderTransactionList: PlatformsFund;
private readonly _payoutAccountHolder: PlatformsFund;
private readonly _transferFunds: PlatformsFund;
private readonly _refundFundsTransfer: PlatformsFund;
private readonly _setupBeneficiary: PlatformsFund;
private readonly _refundNotPaidOutTransfers: PlatformsFund;
private readonly _debitAccountHolder: PlatformsFund;
/* HOP */
private readonly _getOnboardingUrl: PlatformsHostedOnboardingPage;
private readonly _getPciQuestionnaireUrl: PlatformsHostedOnboardingPage;
/* Notification Configuration */
private readonly _createNotificationConfiguration: PlatformsNotificationConfiguration;
private readonly _getNotificationConfiguration: PlatformsNotificationConfiguration;
private readonly _getNotificationConfigurationList: PlatformsNotificationConfiguration;
private readonly _testNotificationConfiguration: PlatformsNotificationConfiguration;
private readonly _updateNotificationConfiguration: PlatformsNotificationConfiguration;
private readonly _deleteNotificationConfiguration: PlatformsNotificationConfiguration;
public constructor(client: Client) {
super(client);
// Account
this._closeAccount = new PlatformsAccount<AccountType>(this, "/closeAccount");
this._updateAccount = new PlatformsAccount<AccountType>(this, "/updateAccount");
this._createAccount = new PlatformsAccount<AccountType>(this, "/createAccount");
this._uploadDocument = new PlatformsAccount<VerificationType>(this, "/uploadDocument");
this._getUploadedDocuments = new PlatformsAccount<VerificationType>(this, "/getUploadedDocuments");
this._deleteBankAccounts = new PlatformsAccount<VerificationType>(this, "/deleteBankAccounts");
this._deletePayoutMethods = new PlatformsAccount<VerificationType>(this, "/deletePayoutMethods");
this._deleteShareholders = new PlatformsAccount<VerificationType>(this, "/deleteShareholders");
this._checkAccountHolder = new PlatformsAccount<VerificationType>(this, "/checkAccountHolder");
this._createAccountHolder = new PlatformsAccount<AccountHoldersType>(this, "/createAccountHolder");
this._getAccountHolder = new PlatformsAccount<AccountHoldersType>(this, "/getAccountHolder");
this._updateAccountHolder = new PlatformsAccount<AccountHoldersType>(this, "/updateAccountHolder");
this._updateAccountHolderState = new PlatformsAccount<AccountHoldersType>(this, "/updateAccountHolderState");
this._suspendAccountHolder = new PlatformsAccount<AccountHoldersType>(this, "/suspendAccountHolder");
this._unSuspendAccountHolder = new PlatformsAccount<AccountHoldersType>(this, "/unSuspendAccountHolder");
this._closeAccountHolder = new PlatformsAccount<AccountHoldersType>(this, "/closeAccountHolder");
this._getTaxForm = new PlatformsAccount<AccountHoldersType>(this, "/getTaxForm");
// Fund
this._accountHolderBalance = new PlatformsFund(this, "/accountHolderBalance");
this._accountHolderTransactionList = new PlatformsFund(this, "/accountHolderTransactionList");
this._payoutAccountHolder = new PlatformsFund(this, "/payoutAccountHolder");
this._transferFunds = new PlatformsFund(this, "/transferFunds");
this._refundFundsTransfer = new PlatformsFund(this, "/refundFundsTransfer");
this._setupBeneficiary = new PlatformsFund(this, "/setupBeneficiary");
this._refundNotPaidOutTransfers = new PlatformsFund(this, "/refundNotPaidOutTransfers");
this._debitAccountHolder = new PlatformsFund(this, "/debitAccountHolder");
// HOP
this._getOnboardingUrl = new PlatformsHostedOnboardingPage(this, "/getOnboardingUrl");
this._getPciQuestionnaireUrl = new PlatformsHostedOnboardingPage(this, "/getPciQuestionnaireUrl");
// Notification Configuration
this._createNotificationConfiguration = new PlatformsNotificationConfiguration(this, "/createNotificationConfiguration");
this._getNotificationConfiguration = new PlatformsNotificationConfiguration(this, "/getNotificationConfiguration");
this._getNotificationConfigurationList = new PlatformsNotificationConfiguration(this, "/getNotificationConfigurationList");
this._testNotificationConfiguration = new PlatformsNotificationConfiguration(this, "/testNotificationConfiguration");
this._updateNotificationConfiguration = new PlatformsNotificationConfiguration(this, "/updateNotificationConfiguration");
this._deleteNotificationConfiguration = new PlatformsNotificationConfiguration(this, "/deleteNotificationConfigurations");
}
createRequest = <T extends PlatformsTypes, U, V>(service: T) => {
return (request: U): Promise<V> => getJsonResponse<U, V>(service, request);
};
public get Account(): {
getAccountHolder: (request: GetAccountHolderRequest) => Promise<GetAccountHolderResponse>;
getUploadedDocuments: (request: GetUploadedDocumentsRequest) => Promise<GetUploadedDocumentsResponse>;
createAccountHolder: (request: CreateAccountHolderRequest) => Promise<CreateAccountHolderResponse>;
closeAccountHolder: (request: CloseAccountHolderRequest) => Promise<CloseAccountHolderResponse>;
createAccount: (request: CreateAccountRequest) => Promise<CreateAccountResponse>;
deleteBankAccounts: (request: DeleteBankAccountRequest) => Promise<GenericResponse>;
deletePayoutMethods: (request: DeletePayoutMethodRequest) => Promise<GenericResponse>;
updateAccount: (request: UpdateAccountRequest) => Promise<UpdateAccountResponse>;
uploadDocument: (request: UploadDocumentRequest) => Promise<GetUploadedDocumentsResponse>;
unSuspendAccountHolder: (request: UnSuspendAccountHolderRequest) => Promise<UnSuspendAccountHolderResponse>;
closeAccount: (request: CloseAccountRequest) => Promise<CloseAccountResponse>;
suspendAccountHolder: (request: SuspendAccountHolderRequest) => Promise<SuspendAccountHolderResponse>;
updateAccountHolder: (request: UpdateAccountHolderRequest) => Promise<UpdateAccountHolderResponse>;
deleteShareholders: (request: DeleteShareholderRequest) => Promise<GenericResponse>;
checkAccountHolder: (request: PerformVerificationRequest) => Promise<GenericResponse>;
updateAccountHolderState: (request: UpdateAccountHolderStateRequest) => Promise<GetAccountHolderStatusResponse>;
getTaxForm: (request: GetTaxFormRequest) => Promise<GetTaxFormResponse>;
} {
const closeAccount = this.createRequest<AccountsAccount, CloseAccountRequest, CloseAccountResponse>(this._closeAccount);
const updateAccount = this.createRequest<AccountsAccount, UpdateAccountRequest, UpdateAccountResponse>(this._updateAccount);
const createAccount = this.createRequest<AccountsAccount, CreateAccountRequest, CreateAccountResponse>(this._createAccount);
const uploadDocument = this.createRequest<AccountsVerification, UploadDocumentRequest, GetUploadedDocumentsResponse>(this._uploadDocument);
const getUploadedDocuments = this.createRequest<AccountsVerification, GetUploadedDocumentsRequest, GetUploadedDocumentsResponse>(this._getUploadedDocuments);
const deleteBankAccounts = this.createRequest<AccountsVerification, DeleteBankAccountRequest, GenericResponse>(this._deleteBankAccounts);
const deletePayoutMethods = this.createRequest<AccountsVerification, DeletePayoutMethodRequest, GenericResponse>(this._deletePayoutMethods);
const deleteShareholders = this.createRequest<AccountsVerification, DeleteShareholderRequest, GenericResponse>(this._deleteShareholders);
const createAccountHolder = this.createRequest<AccountsAccountHolders, CreateAccountHolderRequest, CreateAccountHolderResponse>(this._createAccountHolder);
const getAccountHolder = this.createRequest<AccountsAccountHolders, GetAccountHolderRequest, GetAccountHolderResponse>(this._getAccountHolder);
const updateAccountHolder = this.createRequest<AccountsAccountHolders, UpdateAccountHolderRequest, UpdateAccountHolderResponse>(this._updateAccountHolder);
const updateAccountHolderState = this.createRequest<AccountsAccountHolders, UpdateAccountHolderStateRequest, GetAccountHolderStatusResponse>(this._updateAccountHolderState);
const suspendAccountHolder = this.createRequest<AccountsAccountHolders, SuspendAccountHolderRequest, SuspendAccountHolderResponse>(this._suspendAccountHolder);
const unSuspendAccountHolder = this.createRequest<AccountsAccountHolders, UnSuspendAccountHolderRequest, UnSuspendAccountHolderResponse>(this._unSuspendAccountHolder);
const closeAccountHolder = this.createRequest<AccountsAccountHolders, CloseAccountHolderRequest, CloseAccountHolderResponse>(this._closeAccountHolder);
const checkAccountHolder = this.createRequest<AccountsVerification, PerformVerificationRequest, GenericResponse>(this._checkAccountHolder);
const getTaxForm = this.createRequest<AccountsAccountHolders, GetTaxFormRequest, GetTaxFormResponse>(this._getTaxForm);
const accounts = { closeAccount, updateAccount, createAccount };
const verification = { uploadDocument, getUploadedDocuments, deleteBankAccounts, deletePayoutMethods, deleteShareholders, checkAccountHolder };
const accountHolders = { createAccountHolder, getAccountHolder, updateAccountHolder, updateAccountHolderState, suspendAccountHolder, unSuspendAccountHolder, closeAccountHolder, getTaxForm};
return {...accounts, ...verification, ...accountHolders };
}
public get Fund(): {
refundNotPaidOutTransfers: (request: IPlatformsFund.RefundNotPaidOutTransfersRequest) => Promise<IPlatformsFund.RefundNotPaidOutTransfersResponse>;
accountHolderTransactionList: (request: IPlatformsFund.AccountHolderTransactionListRequest) => Promise<IPlatformsFund.AccountHolderTransactionListResponse>;
setupBeneficiary: (request: IPlatformsFund.SetupBeneficiaryRequest) => Promise<IPlatformsFund.SetupBeneficiaryResponse>;
transferFunds: (request: IPlatformsFund.TransferFundsRequest) => Promise<IPlatformsFund.TransferFundsResponse>;
refundFundsTransfer: (request: IPlatformsFund.RefundFundsTransferRequest) => Promise<IPlatformsFund.RefundFundsTransferResponse>;
payoutAccountHolder: (request: IPlatformsFund.PayoutAccountHolderRequest) => Promise<IPlatformsFund.PayoutAccountHolderResponse>;
accountHolderBalance: (request: IPlatformsFund.AccountHolderBalanceRequest) => Promise<IPlatformsFund.AccountHolderBalanceResponse>;
debitAccountHolder: (request: DebitAccountHolderRequest) => Promise<DebitAccountHolderResponse>;
} {
const accountHolderBalance = this.createRequest<PlatformsFund, IPlatformsFund.AccountHolderBalanceRequest, IPlatformsFund.AccountHolderBalanceResponse>(this._accountHolderBalance);
const accountHolderTransactionList = this.createRequest<PlatformsFund, IPlatformsFund.AccountHolderTransactionListRequest, IPlatformsFund.AccountHolderTransactionListResponse>(this._accountHolderTransactionList);
const payoutAccountHolder = this.createRequest<PlatformsFund, IPlatformsFund.PayoutAccountHolderRequest, IPlatformsFund.PayoutAccountHolderResponse>(this._payoutAccountHolder);
const transferFunds = this.createRequest<PlatformsFund, IPlatformsFund.TransferFundsRequest, IPlatformsFund.TransferFundsResponse>(this._transferFunds);
const refundFundsTransfer = this.createRequest<PlatformsFund, IPlatformsFund.RefundFundsTransferRequest, IPlatformsFund.RefundFundsTransferResponse>(this._refundFundsTransfer);
const setupBeneficiary = this.createRequest<PlatformsFund, IPlatformsFund.SetupBeneficiaryRequest, IPlatformsFund.SetupBeneficiaryResponse>(this._setupBeneficiary);
const refundNotPaidOutTransfers = this.createRequest<PlatformsFund, IPlatformsFund.RefundNotPaidOutTransfersRequest, IPlatformsFund.RefundNotPaidOutTransfersResponse>(this._refundNotPaidOutTransfers);
const debitAccountHolder = this.createRequest<PlatformsFund, DebitAccountHolderRequest, DebitAccountHolderResponse>(this._debitAccountHolder);
return { accountHolderBalance, accountHolderTransactionList, payoutAccountHolder, refundFundsTransfer, transferFunds, setupBeneficiary, refundNotPaidOutTransfers, debitAccountHolder };
}
public get HostedOnboardingPage(): {
getOnboardingUrl: (request: GetOnboardingUrlRequest) => Promise<GetOnboardingUrlResponse>;
getPciQuestionnaireUrl: (request: GetPciUrlRequest) => Promise<GetPciUrlResponse>;
} {
const getOnboardingUrl = this.createRequest<PlatformsHostedOnboardingPage, GetOnboardingUrlRequest, GetOnboardingUrlResponse>(this._getOnboardingUrl);
const getPciQuestionnaireUrl = this.createRequest<PlatformsHostedOnboardingPage, GetPciUrlRequest, GetPciUrlResponse>(this._getPciQuestionnaireUrl);
return { getOnboardingUrl, getPciQuestionnaireUrl };
}
public get NotificationConfiguration(): {
createNotificationConfiguration: (request: IPlatformsNotificationConfiguration.CreateNotificationConfigurationRequest) => Promise<IPlatformsNotificationConfiguration.GetNotificationConfigurationResponse>;
updateNotificationConfiguration: (request: IPlatformsNotificationConfiguration.UpdateNotificationConfigurationRequest) => Promise<IPlatformsNotificationConfiguration.GetNotificationConfigurationResponse>;
getNotificationConfiguration: (request: IPlatformsNotificationConfiguration.GetNotificationConfigurationRequest) => Promise<IPlatformsNotificationConfiguration.GetNotificationConfigurationResponse>;
testNotificationConfiguration: (request: IPlatformsNotificationConfiguration.TestNotificationConfigurationRequest) => Promise<IPlatformsNotificationConfiguration.TestNotificationConfigurationResponse>;
getNotificationConfigurationList: (request: Record<string, unknown>) => Promise<IPlatformsNotificationConfiguration.GetNotificationConfigurationListResponse>;
deleteNotificationConfigurations: (request: IPlatformsNotificationConfiguration.DeleteNotificationConfigurationRequest) => Promise<IPlatformsNotificationConfiguration.GenericResponse>;
} {
const createNotificationConfiguration = this.createRequest<PlatformsHostedOnboardingPage, IPlatformsNotificationConfiguration.CreateNotificationConfigurationRequest, IPlatformsNotificationConfiguration.GetNotificationConfigurationResponse>(this._createNotificationConfiguration);
const getNotificationConfiguration = this.createRequest<PlatformsHostedOnboardingPage, IPlatformsNotificationConfiguration.GetNotificationConfigurationRequest, IPlatformsNotificationConfiguration.GetNotificationConfigurationResponse>(this._getNotificationConfiguration);
const getNotificationConfigurationList = this.createRequest<PlatformsHostedOnboardingPage, Record<string, unknown>, IPlatformsNotificationConfiguration.GetNotificationConfigurationListResponse>(this._getNotificationConfigurationList);
const testNotificationConfiguration = this.createRequest<PlatformsHostedOnboardingPage, IPlatformsNotificationConfiguration.TestNotificationConfigurationRequest, IPlatformsNotificationConfiguration.TestNotificationConfigurationResponse>(this._testNotificationConfiguration);
const updateNotificationConfiguration = this.createRequest<PlatformsHostedOnboardingPage, IPlatformsNotificationConfiguration.UpdateNotificationConfigurationRequest, IPlatformsNotificationConfiguration.GetNotificationConfigurationResponse>(this._updateNotificationConfiguration);
const deleteNotificationConfigurations = this.createRequest<PlatformsHostedOnboardingPage, IPlatformsNotificationConfiguration.DeleteNotificationConfigurationRequest, IPlatformsNotificationConfiguration.GenericResponse>(this._deleteNotificationConfiguration);
return { createNotificationConfiguration, getNotificationConfiguration, getNotificationConfigurationList, testNotificationConfiguration, updateNotificationConfiguration, deleteNotificationConfigurations };
}
}
export default Platforms;