Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating the wires and payout APi with the param changes #58

Merged
merged 2 commits into from
Jun 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,26 @@ export default class DefaultLayoutsClass extends Vue {
title: 'GET /settlements/{id}',
to: '/debug/settlements/details',
},
{
title: 'GET /wires/{id}',
to: '/debug/wires/details',
},
{
title: 'POST /wires',
to: '/debug/wires/create',
},
{
title: 'GET /payouts',
to: '/debug/payouts/fetch',
},
{
title: 'GET /payouts/{id}',
to: '/debug/payouts/details',
},
{
title: 'POST /payouts',
to: '/debug/payouts/create',
},
]

paymentsLinks = [
Expand Down Expand Up @@ -283,15 +303,15 @@ export default class DefaultLayoutsClass extends Vue {
},
{
title: 'GET /payouts',
to: '/debug/payments/payouts/fetch',
to: '/debug/payouts/fetch',
},
{
title: 'GET /payouts/{id}',
to: '/debug/payments/payouts/details',
to: '/debug/payouts/details',
},
{
title: 'POST /payouts',
to: '/debug/payments/payouts/create',
to: '/debug/payouts/create',
},
]

Expand Down
4 changes: 0 additions & 4 deletions lib/payoutsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export interface CreatePayoutPayload {
}
metadata: {
beneficiaryEmail: string
beneficiaryPhoneNumber: string | undefined
}
}

