-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fbb7262
commit 911c600
Showing
17 changed files
with
282 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# 4.0.24 | ||
- Added refunds by amount | ||
|
||
# 4.0.23 | ||
- Fixed cart recreate function for custom products | ||
|
||
|
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
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
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
26 changes: 26 additions & 0 deletions
26
...heckout-order/component/postfinancecheckout-order-action-refund-by-amount/index.html.twig
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,26 @@ | ||
{% block postfinancecheckout_order_action_refund_by_amount %} | ||
<sw-modal variant="small" | ||
:title="$tc(`postfinancecheckout-order.modal.title.refund`)" | ||
@modal-close="$emit('modal-close')"> | ||
|
||
{% block postfinancecheckout_order_action_refund_amount_by_amount %} | ||
<sw-number-field v-model="refundAmount" | ||
:max="refundableAmount" | ||
:min="0" | ||
:value="refundableAmount" | ||
:label="$tc('postfinancecheckout-order.refund.refundAmount.label')" | ||
:suffix="currency"> | ||
</sw-number-field> | ||
{% endblock %} | ||
|
||
{% block postfinancecheckout_order_action_refund_confirm_button_by_amount %} | ||
<template #modal-footer> | ||
<sw-button variant="primary" @click="refundByAmount()"> | ||
{{ $tc('postfinancecheckout-order.refundAction.confirmButton.text') }} | ||
</sw-button> | ||
</template> | ||
{% endblock %} | ||
|
||
<sw-loader v-if="isLoading"></sw-loader> | ||
</sw-modal> | ||
{% endblock %} |
94 changes: 94 additions & 0 deletions
94
...inancecheckout-order/component/postfinancecheckout-order-action-refund-by-amount/index.js
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,94 @@ | ||
/* global Shopware */ | ||
|
||
import template from './index.html.twig'; | ||
|
||
const {Component, Mixin, Filter, Utils} = Shopware; | ||
|
||
Component.register('postfinancecheckout-order-action-refund-by-amount', { | ||
template, | ||
|
||
inject: ['PostFinanceCheckoutRefundService'], | ||
|
||
mixins: [ | ||
Mixin.getByName('notification') | ||
], | ||
|
||
props: { | ||
transactionData: { | ||
type: Object, | ||
required: true | ||
}, | ||
|
||
orderId: { | ||
type: String, | ||
required: true | ||
} | ||
}, | ||
|
||
data() { | ||
return { | ||
isLoading: true, | ||
currency: this.transactionData.transactions[0].currency, | ||
refundAmount: 0, | ||
refundableAmount: 0, | ||
}; | ||
}, | ||
|
||
computed: { | ||
dateFilter() { | ||
return Filter.getByName('date'); | ||
} | ||
}, | ||
|
||
created() { | ||
this.createdComponent(); | ||
}, | ||
|
||
methods: { | ||
createdComponent() { | ||
this.isLoading = false; | ||
this.currency = this.transactionData.transactions[0].currency; | ||
this.refundAmount = Number(this.transactionData.transactions[0].amountIncludingTax); | ||
this.refundableAmount = Number(this.transactionData.transactions[0].amountIncludingTax); | ||
}, | ||
|
||
refundByAmount() { | ||
this.isLoading = true; | ||
this.PostFinanceCheckoutRefundService.createRefundByAmount( | ||
this.transactionData.transactions[0].metaData.salesChannelId, | ||
this.transactionData.transactions[0].id, | ||
this.refundAmount | ||
).then(() => { | ||
this.createNotificationSuccess({ | ||
title: this.$tc('postfinancecheckout-order.refundAction.successTitle'), | ||
message: this.$tc('postfinancecheckout-order.refundAction.successMessage') | ||
}); | ||
this.isLoading = false; | ||
this.$emit('modal-close'); | ||
this.$nextTick(() => { | ||
this.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`); | ||
}); | ||
}).catch((errorResponse) => { | ||
try { | ||
this.createNotificationError({ | ||
title: errorResponse.response.data.errors[0].title, | ||
message: errorResponse.response.data.errors[0].detail, | ||
autoClose: false | ||
}); | ||
} catch (e) { | ||
this.createNotificationError({ | ||
title: errorResponse.title, | ||
message: errorResponse.message, | ||
autoClose: false | ||
}); | ||
} finally { | ||
this.isLoading = false; | ||
this.$emit('modal-close'); | ||
this.$nextTick(() => { | ||
this.$router.replace(`${this.$route.path}?hash=${Utils.createId()}`); | ||
}); | ||
} | ||
}); | ||
} | ||
} | ||
}); |
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
Oops, something went wrong.