@shushed/helpers 0.0.202-bug-erp-770-20251202172415 → 0.0.202-bug-erp-770-20251202173534
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +18 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -111289,7 +111289,8 @@ function transformMasterOrder(payload) {
|
|
|
111289
111289
|
created_at: c.created_at,
|
|
111290
111290
|
amount: c.mount || c.amount,
|
|
111291
111291
|
// card_payments may use 'mount' field
|
|
111292
|
-
type: "Payment",
|
|
111292
|
+
type: c.type || "Payment",
|
|
111293
|
+
// Preserve card_payment type (e.g., "Apple Pay", "Credit Card")
|
|
111293
111294
|
payment_method_code: String(c.service_type || ""),
|
|
111294
111295
|
transaction_id: c.transaction_id,
|
|
111295
111296
|
// This is the unified ID that matches payment_gateway_token
|
|
@@ -111426,7 +111427,12 @@ function transformMasterOrder(payload) {
|
|
|
111426
111427
|
transaction_id: cardPaymentEntryForMethod?.transaction_id || sortedEntries.find((e) => e.transaction_id)?.transaction_id,
|
|
111427
111428
|
service_type: cardPaymentEntryForMethod?.service_type || sortedEntries.find((e) => e.service_type)?.service_type
|
|
111428
111429
|
};
|
|
111429
|
-
let pm
|
|
111430
|
+
let pm;
|
|
111431
|
+
if (cardPaymentEntryForMethod?.type && String(cardPaymentEntryForMethod.type).trim().toLowerCase() === "apple pay") {
|
|
111432
|
+
pm = "APPLE-PAY";
|
|
111433
|
+
} else {
|
|
111434
|
+
pm = mapPaymentMethod(paymentMethodCode, groupCardData);
|
|
111435
|
+
}
|
|
111430
111436
|
let cardPaymentEntryForTransaction = sortedEntries.find((e) => e.source === "card_payment" && e.transaction_id);
|
|
111431
111437
|
if (!cardPaymentEntryForTransaction && primary.payment_gateway_token) {
|
|
111432
111438
|
cardPaymentEntryForTransaction = cardPaymentsByToken.get(primary.payment_gateway_token);
|
|
@@ -111455,12 +111461,16 @@ function transformMasterOrder(payload) {
|
|
|
111455
111461
|
cardPaymentEntryForTransaction = cardPaymentsByToken.get(originalPayment.payment_gateway_token);
|
|
111456
111462
|
if (!cardPaymentEntryForMethod && cardPaymentEntryForTransaction) {
|
|
111457
111463
|
cardPaymentEntryForMethod = cardPaymentEntryForTransaction;
|
|
111458
|
-
|
|
111459
|
-
|
|
111460
|
-
|
|
111461
|
-
|
|
111462
|
-
|
|
111463
|
-
|
|
111464
|
+
if (cardPaymentEntryForMethod?.type && String(cardPaymentEntryForMethod.type).trim().toLowerCase() === "apple pay") {
|
|
111465
|
+
pm = "APPLE-PAY";
|
|
111466
|
+
} else {
|
|
111467
|
+
const refundCardData = {
|
|
111468
|
+
card_number: cardPaymentEntryForMethod?.card_number,
|
|
111469
|
+
transaction_id: cardPaymentEntryForMethod?.transaction_id,
|
|
111470
|
+
service_type: cardPaymentEntryForMethod?.service_type
|
|
111471
|
+
};
|
|
111472
|
+
pm = mapPaymentMethod(paymentMethodCode, refundCardData);
|
|
111473
|
+
}
|
|
111464
111474
|
}
|
|
111465
111475
|
}
|
|
111466
111476
|
}
|