Expand Down Expand Up @@ -97,9 +96,6 @@ function getPayoutById(payoutId: string) {
*/
function createPayout(payload: CreatePayoutPayload) {
const url = '/v1/payouts'
payload.metadata.beneficiaryPhoneNumber = nullIfEmpty(
payload.metadata.beneficiaryPhoneNumber
)
return instance.post(url, payload)
}

Expand Down
8 changes: 4 additions & 4 deletions lib/wiresApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface CreateWireAccountPayload {
beneficiaryName: string | undefined
bankName: string | undefined
accountNumber: string | undefined
bankIdentifier: string | undefined
routingNumber: string | undefined
iban: string | undefined
billingDetails: {
name: string
Expand Down Expand Up @@ -71,11 +71,11 @@ const nullIfEmpty = (prop: string | undefined) => {
* @param {*} payload (contains form data)
*/
function createWireAccount(payload: CreateWireAccountPayload) {
const url = '/v1/wires'
const url = '/v1/banks/wires'
payload.beneficiaryName = nullIfEmpty(payload.beneficiaryName)
payload.bankName = nullIfEmpty(payload.bankName)
payload.accountNumber = nullIfEmpty(payload.accountNumber)
payload.bankIdentifier = nullIfEmpty(payload.bankIdentifier)
payload.routingNumber = nullIfEmpty(payload.routingNumber)
payload.iban = nullIfEmpty(payload.iban)
return instance.post(url, payload)
}
Expand All @@ -85,7 +85,7 @@ function createWireAccount(payload: CreateWireAccountPayload) {
* @param {String} accountId
*/
function getWireAccountById(accountId: string) {
const url = `/v1/wires/${accountId}`
const url = `/v1/banks/wires/${accountId}`

return instance.get(url)
}
Expand Down
6 changes: 3 additions & 3 deletions lib/wiresTestData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const exampleWireAccounts = [
beneficiaryName: 'Satoshi Nakamoto',
bankName: 'WELLS FARGO BANK',
accountNumber: '11111111111',
bankIdentifier: '121000248',
routingNumber: '121000248',
iban: '',
billingDetails: {
name: 'Satoshi Nakamoto',
Expand All @@ -32,7 +32,7 @@ export const exampleWireAccounts = [
beneficiaryName: 'Satoshi Nakamoto',
bankName: 'COMMERZBANK',
accountNumber: '',
bankIdentifier: '',
routingNumber: '',
iban: 'DE31100400480532013000',
billingDetails: {
name: 'Satoshi Nakamoto',
Expand All @@ -59,7 +59,7 @@ export const exampleWireAccounts = [
beneficiaryName: 'Satoshi Nakamoto',
bankName: 'Banco Nacional de México',
accountNumber: '002010077777777771',
bankIdentifier: '',
routingNumber: '',
iban: '',
billingDetails: {
name: 'Satoshi Nakamoto',
Expand Down
20 changes: 5 additions & 15 deletions pages/debug/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,7 @@
</p>
</v-card>

<v-card
v-if="!isMarketplace"
class="body-1 px-6 py-8 mb-4"
max-width="800"
outlined
>
<v-card class="body-1 px-6 py-8 mb-4" max-width="800" outlined>
<h2 class="title">Wires endpoints</h2>
<span class="caption">Requires: api key</span>
<br /><br />
Expand All @@ -179,12 +174,7 @@
</p>
</v-card>

<v-card
v-if="!isMarketplace"
class="body-1 px-6 py-8 mb-4"
max-width="800"
outlined
>
<v-card class="body-1 px-6 py-8 mb-4" max-width="800" outlined>
<h2 class="title">Payouts endpoints</h2>
<span class="caption">Requires: api key</span>
<br /><br />
Expand All @@ -193,17 +183,17 @@
</p>
<p>
<v-chip small color="primary">GET</v-chip>
<a href="/debug/payments/payouts/fetch">Get all payouts</a>
<a href="/debug/payouts/fetch">Get all payouts</a>
</p>
<p>
<v-chip small color="primary">GET</v-chip>
<a href="/debug/payments/payouts/details">
<a href="/debug/payouts/details">
Get payout details by id
</a>
</p>
<p>
<v-chip small color="primary warning">POST</v-chip>
<a href="/debug/payments/payouts/create">
<a href="/debug/payouts/create">
Add payout
</a>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@
label="Beneficiary Email"
/>

<v-text-field
v-model="formData.beneficiaryPhoneNumber"
hint="Phone number of the user in E.164 format"
label="Beneficiary Phone Number"
/>

<v-btn
depressed
class="mb-7"
Expand Down Expand Up @@ -75,7 +69,6 @@ export default class CreatePayoutClass extends Vue {
amount: '0.00',
destination: '',
beneficiaryEmail: '',
beneficiaryPhoneNumber: '',
}

required = [(v: string) => !!v || 'Field is required']
Expand All @@ -99,7 +92,6 @@ export default class CreatePayoutClass extends Vue {
destinationAccount: this.formData.destination,
metadata: {
beneficiaryEmail: this.formData.beneficiaryEmail,
beneficiaryPhoneNumber: this.formData.beneficiaryPhoneNumber,
},
}
try {
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions pages/debug/wires/create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@
/>

<v-text-field
v-model="formData.bankIdentifier"
label="Bank Identifier"
v-model="formData.routingNumber"
label="Routing Number"
hint="RTN/BIC/Swift code of the bank associated with the account. Required for US accounts"
/>

<v-text-field
v-model="formData.iban"
label="IBAN"
hint="Required for accounts outside of the US"
hint="International Bank Account Number (IBAN) that identifies the account. Required for accounts outside of the US"
/>

<v-text-field
Expand Down Expand Up @@ -173,7 +173,7 @@ export default class CreateCardClass extends Vue {
beneficiaryName: '',
bankName: '',
accountNumber: '',
bankIdentifier: '',
routingNumber: '',
iban: '',
billingDetails: {
name: '',
Expand Down Expand Up @@ -225,7 +225,7 @@ export default class CreateCardClass extends Vue {
beneficiaryName,
bankName,
accountNumber,
bankIdentifier,
routingNumber,
iban,
...data
} = this.formData
Expand All @@ -236,7 +236,7 @@ export default class CreateCardClass extends Vue {
beneficiaryName,
bankName,
accountNumber,
bankIdentifier,
routingNumber,
iban,
billingDetails: {
name: billingDetails.name,
Expand Down