We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0e09d07 commit 29c03e7Copy full SHA for 29c03e7
1 file changed
src/composables/payment.js
@@ -54,6 +54,20 @@ export const usePayment = defineStore("usePaymentStore", () => {
54
options.push(currentOption)
55
}
56
57
+ // Sort: SORT_FIRST providers on top, SORT_LAST at the bottom, rest unchanged
58
+ const SORT_FIRST = ["unzer-paylater_invoice"]
59
+ const SORT_LAST = ["unzer-paypal", "amazonpay"]
60
+
61
+ options.sort((a, b) => {
62
+ const weight = (key) => {
63
+ const firstIdx = SORT_FIRST.indexOf(key)
64
+ if (firstIdx !== -1) return -SORT_FIRST.length + firstIdx
65
+ const lastIdx = SORT_LAST.indexOf(key)
66
+ if (lastIdx !== -1) return 1 + lastIdx
67
+ return 0
68
+ }
69
+ return weight(a.paymenttype) - weight(b.paymenttype)
70
+ })
71
72
return options
73
0 commit comments