Skip to content

Commit

Permalink
Bugfix: Get the grand total by code
Browse files Browse the repository at this point in the history
  • Loading branch information
michielgerritsen committed Nov 9, 2023
1 parent 0603caf commit 7ec19ce
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/templates/e2e/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FROM cypress/included:12.1.0

WORKDIR /e2e

RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
RUN npm i @cypress/webpack-preprocessor cypress-mollie cypress-testrail --save-dev

CMD tail -f /dev/null
Expand Down
1 change: 1 addition & 0 deletions Controller/ApplePay/ShippingMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ public function execute()
'totals' => array_map(function (AddressTotal $total) {
return [
'type' => 'final',
'code' => $total->getCode(),
'label' => $total->getData('title'),
'amount' => number_format($total->getData('value'), 2, '.', ''),
];
Expand Down
6 changes: 4 additions & 2 deletions view/frontend/web/js/view/product/apple-pay-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,17 @@ define([

getLineItems: function () {
let totals = [...this.quoteTotals];
totals.pop();

// Delete the item that has code == grand_total
totals.splice(totals.findIndex(total => total.code === 'grand_total'), 1);

return totals;
},

getTotal: function () {
let totals = [...this.quoteTotals];

var total = totals.pop();
const total = totals.find(total => total.code === 'grand_total');

total.label = this.storeName;

Expand Down

0 comments on commit 7ec19ce

Please sign in to comment.