Skip to content

Commit

Permalink
Merged in fix/33950-submit-with-zero-quantity (pull request #20)
Browse files Browse the repository at this point in the history
#33950

Approved-by: Bohdan Medvediev
  • Loading branch information
JonYeb committed May 4, 2023
2 parents daf55d9 + ed253b6 commit ee935d8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ Component.register('mo-orders-paid', {
},

computed: {
totalSelections() {
return this.Selection.reduce((prev, current) => prev + current, 0);
},

maxAmountToProcess() {
return !isNaN(this.maxRefund) ?
this.maxRefund :
Expand Down Expand Up @@ -132,6 +136,10 @@ Component.register('mo-orders-paid', {
});
return payload;
},

transactionDisabled() {
return (this.amountToProcess === 0) && (this.totalSelections === 0);
},
},

methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<div v-else ></div>
<sw-button-process
:isLoading="isLoading"
:disabled="amountToProcess === 0"
:disabled="transactionDisabled"
:processSuccess="transactionSuccess"
variant="ghost-danger"
@click="refund"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ Component.register('mo-orders-unprocessed', {
});
return payload;
},

transactionDisabled() {
return (this.amountToProcess === 0) && (this.totalSelections === 0);
},
},

methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@
<div v-else ></div>
<sw-button-process
:isLoading="isLoading"
:disabled="totalSelections === 0"
:disabled="transactionDisabled"
:processSuccess="transactionSuccess.capture"
variant="ghost"
@click="capture"
>{{ $tc('worldline.capture-payment-button.button') }}</sw-button-process>

<sw-button-process
:isLoading="isLoading"
:disabled="totalSelections === 0"
:disabled="transactionDisabled"
:processSuccess="transactionSuccess.cancel"
variant="ghost-danger"
@click="cancel"
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/public/administration/js/mopt-worldline.js

Large diffs are not rendered by default.

0 comments on commit ee935d8

Please sign in to comment.