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

Sample App Audit #249

Merged
18 changes: 3 additions & 15 deletions lib/businessAccount/senAccountsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { getAPIHostname } from '../apiTarget'
export interface CreateSenAccountPayload {
idempotencyKey: string
accountNumber: string
currency: string
}

const instance = axios.create({
Expand Down Expand Up @@ -33,13 +34,6 @@ instance.interceptors.response.use(
}
)

const nullIfEmpty = (prop: string | undefined) => {
if (prop !== undefined && prop.trim() === '') {
return undefined
}
return prop
}

/** Returns the axios instance */
function getInstance() {
return instance
Expand Down Expand Up @@ -75,15 +69,9 @@ function getSenBusinessAccountById(accountId: string) {
* Get sen business account instructions
* @param {String} accountId
*/
function getSenBusinessAccountInstructions(
accountId: string,
currency: string
) {
function getSenBusinessAccountInstructions(accountId: string) {
const url = `v1/businessAccount/banks/sen/${accountId}/instructions`
const queryParams = {
currency: nullIfEmpty(currency),
}
return instance.get(url, { params: queryParams })
return instance.get(url)
}

export default {
Expand Down
2 changes: 1 addition & 1 deletion pages/debug/businessAccount/payouts/create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default class CreatePayoutClass extends Vue {
amount: '0.00',
destination: '',
destinationType: 'wire', // Default to wire
currency: 'USD', // Default to USD
currency: '',
}

required = [(v: string) => !!v || 'Field is required']
Expand Down
8 changes: 8 additions & 0 deletions pages/debug/businessAccount/senAccounts/create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
v-model="formData.accountNumber"
label="Account Number"
/>
<v-select
v-model="formData.currency"
:items="currencyTypes"
label="Currency"
/>
<v-btn
depressed
class="mb-7"
Expand Down Expand Up @@ -58,8 +63,10 @@ export default class CreateSenBusinessAccountClass extends Vue {
// data
formData = {
accountNumber: '',
currency: '',
}

currencyTypes = ['USD', 'EUR']
required = [(v: string) => !!v || 'Field is required']
error = {}
loading = false
Expand All @@ -76,6 +83,7 @@ export default class CreateSenBusinessAccountClass extends Vue {
const payload: CreateSenAccountPayload = {
idempotencyKey: uuidv4(),
accountNumber: this.formData.accountNumber,
currency: this.formData.currency,
}

try {
Expand Down
10 changes: 1 addition & 9 deletions pages/debug/businessAccount/senAccounts/instructions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
<v-col cols="12" md="4">
<v-form>
<v-text-field v-model="formData.accountId" label="Account Id" />
<v-select
v-model="formData.currency"
:items="currencyTypes"
label="Currency"
/>
<v-btn
depressed
class="mb-7"
Expand Down Expand Up @@ -59,10 +54,8 @@ export default class FetchSenBusinessAccountInstructionsClass extends Vue {
// data
formData = {
accountId: '',
currency: '',
}

currencyTypes = ['USD', 'EUR']
required = [(v: string) => !!v || 'Field is required']
error = {}
loading = false
Expand All @@ -79,8 +72,7 @@ export default class FetchSenBusinessAccountInstructionsClass extends Vue {

try {
await this.$senAccountsApi.getSenBusinessAccountInstructions(
this.formData.accountId,
this.formData.currency
this.formData.accountId
)
} catch (error) {
this.error = error
Expand Down