-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<img width="1421" alt="Screenshot 2024-12-02 at 3 57 09 PM" src="https://github.com/user-attachments/assets/758be296-948d-41ed-bab9-062cef2cef83"> <img width="1407" alt="Screenshot 2024-12-02 at 3 59 32 PM" src="https://github.com/user-attachments/assets/38bb97c7-5c6e-4b9e-8113-bbeba10e5a53">
- Loading branch information
Showing
5 changed files
with
130 additions
and
2 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<template> | ||
<v-layout> | ||
<v-row> | ||
<v-col cols="12" md="4"> | ||
<v-form> | ||
<v-text-field v-model="formData.trackingRef" label="Tracking Ref" /> | ||
<v-text-field | ||
v-model="formData.accountNumber" | ||
label="Account Number" | ||
/> | ||
<v-text-field v-model="formData.amount" label="Amount" /> | ||
<v-btn | ||
v-if="isSandbox" | ||
depressed | ||
class="mb-7" | ||
color="primary" | ||
:loading="loading" | ||
@click.prevent="makeApiCall" | ||
> | ||
Make api call | ||
</v-btn> | ||
</v-form> | ||
</v-col> | ||
<v-col cols="12" md="8"> | ||
<RequestInfo | ||
:url="requestUrl" | ||
:payload="payload" | ||
:response="response" | ||
/> | ||
</v-col> | ||
</v-row> | ||
<ErrorSheet | ||
:error="error" | ||
:show-error="showError" | ||
@onChange="onErrorSheetClosed" | ||
/> | ||
</v-layout> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { Component, Vue } from 'nuxt-property-decorator' | ||
import { mapGetters } from 'vuex' | ||
import { getLive } from '../../../../lib/apiTarget' | ||
import RequestInfo from '../../../../components/RequestInfo.vue' | ||
import ErrorSheet from '../../../../components/ErrorSheet.vue' | ||
import { CreateMockPixPushPaymentPayload } from '~/lib/mocksApi' | ||
@Component({ | ||
components: { | ||
RequestInfo, | ||
ErrorSheet, | ||
}, | ||
computed: { | ||
...mapGetters({ | ||
payload: 'getRequestPayload', | ||
response: 'getRequestResponse', | ||
requestUrl: 'getRequestUrl', | ||
}), | ||
}, | ||
}) | ||
export default class CreateMockIncomingPixClass extends Vue { | ||
formData = { | ||
trackingRef: '', | ||
accountNumber: '', | ||
amount: '0.00', | ||
currency: 'BRL', | ||
} | ||
isSandbox: Boolean = !getLive() | ||
required = [(v: string) => !!v || 'Field is required'] | ||
error = {} | ||
loading = false | ||
showError = false | ||
onErrorSheetClosed() { | ||
this.error = {} | ||
this.showError = false | ||
} | ||
async makeApiCall() { | ||
this.loading = true | ||
const amountDetail = { | ||
amount: this.formData.amount, | ||
currency: this.formData.currency, | ||
} | ||
const payload: CreateMockPixPushPaymentPayload = { | ||
trackingRef: this.formData.trackingRef, | ||
accountNumber: this.formData.accountNumber, | ||
amount: amountDetail, | ||
} | ||
try { | ||
await this.$mocksApi.createMockPixPyament(payload) | ||
} catch (error) { | ||
this.error = error | ||
this.showError = true | ||
} finally { | ||
this.loading = false | ||
} | ||
} | ||
} | ||
</script> |
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