Merge pull request #647 from gradido/435-Visual-Feedback-on-not-sending-GDD

#435 Visual Feedback on not sending GDD
This commit is contained in:
Alexander Friedland 2021-07-20 14:03:20 +02:00 committed by GitHub
commit 4f0c40eaed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 6 deletions

View File

@ -90,7 +90,8 @@
"transaction":{ "transaction":{
"show_all":"Alle <strong>{count}</strong> Transaktionen ansehen", "show_all":"Alle <strong>{count}</strong> Transaktionen ansehen",
"nullTransactions":"Du hast noch keine Transaktionen auf deinem Konto.", "nullTransactions":"Du hast noch keine Transaktionen auf deinem Konto.",
"more": "mehr" "more": "mehr",
"receiverNotFound":"Empfänger nicht gefunden"
}, },
"site": { "site": {
"login": { "login": {

View File

@ -90,7 +90,8 @@
"transaction":{ "transaction":{
"show_all":"View all <strong>{count}</strong> transactions.", "show_all":"View all <strong>{count}</strong> transactions.",
"nullTransactions":"You don't have any transactions on your account yet.", "nullTransactions":"You don't have any transactions on your account yet.",
"more": "more" "more": "more",
"receiverNotFound":"Recipient not found"
}, },
"site": { "site": {
"login": { "login": {

View File

@ -112,7 +112,7 @@ describe('AccountOverview', () => {
describe('transaction is confirmed and server response is error', () => { describe('transaction is confirmed and server response is error', () => {
beforeEach(async () => { beforeEach(async () => {
jest.clearAllMocks() jest.clearAllMocks()
sendMock.mockReturnValue({ success: false }) sendMock.mockReturnValue({ success: false, result: { message: 'receiver not found' } })
await wrapper await wrapper
.findComponent({ name: 'TransactionConfirmation' }) .findComponent({ name: 'TransactionConfirmation' })
.vm.$emit('send-transaction') .vm.$emit('send-transaction')
@ -121,6 +121,10 @@ describe('AccountOverview', () => {
it('shows the error page', () => { it('shows the error page', () => {
expect(wrapper.find('div.card-body').text()).toContain('form.send_transaction_error') expect(wrapper.find('div.card-body').text()).toContain('form.send_transaction_error')
}) })
it('shows recipient not found', () => {
expect(wrapper.text()).toContain('transaction.receiverNotFound')
})
}) })
}) })
}) })

View File

@ -23,7 +23,11 @@
></transaction-confirmation> ></transaction-confirmation>
</template> </template>
<template #transaction-result> <template #transaction-result>
<transaction-result :error="error" @on-reset="onReset"></transaction-result> <transaction-result
:error="error"
:errorResult="errorResult"
@on-reset="onReset"
></transaction-result>
</template> </template>
</gdd-send> </gdd-send>
<hr /> <hr />
@ -71,6 +75,7 @@ export default {
timestamp: Date.now(), timestamp: Date.now(),
transactionData: { ...EMPTY_TRANSACTION_DATA }, transactionData: { ...EMPTY_TRANSACTION_DATA },
error: false, error: false,
errorResult: '',
currentTransactionStep: 0, currentTransactionStep: 0,
loading: false, loading: false,
} }
@ -104,6 +109,7 @@ export default {
this.error = false this.error = false
this.$emit('update-balance', this.transactionData.amount) this.$emit('update-balance', this.transactionData.amount)
} else { } else {
this.errorResult = result.result.message
this.error = true this.error = true
} }
this.currentTransactionStep = 2 this.currentTransactionStep = 2

View File

@ -17,9 +17,16 @@
<b-col> <b-col>
<b-card class="p-0" style="background-color: #ebebeba3 !important"> <b-card class="p-0" style="background-color: #ebebeba3 !important">
<div class="p-4" style="font-size: 1.5rem"> <div class="p-4" style="font-size: 1.5rem">
{{ $t('form.sorry') }} <div>{{ $t('form.sorry') }}</div>
<hr /> <hr />
{{ $t('form.send_transaction_error') }}
<div>{{ $t('form.send_transaction_error') }}</div>
<hr />
<div v-if="errorResult === 'receiver not found'">
{{ $t('transaction.receiverNotFound') }}
</div>
<div v-else>({{ errorResult }})</div>
</div> </div>
<p class="text-center mt-3"> <p class="text-center mt-3">
<b-button variant="success" @click="$emit('on-reset')">{{ $t('form.close') }}</b-button> <b-button variant="success" @click="$emit('on-reset')">{{ $t('form.close') }}</b-button>
@ -33,6 +40,7 @@ export default {
name: 'TransactionResult', name: 'TransactionResult',
props: { props: {
error: { type: Boolean, default: true }, error: { type: Boolean, default: true },
errorResult: { type: String, default: '' },
}, },
} }
</script> </script>