Created
August 28, 2020 18:50
-
-
Save dncrews/abd3505bc33d873a06015f12a600aba9 to your computer and use it in GitHub Desktop.
Dwolla TypeDefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare module 'dwolla-v2' { | |
export class Client { | |
apiUrl: string; | |
constructor(args: DwollaClientArgs); | |
delete(uri: string): Promise<DwollaClientResult>; | |
get(uri: string): Promise<DwollaClientResult>; | |
post(uri: string, payload: {}, headers?: DwollaHeaders): Promise<DwollaClientResult>; | |
} | |
export interface DwollaAchResult extends DwollaResultBody { | |
accountNumber: string; | |
routingNumber: string; | |
} | |
export interface DwollaClientArgs { | |
environment: string; | |
key: string; | |
secret: string; | |
} | |
export interface DwollaClientResult { | |
body: DwollaResultBody; | |
headers: DwollaHeaders; | |
} | |
export interface DwollaCustomerResult extends DwollaResultBody { | |
email: string; | |
firstName: string; | |
lastName: string; | |
} | |
export type DwollaFundingSourceChannel = 'ach' | 'wire'; | |
export interface DwollaFundingSourceResult extends DwollaResultBody { | |
id: string; | |
bankAccountType: 'checking' | 'savings' | 'general-ledger' | 'loan'; | |
bankName: string; | |
channels: DwollaFundingSourceChannel[]; | |
created: string; | |
fingerprint: string; | |
name: string; | |
removed: boolean; | |
status: DwollaFundingSourceStatus; | |
type: 'bank' | 'balance'; | |
} | |
export type DwollaFundingSourceStatus = 'unverified' | 'verified'; | |
export interface DwollaMassPaymentItem { | |
_links: DwollaMassPaymentItemLinks; | |
amount: { | |
currency: string; | |
value: string; | |
}; | |
clearing: { | |
destination: string; | |
}; | |
metadata: { | |
payment1: string; | |
}; | |
achDetails: { | |
destination: { | |
addenda: { | |
values: string[]; | |
}; | |
}; | |
}; | |
correlationId: string; | |
} | |
export interface DwollaMassPaymentItemLinks extends DwollaResultLinks { | |
destination: DwollaLink; | |
} | |
export interface DwollaMassPaymentLinks extends DwollaResultLinks { | |
source: DwollaLink; | |
} | |
export interface DwollaMassPaymentResult extends DwollaResultBody { | |
_links: DwollaMassPaymentLinks; | |
achDetails: { | |
source: { | |
addenda: { | |
values: ['ABC123_AddendaValue']; | |
}; | |
}; | |
}; | |
clearing: { | |
source: string; | |
}; | |
items: DwollaMassPaymentItem[]; | |
metadata: { [key: string]: string }; | |
correlationId: string; | |
} | |
export interface DwollaTransferFailureResult extends DwollaResultBody { | |
code: string; | |
description: string; | |
} | |
export interface DwollaTransferResult extends DwollaResultBody { | |
id: string; | |
amount: { | |
value: string; | |
currency: string; | |
}; | |
clearing: { | |
source: string; | |
}; | |
correlationId: string; | |
created: string; | |
metadata: { [key: string]: string }; | |
status: string; | |
} | |
export interface DwollaHeaders { | |
get?: (key: string) => string; | |
[key: string]: string | Function; | |
} | |
export interface DwollaLink { | |
href: string; | |
'resource-type'?: string; | |
type?: string; | |
} | |
export interface DwollaResultBody { | |
_links: DwollaResultLinks; | |
resourceId?: string; | |
[key: string]: string | any; | |
} | |
export interface DwollaResultLinks { | |
[key: string]: DwollaLink; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment