Skip to content

Commit

Permalink
Sort order.transactions array prioritizing bank invoices
Browse files Browse the repository at this point in the history
  • Loading branch information
gaboulsvtex committed Dec 27, 2024
1 parent 3eb63c8 commit 6474a3d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [2.18.1] - 2024-12-27

### Fixed

- Fix the display of bank invoice information when it isn't the first payment of the first transaction.

## [2.18.0] - 2024-08-27

### Added
Expand Down
6 changes: 2 additions & 4 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
"vendor": "vtex",
"name": "order-placed",
"version": "2.18.0",
"version": "2.18.1",
"title": "Order Placed",
"description": "",
"registries": [
"smartcheckout"
],
"registries": ["smartcheckout"],
"scripts": {
"postreleasy": "vtex publish --public"
},
Expand Down
14 changes: 14 additions & 0 deletions react/Notices.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ const Notices: FC = () => {
return null
}

orders.forEach((order) => {
order.paymentData.transactions.sort((transaction) =>
transaction.payments.some((payment) => payment.group === 'bankInvoice')
? -1
: 1
)

order.paymentData.transactions.forEach((transaction) => {
transaction.payments.sort((payment) =>
payment.group === 'bankInvoice' ? -1 : 1
)
})
})

const numOrders = orders.length
const isSplitOrder = numOrders > 1
const bankInvoice = orders
Expand Down

0 comments on commit 6474a3d

Please sign in to comment.