From 53a4c37d8f2efb157cb3d7cb8c876d3ebadb4159 Mon Sep 17 00:00:00 2001 From: Yitian Xue Date: Mon, 2 Dec 2024 15:41:15 -0500 Subject: [PATCH 1/3] support BRL fx --- layouts/default.vue | 4 + lib/mocksApi.ts | 17 ++++ .../debug/businessAccount/payouts/create.vue | 9 +- pages/debug/payments/mocks/pix.vue | 97 +++++++++++++++++++ plugins/mocksApi.ts | 2 + 5 files changed, 127 insertions(+), 2 deletions(-) create mode 100644 pages/debug/payments/mocks/pix.vue diff --git a/layouts/default.vue b/layouts/default.vue index f0da18a5..03446c69 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -314,6 +314,10 @@ export default class DefaultLayoutsClass extends Vue { title: 'POST /mocks/payments/wire', to: '/debug/payments/mocks/wire', }, + { + title: 'POST /mocks/payments/pix', + to: '/debug/payments/mocks/pix', + }, { title: 'POST /businessAccount/banks/cbit', to: '/debug/businessAccount/cbitAccounts/create', diff --git a/lib/mocksApi.ts b/lib/mocksApi.ts index 3c38d884..15187964 100644 --- a/lib/mocksApi.ts +++ b/lib/mocksApi.ts @@ -16,6 +16,14 @@ export interface CreateMockPushPaymentPayload { rail: string } +export interface CreateMockPixPushPaymentPayload { + trackingRef: string + accountNumber: string + amount: { + amount: string + } +} + export interface CreateMockChargebackPayload { paymentId: string } @@ -59,6 +67,14 @@ function createMockWirePayment(payload: CreateMockPushPaymentPayload) { return instance.post(url, payload) } +/** + * Trigger pix payment + */ +function createMockPixPyament(payload: CreateMockPixPushPaymentPayload) { + const url = '/v1/mocks/payments/pix' + return instance.post(url, payload) +} + /** * Create a mock chargeback * @param {*} payload @@ -72,4 +88,5 @@ export default { getInstance, createMockWirePayment, createMockChargeback, + createMockPixPyament } diff --git a/pages/debug/businessAccount/payouts/create.vue b/pages/debug/businessAccount/payouts/create.vue index 23efc81f..1fbffce8 100644 --- a/pages/debug/businessAccount/payouts/create.vue +++ b/pages/debug/businessAccount/payouts/create.vue @@ -88,14 +88,16 @@ export default class CreatePayoutClass extends Vue { } required = [(v: string) => !!v || 'Field is required'] - destinationType = ['wire', 'cbit', 'xpay', 'rtp', 'rtgs', 'sepa'] + destinationType = ['wire', 'cbit', 'xpay', 'rtp', 'rtgs', 'sepa', 'pix'] wireCurrencyTypes = ['USD', 'EUR'] cbitCurrencyTypes = ['USD'] xpayCurrencyTypes = ['USD'] rtpCurrencyTypes = ['USD'] rtgsCurrencyTypes = ['USD', 'EUR'] sepaCurrencyTypes = ['EUR'] + pixCurrencyTypes = ['USD'] fxCurrencyTypes = ['', 'SGD', 'MXN'] + pixFxCurrencyTypes = ['BRL'] currencyTypes = new Map([ ['wire', this.wireCurrencyTypes], ['cbit', this.cbitCurrencyTypes], @@ -105,7 +107,10 @@ export default class CreatePayoutClass extends Vue { ['sepa', this.sepaCurrencyTypes], ]) - toCurrencyTypes = new Map([['USDwire', this.fxCurrencyTypes]]) + toCurrencyTypes = new Map([ + ['USDwire', this.fxCurrencyTypes], + ['USDpix', this.pixFxCurrencyTypes], + ]) error = {} loading = false diff --git a/pages/debug/payments/mocks/pix.vue b/pages/debug/payments/mocks/pix.vue new file mode 100644 index 00000000..98c6594f --- /dev/null +++ b/pages/debug/payments/mocks/pix.vue @@ -0,0 +1,97 @@ + + + \ No newline at end of file diff --git a/plugins/mocksApi.ts b/plugins/mocksApi.ts index 5fe6d152..7a362641 100644 --- a/plugins/mocksApi.ts +++ b/plugins/mocksApi.ts @@ -1,5 +1,6 @@ import mocksApi, { CreateMockChargebackPayload, + CreateMockPixPushPaymentPayload, CreateMockPushPaymentPayload, } from '@/lib/mocksApi' @@ -9,6 +10,7 @@ declare module 'vue/types/vue' { getInstance: any createMockChargeback: (payload: CreateMockChargebackPayload) => any createMockWirePayment: (payload: CreateMockPushPaymentPayload) => any + createMockPixPyament: (payload: CreateMockPixPushPaymentPayload) => any } } } From 1deb27f80719489f0a494ed1bb7334d421ea0121 Mon Sep 17 00:00:00 2001 From: Yitian Xue Date: Mon, 2 Dec 2024 15:48:52 -0500 Subject: [PATCH 2/3] fix warning --- lib/mocksApi.ts | 2 +- pages/debug/businessAccount/payouts/create.vue | 1 + pages/debug/payments/mocks/pix.vue | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/mocksApi.ts b/lib/mocksApi.ts index 15187964..3de612f1 100644 --- a/lib/mocksApi.ts +++ b/lib/mocksApi.ts @@ -88,5 +88,5 @@ export default { getInstance, createMockWirePayment, createMockChargeback, - createMockPixPyament + createMockPixPyament, } diff --git a/pages/debug/businessAccount/payouts/create.vue b/pages/debug/businessAccount/payouts/create.vue index 1fbffce8..2dbed647 100644 --- a/pages/debug/businessAccount/payouts/create.vue +++ b/pages/debug/businessAccount/payouts/create.vue @@ -105,6 +105,7 @@ export default class CreatePayoutClass extends Vue { ['rtp', this.rtpCurrencyTypes], ['rtgs', this.rtgsCurrencyTypes], ['sepa', this.sepaCurrencyTypes], + ['pix', this.pixCurrencyTypes], ]) toCurrencyTypes = new Map([ diff --git a/pages/debug/payments/mocks/pix.vue b/pages/debug/payments/mocks/pix.vue index 98c6594f..ce7d7ccc 100644 --- a/pages/debug/payments/mocks/pix.vue +++ b/pages/debug/payments/mocks/pix.vue @@ -64,6 +64,7 @@ export default class CreateMockIncomingPixClass extends Vue { amount: '0.00', currency: 'BRL', } + isSandbox: Boolean = !getLive() required = [(v: string) => !!v || 'Field is required'] error = {} @@ -73,6 +74,7 @@ export default class CreateMockIncomingPixClass extends Vue { this.error = {} this.showError = false } + async makeApiCall() { this.loading = true const amountDetail = { @@ -94,4 +96,4 @@ export default class CreateMockIncomingPixClass extends Vue { } } } - \ No newline at end of file + From a797f2b0186c9a4874e43390fd6ef6c65451d336 Mon Sep 17 00:00:00 2001 From: Yitian Xue Date: Mon, 2 Dec 2024 16:06:53 -0500 Subject: [PATCH 3/3] trigger build