@spritz-finance/api-client 0.7.0 → 0.7.1
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.
|
@@ -195,7 +195,7 @@ query UserBankAccounts {
|
|
|
195
195
|
...BankAccountFragment
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
|
-
`,name:"GraphQL request",locationOffset:{line:1,column:1}};var Rm={};function nE(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return Rm[t]?!1:(Rm[t]=!0,!0)})}it.definitions=it.definitions.concat(nE(ti.definitions));function gu(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){gu(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){gu(u,n)}),e.definitions&&e.definitions.forEach(function(u){gu(u,n)})}var Qo={};(function(){it.definitions.forEach(function(n){if(n.name){var t=new Set;gu(n,t),Qo[n.name.value]=t}})})();function jm(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function tE(e,n){var t={kind:e.kind,definitions:[jm(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Qo[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Qo[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=jm(e,o);s&&t.definitions.push(s)}),t}tE(it,"UserBankAccounts");function iE(e){throw new Error(e)}var uE=(e=>(e.Active="Active",e.Error="Error",e.Syncing="Syncing",e.Unavailable="Unavailable",e))(uE||{}),Lm=(e=>(e.AMOUNT_RECEIVED="AMOUNT_RECEIVED",e.TOTAL_AMOUNT="TOTAL_AMOUNT",e))(Lm||{}),Zm=(e=>(e.Business="Business",e.Checking="Checking",e.Savings="Savings",e))(Zm||{}),ut=(e=>(e.CABankAccount="CABankAccount",e.IbanAccount="IbanAccount",e.UKBankAccount="UKBankAccount",e.USBankAccount="USBankAccount",e))(ut||{}),Vm=(e=>(e.AutoLoan="AutoLoan",e.CreditCard="CreditCard",e.Loan="Loan",e.MobilePhone="MobilePhone",e.Mortgage="Mortgage",e.StudentLoan="StudentLoan",e.Unknown="Unknown",e.Utility="Utility",e))(Vm||{}),qm=(e=>(e.Mastercard="Mastercard",e.Visa="Visa",e))(qm||{}),Mm=(e=>(e.COMPLETED="COMPLETED",e.CONFIRMED="CONFIRMED",e.CREATED="CREATED",e.FAILED="FAILED",e.FAILED_VALIDATION="FAILED_VALIDATION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.PENDING="PENDING",e.REFUNDED="REFUNDED",e.TRANSACTION_FAILED="TRANSACTION_FAILED",e.TRANSACTION_PENDING="TRANSACTION_PENDING",e))(Mm||{}),rt=(e=>(e.ACTIVE="ACTIVE",e.DISABLED="DISABLED",e.FAILED="FAILED",e.INITIALIZED="INITIALIZED",e.LOADING="LOADING",e.RETRY="RETRY",e.UNAVAILABLE="UNAVAILABLE",e.UNDER_REVIEW="UNDER_REVIEW",e.UNINITIALIZED="UNINITIALIZED",e))(rt||{}),rE=(e=>(e.AWAITING_FUNDS="AWAITING_FUNDS",e.CANCELLED="CANCELLED",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.ON_HOLD="ON_HOLD",e.PENDING="PENDING",e.REFUNDED="REFUNDED",e.REVERSED="REVERSED",e))(rE||{}),aE=(e=>(e.Provider="Provider",e.User="User",e))(aE||{}),Gm=(e=>(e.BankAccount="BankAccount",e.Bill="Bill",e.DebitCard="DebitCard",e.DigitalAccount="DigitalAccount",e.OneTimePayment="OneTimePayment",e.VirtualCard="VirtualCard",e))(Gm||{}),Jm=(e=>(e.INSTANT="INSTANT",e.SAME_DAY="SAME_DAY",e.STANDARD="STANDARD",e))(Jm||{}),Qm=(e=>(e.CANCELLED="CANCELLED",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.INITIALIZED="INITIALIZED",e.PENDING="PENDING",e.REFUNDED="REFUNDED",e.REVERSAL_IN_PROGRESS="REVERSAL_IN_PROGRESS",e.REVERSED="REVERSED",e.SCHEDULED="SCHEDULED",e.SENT="SENT",e))(Qm||{}),Ho=(e=>(e.USPhysicalDebitCard="USPhysicalDebitCard",e.USVirtualDebitCard="USVirtualDebitCard",e))(Ho||{});const oE=fe.object({transitNumber:fe.string().length(5,{message:"Transit number must be exactly 5 characters long"}).regex(/^[0-9]{5}$/,"Transit number should contain only digits."),institutionNumber:fe.string().length(3,{message:"Institution number must be exactly 3 characters long"}).regex(/^[0-9]{3}$/,"Institution number should contain only digits.")}),sE=fe.object({routingNumber:fe.string().length(9,{message:"Routing number must be exactly 9 characters long"}).regex(/^[0-9]{9}$/,"Routing number should contain only digits.")}),cE=fe.object({iban:fe.string().min(15,{message:"IBAN must be at least 15 characters long"}).max(34,{message:"IBAN must be at most 34 characters long"}).regex(/^[A-Z]{2}[0-9]{2}[A-Z0-9]+$/,"IBAN must start with 2 letters, followed by 2 digits, then alphanumeric characters")}),lE=fe.object({sortCode:fe.string().length(6,{message:"Sort code must be exactly 6 characters long"}).regex(/^[0-9]{6}$/,"Sort code should contain only digits.")}),dE={[ut.CABankAccount]:oE,[ut.USBankAccount]:sE,[ut.IbanAccount]:cE,[ut.UKBankAccount]:lE};class fE{client;constructor(n){this.client=n}async list(){return(await this.client.query({query:it}))?.bankAccounts??[]}async rename(n,t){return(await this.client.query({query:tt,variables:{accountId:n,name:t}}))?.renamePayableAccount??null}async delete(n){return(await this.client.query({query:ln,variables:{accountId:n}}))?.deletePayableAccount??null}async createLinkToken(){return this.client.restApi({method:"post",path:"/v1/bank-accounts/link-token"})}async completeLinking(n){return this.client.restApi({method:"post",path:"/v1/bank-accounts/link-complete",body:n})}async create(n,t){const u=dE[n]??iE("Invalid bank account type");try{const i=u.parse(t);return(await this.client.query({query:nt,variables:{createAccountInput:{accountNumber:t.accountNumber,name:t.name??null,type:n,subType:t.subType,details:i,email:t.email??null,ownedByUser:t.ownedByUser??null}}}))?.createBankAccount??null}catch(i){throw i instanceof fe.ZodError?new Error(i?.issues?.[0]?.message??"Input validation failure"):i}}}var ii={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"BillFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Bill"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"country"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"currency"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"originator"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"payable"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"verifying"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"billType"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"billAccountDetails"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"balance"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"amountDue"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"openedAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"lastPaymentAmount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"lastPaymentDate"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"nextPaymentDueDate"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"nextPaymentMinimumAmount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"lastStatementBalance"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"remainingStatementBalance"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"dataSync"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"lastSync"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"syncStatus"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"institution"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"logo"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"paymentAddresses"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"network"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"address"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:588}};ii.loc.source={body:`fragment BillFragment on Bill {
|
|
198
|
+
`,name:"GraphQL request",locationOffset:{line:1,column:1}};var Rm={};function nE(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return Rm[t]?!1:(Rm[t]=!0,!0)})}it.definitions=it.definitions.concat(nE(ti.definitions));function gu(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){gu(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){gu(u,n)}),e.definitions&&e.definitions.forEach(function(u){gu(u,n)})}var Qo={};(function(){it.definitions.forEach(function(n){if(n.name){var t=new Set;gu(n,t),Qo[n.name.value]=t}})})();function jm(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function tE(e,n){var t={kind:e.kind,definitions:[jm(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Qo[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Qo[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=jm(e,o);s&&t.definitions.push(s)}),t}tE(it,"UserBankAccounts");function iE(e){throw new Error(e)}var uE=(e=>(e.Active="Active",e.Error="Error",e.Syncing="Syncing",e.Unavailable="Unavailable",e))(uE||{}),Lm=(e=>(e.AMOUNT_RECEIVED="AMOUNT_RECEIVED",e.TOTAL_AMOUNT="TOTAL_AMOUNT",e))(Lm||{}),Zm=(e=>(e.Business="Business",e.Checking="Checking",e.Savings="Savings",e))(Zm||{}),ut=(e=>(e.CABankAccount="CABankAccount",e.IbanAccount="IbanAccount",e.UKBankAccount="UKBankAccount",e.USBankAccount="USBankAccount",e))(ut||{}),Vm=(e=>(e.AutoLoan="AutoLoan",e.CreditCard="CreditCard",e.Loan="Loan",e.MobilePhone="MobilePhone",e.Mortgage="Mortgage",e.StudentLoan="StudentLoan",e.Unknown="Unknown",e.Utility="Utility",e))(Vm||{}),qm=(e=>(e.Mastercard="Mastercard",e.Visa="Visa",e))(qm||{}),Mm=(e=>(e.COMPLETED="COMPLETED",e.CONFIRMED="CONFIRMED",e.CREATED="CREATED",e.FAILED="FAILED",e.FAILED_VALIDATION="FAILED_VALIDATION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.PENDING="PENDING",e.REFUNDED="REFUNDED",e.TRANSACTION_FAILED="TRANSACTION_FAILED",e.TRANSACTION_PENDING="TRANSACTION_PENDING",e))(Mm||{}),rt=(e=>(e.ACTIVE="ACTIVE",e.DISABLED="DISABLED",e.FAILED="FAILED",e.INITIALIZED="INITIALIZED",e.LOADING="LOADING",e.RETRY="RETRY",e.UNAVAILABLE="UNAVAILABLE",e.UNDER_REVIEW="UNDER_REVIEW",e.UNINITIALIZED="UNINITIALIZED",e))(rt||{}),rE=(e=>(e.AWAITING_FUNDS="AWAITING_FUNDS",e.CANCELLED="CANCELLED",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.ON_HOLD="ON_HOLD",e.PENDING="PENDING",e.REFUNDED="REFUNDED",e.REVERSED="REVERSED",e))(rE||{}),aE=(e=>(e.Provider="Provider",e.User="User",e))(aE||{}),Gm=(e=>(e.BankAccount="BankAccount",e.Bill="Bill",e.DebitCard="DebitCard",e.DigitalAccount="DigitalAccount",e.OneTimePayment="OneTimePayment",e.VirtualCard="VirtualCard",e))(Gm||{}),Jm=(e=>(e.INSTANT="INSTANT",e.SAME_DAY="SAME_DAY",e.STANDARD="STANDARD",e))(Jm||{}),Qm=(e=>(e.CANCELLED="CANCELLED",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.INITIALIZED="INITIALIZED",e.PENDING="PENDING",e.REFUNDED="REFUNDED",e.REVERSAL_IN_PROGRESS="REVERSAL_IN_PROGRESS",e.REVERSED="REVERSED",e.SCHEDULED="SCHEDULED",e.SENT="SENT",e))(Qm||{}),Ho=(e=>(e.USPhysicalDebitCard="USPhysicalDebitCard",e.USVirtualDebitCard="USVirtualDebitCard",e))(Ho||{});const oE=fe.object({transitNumber:fe.string().length(5,{message:"Transit number must be exactly 5 characters long"}).regex(/^[0-9]{5}$/,"Transit number should contain only digits."),institutionNumber:fe.string().length(3,{message:"Institution number must be exactly 3 characters long"}).regex(/^[0-9]{3}$/,"Institution number should contain only digits.")}),sE=fe.object({routingNumber:fe.string().length(9,{message:"Routing number must be exactly 9 characters long"}).regex(/^[0-9]{9}$/,"Routing number should contain only digits.")}),cE=fe.object({iban:fe.string().min(15,{message:"IBAN must be at least 15 characters long"}).max(34,{message:"IBAN must be at most 34 characters long"}).regex(/^[A-Z]{2}[0-9]{2}[A-Z0-9]+$/,"IBAN must start with 2 letters, followed by 2 digits, then alphanumeric characters")}),lE=fe.object({sortCode:fe.string().length(6,{message:"Sort code must be exactly 6 characters long"}).regex(/^[0-9]{6}$/,"Sort code should contain only digits.")}),dE={[ut.CABankAccount]:oE,[ut.USBankAccount]:sE,[ut.IbanAccount]:cE,[ut.UKBankAccount]:lE};class fE{client;constructor(n){this.client=n}async list(){return(await this.client.query({query:it}))?.bankAccounts??[]}async rename(n,t){return(await this.client.query({query:tt,variables:{accountId:n,name:t}}))?.renamePayableAccount??null}async delete(n){return(await this.client.query({query:ln,variables:{accountId:n}}))?.deletePayableAccount??null}async createLinkToken(n){return this.client.restApi({method:"post",path:"/v1/bank-accounts/link-token",body:n})}async completeLinking(n){return this.client.restApi({method:"post",path:"/v1/bank-accounts/link-complete",body:n})}async create(n,t){const u=dE[n]??iE("Invalid bank account type");try{const i=u.parse(t);return(await this.client.query({query:nt,variables:{createAccountInput:{accountNumber:t.accountNumber,name:t.name??null,type:n,subType:t.subType,details:i,email:t.email??null,ownedByUser:t.ownedByUser??null}}}))?.createBankAccount??null}catch(i){throw i instanceof fe.ZodError?new Error(i?.issues?.[0]?.message??"Input validation failure"):i}}}var ii={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"BillFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Bill"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"country"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"currency"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"originator"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"payable"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"verifying"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"billType"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"billAccountDetails"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"balance"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"amountDue"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"openedAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"lastPaymentAmount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"lastPaymentDate"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"nextPaymentDueDate"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"nextPaymentMinimumAmount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"lastStatementBalance"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"remainingStatementBalance"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"dataSync"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"lastSync"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"syncStatus"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"institution"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"logo"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"paymentAddresses"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"network"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"address"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:588}};ii.loc.source={body:`fragment BillFragment on Bill {
|
|
199
199
|
id
|
|
200
200
|
name
|
|
201
201
|
userId
|
|
@@ -9481,7 +9481,34 @@ interface operations {
|
|
|
9481
9481
|
path?: never;
|
|
9482
9482
|
cookie?: never;
|
|
9483
9483
|
};
|
|
9484
|
-
requestBody
|
|
9484
|
+
requestBody: {
|
|
9485
|
+
content: {
|
|
9486
|
+
"application/json": {
|
|
9487
|
+
/**
|
|
9488
|
+
* @description Plaid OAuth redirect target. For web, use a URL. For iOS, use a universal link. For Android, use the package name.
|
|
9489
|
+
* @example https://app.example.com/plaid/oauth-return
|
|
9490
|
+
* @example com.example.app
|
|
9491
|
+
*/
|
|
9492
|
+
redirectUri?: string;
|
|
9493
|
+
} | Record<string, never>;
|
|
9494
|
+
"application/x-www-form-urlencoded": {
|
|
9495
|
+
/**
|
|
9496
|
+
* @description Plaid OAuth redirect target. For web, use a URL. For iOS, use a universal link. For Android, use the package name.
|
|
9497
|
+
* @example https://app.example.com/plaid/oauth-return
|
|
9498
|
+
* @example com.example.app
|
|
9499
|
+
*/
|
|
9500
|
+
redirectUri?: string;
|
|
9501
|
+
} | Record<string, never>;
|
|
9502
|
+
"multipart/form-data": {
|
|
9503
|
+
/**
|
|
9504
|
+
* @description Plaid OAuth redirect target. For web, use a URL. For iOS, use a universal link. For Android, use the package name.
|
|
9505
|
+
* @example https://app.example.com/plaid/oauth-return
|
|
9506
|
+
* @example com.example.app
|
|
9507
|
+
*/
|
|
9508
|
+
redirectUri?: string;
|
|
9509
|
+
} | Record<string, never>;
|
|
9510
|
+
};
|
|
9511
|
+
};
|
|
9485
9512
|
responses: {
|
|
9486
9513
|
/** @description Response for status 200 */
|
|
9487
9514
|
200: {
|
|
@@ -25063,6 +25090,7 @@ interface RenameBankAccount_renamePayableAccount_BankAccount {
|
|
|
25063
25090
|
}
|
|
25064
25091
|
|
|
25065
25092
|
type LinkTokenResponse = PathResponse<'/v1/bank-accounts/link-token', 'post'>;
|
|
25093
|
+
type CreateLinkTokenRequest = PathRequestBody<'/v1/bank-accounts/link-token', 'post'>;
|
|
25066
25094
|
type CompleteLinkingRequest = PathRequestBody<'/v1/bank-accounts/link-complete', 'post'>;
|
|
25067
25095
|
type BaseBankAccountInput = Omit<BankAccountInput, 'details' | 'type'>;
|
|
25068
25096
|
type UsBankAccountInput = BaseBankAccountInput & {
|
|
@@ -25088,7 +25116,7 @@ declare class BankAccountService {
|
|
|
25088
25116
|
list(): Promise<UserBankAccounts_bankAccounts[]>;
|
|
25089
25117
|
rename(accountId: string, name: string): Promise<RenameBankAccount_renamePayableAccount_BankAccount>;
|
|
25090
25118
|
delete(accountId: string): Promise<DeletePayableAccount_deletePayableAccount_BankAccount>;
|
|
25091
|
-
createLinkToken(): Promise<{
|
|
25119
|
+
createLinkToken(input?: CreateLinkTokenRequest): Promise<{
|
|
25092
25120
|
linkToken: string;
|
|
25093
25121
|
hostedLinkUrl: string | null;
|
|
25094
25122
|
expiration: string;
|
|
@@ -195,7 +195,7 @@ query UserBankAccounts {
|
|
|
195
195
|
...BankAccountFragment
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
|
-
`,name:"GraphQL request",locationOffset:{line:1,column:1}};var Pm={};function tE(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return Pm[t]?!1:(Pm[t]=!0,!0)})}it.definitions=it.definitions.concat(tE(ti.definitions));function gu(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){gu(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){gu(u,n)}),e.definitions&&e.definitions.forEach(function(u){gu(u,n)})}var Qo={};(function(){it.definitions.forEach(function(n){if(n.name){var t=new Set;gu(n,t),Qo[n.name.value]=t}})})();function Rm(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function iE(e,n){var t={kind:e.kind,definitions:[Rm(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Qo[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Qo[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=Rm(e,o);s&&t.definitions.push(s)}),t}iE(it,"UserBankAccounts");function uE(e){throw new Error(e)}var rE=(e=>(e.Active="Active",e.Error="Error",e.Syncing="Syncing",e.Unavailable="Unavailable",e))(rE||{}),jm=(e=>(e.AMOUNT_RECEIVED="AMOUNT_RECEIVED",e.TOTAL_AMOUNT="TOTAL_AMOUNT",e))(jm||{}),Lm=(e=>(e.Business="Business",e.Checking="Checking",e.Savings="Savings",e))(Lm||{}),ut=(e=>(e.CABankAccount="CABankAccount",e.IbanAccount="IbanAccount",e.UKBankAccount="UKBankAccount",e.USBankAccount="USBankAccount",e))(ut||{}),Zm=(e=>(e.AutoLoan="AutoLoan",e.CreditCard="CreditCard",e.Loan="Loan",e.MobilePhone="MobilePhone",e.Mortgage="Mortgage",e.StudentLoan="StudentLoan",e.Unknown="Unknown",e.Utility="Utility",e))(Zm||{}),Vm=(e=>(e.Mastercard="Mastercard",e.Visa="Visa",e))(Vm||{}),qm=(e=>(e.COMPLETED="COMPLETED",e.CONFIRMED="CONFIRMED",e.CREATED="CREATED",e.FAILED="FAILED",e.FAILED_VALIDATION="FAILED_VALIDATION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.PENDING="PENDING",e.REFUNDED="REFUNDED",e.TRANSACTION_FAILED="TRANSACTION_FAILED",e.TRANSACTION_PENDING="TRANSACTION_PENDING",e))(qm||{}),rt=(e=>(e.ACTIVE="ACTIVE",e.DISABLED="DISABLED",e.FAILED="FAILED",e.INITIALIZED="INITIALIZED",e.LOADING="LOADING",e.RETRY="RETRY",e.UNAVAILABLE="UNAVAILABLE",e.UNDER_REVIEW="UNDER_REVIEW",e.UNINITIALIZED="UNINITIALIZED",e))(rt||{}),aE=(e=>(e.AWAITING_FUNDS="AWAITING_FUNDS",e.CANCELLED="CANCELLED",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.ON_HOLD="ON_HOLD",e.PENDING="PENDING",e.REFUNDED="REFUNDED",e.REVERSED="REVERSED",e))(aE||{}),oE=(e=>(e.Provider="Provider",e.User="User",e))(oE||{}),Mm=(e=>(e.BankAccount="BankAccount",e.Bill="Bill",e.DebitCard="DebitCard",e.DigitalAccount="DigitalAccount",e.OneTimePayment="OneTimePayment",e.VirtualCard="VirtualCard",e))(Mm||{}),Gm=(e=>(e.INSTANT="INSTANT",e.SAME_DAY="SAME_DAY",e.STANDARD="STANDARD",e))(Gm||{}),Jm=(e=>(e.CANCELLED="CANCELLED",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.INITIALIZED="INITIALIZED",e.PENDING="PENDING",e.REFUNDED="REFUNDED",e.REVERSAL_IN_PROGRESS="REVERSAL_IN_PROGRESS",e.REVERSED="REVERSED",e.SCHEDULED="SCHEDULED",e.SENT="SENT",e))(Jm||{}),Ho=(e=>(e.USPhysicalDebitCard="USPhysicalDebitCard",e.USVirtualDebitCard="USVirtualDebitCard",e))(Ho||{});const sE=fe.object({transitNumber:fe.string().length(5,{message:"Transit number must be exactly 5 characters long"}).regex(/^[0-9]{5}$/,"Transit number should contain only digits."),institutionNumber:fe.string().length(3,{message:"Institution number must be exactly 3 characters long"}).regex(/^[0-9]{3}$/,"Institution number should contain only digits.")}),cE=fe.object({routingNumber:fe.string().length(9,{message:"Routing number must be exactly 9 characters long"}).regex(/^[0-9]{9}$/,"Routing number should contain only digits.")}),lE=fe.object({iban:fe.string().min(15,{message:"IBAN must be at least 15 characters long"}).max(34,{message:"IBAN must be at most 34 characters long"}).regex(/^[A-Z]{2}[0-9]{2}[A-Z0-9]+$/,"IBAN must start with 2 letters, followed by 2 digits, then alphanumeric characters")}),dE=fe.object({sortCode:fe.string().length(6,{message:"Sort code must be exactly 6 characters long"}).regex(/^[0-9]{6}$/,"Sort code should contain only digits.")}),fE={[ut.CABankAccount]:sE,[ut.USBankAccount]:cE,[ut.IbanAccount]:lE,[ut.UKBankAccount]:dE};class mE{client;constructor(n){this.client=n}async list(){return(await this.client.query({query:it}))?.bankAccounts??[]}async rename(n,t){return(await this.client.query({query:tt,variables:{accountId:n,name:t}}))?.renamePayableAccount??null}async delete(n){return(await this.client.query({query:ln,variables:{accountId:n}}))?.deletePayableAccount??null}async createLinkToken(){return this.client.restApi({method:"post",path:"/v1/bank-accounts/link-token"})}async completeLinking(n){return this.client.restApi({method:"post",path:"/v1/bank-accounts/link-complete",body:n})}async create(n,t){const u=fE[n]??uE("Invalid bank account type");try{const i=u.parse(t);return(await this.client.query({query:nt,variables:{createAccountInput:{accountNumber:t.accountNumber,name:t.name??null,type:n,subType:t.subType,details:i,email:t.email??null,ownedByUser:t.ownedByUser??null}}}))?.createBankAccount??null}catch(i){throw i instanceof fe.ZodError?new Error(i?.issues?.[0]?.message??"Input validation failure"):i}}}var ii={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"BillFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Bill"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"country"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"currency"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"originator"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"payable"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"verifying"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"billType"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"billAccountDetails"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"balance"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"amountDue"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"openedAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"lastPaymentAmount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"lastPaymentDate"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"nextPaymentDueDate"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"nextPaymentMinimumAmount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"lastStatementBalance"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"remainingStatementBalance"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"dataSync"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"lastSync"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"syncStatus"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"institution"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"logo"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"paymentAddresses"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"network"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"address"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:588}};ii.loc.source={body:`fragment BillFragment on Bill {
|
|
198
|
+
`,name:"GraphQL request",locationOffset:{line:1,column:1}};var Pm={};function tE(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return Pm[t]?!1:(Pm[t]=!0,!0)})}it.definitions=it.definitions.concat(tE(ti.definitions));function gu(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(u){gu(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){gu(u,n)}),e.definitions&&e.definitions.forEach(function(u){gu(u,n)})}var Qo={};(function(){it.definitions.forEach(function(n){if(n.name){var t=new Set;gu(n,t),Qo[n.name.value]=t}})})();function Rm(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function iE(e,n){var t={kind:e.kind,definitions:[Rm(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Qo[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Qo[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=Rm(e,o);s&&t.definitions.push(s)}),t}iE(it,"UserBankAccounts");function uE(e){throw new Error(e)}var rE=(e=>(e.Active="Active",e.Error="Error",e.Syncing="Syncing",e.Unavailable="Unavailable",e))(rE||{}),jm=(e=>(e.AMOUNT_RECEIVED="AMOUNT_RECEIVED",e.TOTAL_AMOUNT="TOTAL_AMOUNT",e))(jm||{}),Lm=(e=>(e.Business="Business",e.Checking="Checking",e.Savings="Savings",e))(Lm||{}),ut=(e=>(e.CABankAccount="CABankAccount",e.IbanAccount="IbanAccount",e.UKBankAccount="UKBankAccount",e.USBankAccount="USBankAccount",e))(ut||{}),Zm=(e=>(e.AutoLoan="AutoLoan",e.CreditCard="CreditCard",e.Loan="Loan",e.MobilePhone="MobilePhone",e.Mortgage="Mortgage",e.StudentLoan="StudentLoan",e.Unknown="Unknown",e.Utility="Utility",e))(Zm||{}),Vm=(e=>(e.Mastercard="Mastercard",e.Visa="Visa",e))(Vm||{}),qm=(e=>(e.COMPLETED="COMPLETED",e.CONFIRMED="CONFIRMED",e.CREATED="CREATED",e.FAILED="FAILED",e.FAILED_VALIDATION="FAILED_VALIDATION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.PENDING="PENDING",e.REFUNDED="REFUNDED",e.TRANSACTION_FAILED="TRANSACTION_FAILED",e.TRANSACTION_PENDING="TRANSACTION_PENDING",e))(qm||{}),rt=(e=>(e.ACTIVE="ACTIVE",e.DISABLED="DISABLED",e.FAILED="FAILED",e.INITIALIZED="INITIALIZED",e.LOADING="LOADING",e.RETRY="RETRY",e.UNAVAILABLE="UNAVAILABLE",e.UNDER_REVIEW="UNDER_REVIEW",e.UNINITIALIZED="UNINITIALIZED",e))(rt||{}),aE=(e=>(e.AWAITING_FUNDS="AWAITING_FUNDS",e.CANCELLED="CANCELLED",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.ON_HOLD="ON_HOLD",e.PENDING="PENDING",e.REFUNDED="REFUNDED",e.REVERSED="REVERSED",e))(aE||{}),oE=(e=>(e.Provider="Provider",e.User="User",e))(oE||{}),Mm=(e=>(e.BankAccount="BankAccount",e.Bill="Bill",e.DebitCard="DebitCard",e.DigitalAccount="DigitalAccount",e.OneTimePayment="OneTimePayment",e.VirtualCard="VirtualCard",e))(Mm||{}),Gm=(e=>(e.INSTANT="INSTANT",e.SAME_DAY="SAME_DAY",e.STANDARD="STANDARD",e))(Gm||{}),Jm=(e=>(e.CANCELLED="CANCELLED",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.INITIALIZED="INITIALIZED",e.PENDING="PENDING",e.REFUNDED="REFUNDED",e.REVERSAL_IN_PROGRESS="REVERSAL_IN_PROGRESS",e.REVERSED="REVERSED",e.SCHEDULED="SCHEDULED",e.SENT="SENT",e))(Jm||{}),Ho=(e=>(e.USPhysicalDebitCard="USPhysicalDebitCard",e.USVirtualDebitCard="USVirtualDebitCard",e))(Ho||{});const sE=fe.object({transitNumber:fe.string().length(5,{message:"Transit number must be exactly 5 characters long"}).regex(/^[0-9]{5}$/,"Transit number should contain only digits."),institutionNumber:fe.string().length(3,{message:"Institution number must be exactly 3 characters long"}).regex(/^[0-9]{3}$/,"Institution number should contain only digits.")}),cE=fe.object({routingNumber:fe.string().length(9,{message:"Routing number must be exactly 9 characters long"}).regex(/^[0-9]{9}$/,"Routing number should contain only digits.")}),lE=fe.object({iban:fe.string().min(15,{message:"IBAN must be at least 15 characters long"}).max(34,{message:"IBAN must be at most 34 characters long"}).regex(/^[A-Z]{2}[0-9]{2}[A-Z0-9]+$/,"IBAN must start with 2 letters, followed by 2 digits, then alphanumeric characters")}),dE=fe.object({sortCode:fe.string().length(6,{message:"Sort code must be exactly 6 characters long"}).regex(/^[0-9]{6}$/,"Sort code should contain only digits.")}),fE={[ut.CABankAccount]:sE,[ut.USBankAccount]:cE,[ut.IbanAccount]:lE,[ut.UKBankAccount]:dE};class mE{client;constructor(n){this.client=n}async list(){return(await this.client.query({query:it}))?.bankAccounts??[]}async rename(n,t){return(await this.client.query({query:tt,variables:{accountId:n,name:t}}))?.renamePayableAccount??null}async delete(n){return(await this.client.query({query:ln,variables:{accountId:n}}))?.deletePayableAccount??null}async createLinkToken(n){return this.client.restApi({method:"post",path:"/v1/bank-accounts/link-token",body:n})}async completeLinking(n){return this.client.restApi({method:"post",path:"/v1/bank-accounts/link-complete",body:n})}async create(n,t){const u=fE[n]??uE("Invalid bank account type");try{const i=u.parse(t);return(await this.client.query({query:nt,variables:{createAccountInput:{accountNumber:t.accountNumber,name:t.name??null,type:n,subType:t.subType,details:i,email:t.email??null,ownedByUser:t.ownedByUser??null}}}))?.createBankAccount??null}catch(i){throw i instanceof fe.ZodError?new Error(i?.issues?.[0]?.message??"Input validation failure"):i}}}var ii={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"BillFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Bill"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"country"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"currency"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"originator"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"payable"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"verifying"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"billType"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"billAccountDetails"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"balance"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"amountDue"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"openedAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"lastPaymentAmount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"lastPaymentDate"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"nextPaymentDueDate"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"nextPaymentMinimumAmount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"lastStatementBalance"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"remainingStatementBalance"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"dataSync"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"lastSync"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"syncStatus"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"institution"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"logo"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"paymentAddresses"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"network"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"address"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:588}};ii.loc.source={body:`fragment BillFragment on Bill {
|
|
199
199
|
id
|
|
200
200
|
name
|
|
201
201
|
userId
|