@managesome/eposmatic-toolkit 0.2.496 → 0.2.497
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PAYMENT_EXTENSION_ENUM, PAYMENT_TYPE_ENUM } from '../../constants';
|
|
2
2
|
import { IOrderPayment } from '../../schemas';
|
|
3
3
|
export declare function getPaymentAmountPayed(payment: IOrderPayment, allowUnverifiedPayments?: boolean): {
|
|
4
4
|
amountPaid: number;
|
|
@@ -40,5 +40,5 @@ export declare function getPaymentSmartTitle(paymentType: string): {
|
|
|
40
40
|
export declare const getQRCodePaymentLink: (grandTotal: number | undefined, payments: IOrderPayment[] | null | undefined) => {
|
|
41
41
|
qrLink: string;
|
|
42
42
|
amount: number;
|
|
43
|
-
|
|
43
|
+
scanMessage: string;
|
|
44
44
|
} | null;
|
|
@@ -300,14 +300,14 @@ const getQRCodePaymentLink = (grandTotal, payments) => {
|
|
|
300
300
|
return null;
|
|
301
301
|
let qrLink = undefined;
|
|
302
302
|
let amount = undefined;
|
|
303
|
-
let
|
|
303
|
+
let scanMessage = 'Scan To Pay';
|
|
304
304
|
const raastPayment = payments.find((p) => p.payment_status === constants_1.PAYMENT_STATUS_ENUM.PENDING && p?.payment_type === constants_1.PAYMENT_TYPE_ENUM.RAAST_PAY);
|
|
305
305
|
if (raastPayment) {
|
|
306
306
|
const raw = raastPayment?.card_details?.card_number;
|
|
307
307
|
// Only accept a real QR payload (not the initial placeholder)
|
|
308
308
|
qrLink = raw != null && raw !== '**** **** **** ****' ? raw : undefined;
|
|
309
309
|
amount = raastPayment?.amount_due;
|
|
310
|
-
|
|
310
|
+
scanMessage = 'Scan with JazzCash, EasyPaisa, or Bank App to Pay';
|
|
311
311
|
}
|
|
312
312
|
if (!qrLink || !amount) {
|
|
313
313
|
return null;
|
|
@@ -315,7 +315,7 @@ const getQRCodePaymentLink = (grandTotal, payments) => {
|
|
|
315
315
|
return {
|
|
316
316
|
qrLink,
|
|
317
317
|
amount: (0, common_1.parseNum)(amount),
|
|
318
|
-
|
|
318
|
+
scanMessage,
|
|
319
319
|
};
|
|
320
320
|
};
|
|
321
321
|
exports.getQRCodePaymentLink = getQRCodePaymentLink;
|
|
@@ -831,12 +831,7 @@ function receiptEngine(payload, mappedItems = {}) {
|
|
|
831
831
|
const qrCodePayment = (0, payment_helpers_1.getQRCodePaymentLink)(grandTotal, payments);
|
|
832
832
|
if (qrCodePayment != null) {
|
|
833
833
|
order_link = qrCodePayment.qrLink;
|
|
834
|
-
|
|
835
|
-
custom_message = 'Scan with JazzCash, EasyPaisa, or Bank App to Pay';
|
|
836
|
-
}
|
|
837
|
-
else {
|
|
838
|
-
custom_message = 'Scan To Pay';
|
|
839
|
-
}
|
|
834
|
+
custom_message = qrCodePayment.scanMessage;
|
|
840
835
|
}
|
|
841
836
|
else if (display_qr_code_on_receipt) {
|
|
842
837
|
const digitalReceiptLink = business_website != null ? `https://${business_website}/orders/${payload.order._id}` : null;
|