-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathunit.ts
128 lines (122 loc) · 6.17 KB
/
unit.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
import { Applications } from "./resources/application"
import { Cards } from "./resources/cards"
import { Customers } from "./resources/customer"
import { Transactions } from "./resources/transactions"
import { Accounts } from "./resources/account"
import { CustomerTokens } from "./resources/customerToken"
import { Webhooks } from "./resources/webhooks"
import { UnitConfig, UnitError } from "./types/common"
import { BatchAccounts } from "./resources/batchAccounts"
import { Fees } from "./resources/fee"
import * as helpers from "./helpers"
import { Counterparties } from "./resources/counterparty"
import { Events } from "./resources/events"
import { Payments } from "./resources/payments"
import { Authorizations } from "./resources/authorization"
import { AuthorizationRequests } from "./resources/authorizationRequest"
import { Statments } from "./resources/statements"
import { Returns } from "./resources/returns"
import { ApplicationForms } from "./resources/applicationForm"
import { AccountsEndOfDay } from "./resources/accountEndOfDay"
import { CheckPayments, Rewards, TaxForms } from "./resources"
import { Institutions } from "./resources/institutions"
import { AtmLocations } from "./resources/atmLocations"
import { CheckDeposits } from "./resources/checkDeposit"
import { ReceivedPayments } from "./resources/receivedPayments"
import { RecurringPayments } from "./resources/recurringPayments"
import { OrgTokens } from "./resources/orgToken"
import { Simulations } from "./resources/simulations"
import { Disputes } from "./resources/dispute"
import { Repayments } from "./resources/repayments"
import { StopPayments } from "./resources/stopPayments"
import { Chargebacks } from "./resources/chargeback"
import { CashDeposits } from "./resources/cashDeposits"
import { CreditApplications } from "./resources/creditApplication"
import { RecurringRepayments } from "./resources/recurringRepayments"
import { Migrations } from "./resources/migrations"
export class Unit {
public applications: Applications
public customers: Customers
public accounts: Accounts
public accountsEndOfDay: AccountsEndOfDay
public transactions: Transactions
public cards: Cards
public webhooks: Webhooks
public customerToken: CustomerTokens
public batchAccount: BatchAccounts
public fees: Fees
public counterparties: Counterparties
public payments: Payments
public receivedPayments: ReceivedPayments
public authorizations: Authorizations
public authorizationRequests: AuthorizationRequests
public helpers: typeof helpers
public statements: Statments
public events: Events
public applicationForms: ApplicationForms
public returns: Returns
public institutions: Institutions
public atmLocations: AtmLocations
public checkDeposits: CheckDeposits
public rewards: Rewards
public recurringPayments: RecurringPayments
public orgTokens: OrgTokens
public simulations: Simulations
public disputes: Disputes
public repayments: Repayments
public stopPayments: StopPayments
public checkPayments: CheckPayments
public chargebacks: Chargebacks
public taxForms: TaxForms
public cashDeposits: CashDeposits
public creditApplications: CreditApplications
public recurringRepayments: RecurringRepayments
public migrations: Migrations;
constructor(token: string, basePath: string, config?: UnitConfig) {
// remove all trailing slashes from user-provided basePath
basePath = basePath.trim().replace(/\/+$/, "")
this.applications = new Applications(token, basePath, config)
this.customers = new Customers(token, basePath, config)
this.accounts = new Accounts(token, basePath, config)
this.accountsEndOfDay = new AccountsEndOfDay(token, basePath, config)
this.transactions = new Transactions(token, basePath, config)
this.cards = new Cards(token, basePath, config)
this.webhooks = new Webhooks(token, basePath, config)
this.customerToken = new CustomerTokens(token, basePath, config)
this.batchAccount = new BatchAccounts(token, basePath, config)
this.fees = new Fees(token, basePath, config)
this.counterparties = new Counterparties(token, basePath, config)
this.events = new Events(token, basePath, config)
this.payments = new Payments(token, basePath, config)
this.receivedPayments = new ReceivedPayments(token, basePath, config)
this.authorizations = new Authorizations(token, basePath, config)
this.authorizationRequests = new AuthorizationRequests(token, basePath, config)
this.statements = new Statments(token, basePath, config)
this.applicationForms = new ApplicationForms(token, basePath, config)
this.returns = new Returns(token, basePath, config)
this.institutions = new Institutions(token, basePath, config)
this.atmLocations = new AtmLocations(token, basePath, config)
this.checkDeposits = new CheckDeposits(token, basePath, config)
this.rewards = new Rewards(token, basePath, config)
this.recurringPayments = new RecurringPayments(token, basePath, config)
this.orgTokens = new OrgTokens(token, basePath, config)
this.simulations = new Simulations(token, basePath, config)
this.disputes = new Disputes(token, basePath, config)
this.repayments = new Repayments(token, basePath, config)
this.stopPayments = new StopPayments(token, basePath, config)
this.checkPayments = new CheckPayments(token, basePath, config)
this.chargebacks = new Chargebacks(token, basePath, config)
this.taxForms = new TaxForms(token, basePath, config)
this.cashDeposits = new CashDeposits(token, basePath, config)
this.creditApplications = new CreditApplications(token, basePath, config)
this.recurringRepayments = new RecurringRepayments(token, basePath, config)
this.migrations = new Migrations(token, basePath, config)
this.helpers = helpers
}
isError<T>(response: T | UnitError): response is UnitError {
// noinspection PointlessBooleanExpressionJS
return (response as UnitError).isUnitError === true
}
}
export * from "./types"
export * from "./resources"