tango-app-api-payment-subscription 3.5.26 → 3.5.27
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/package.json
CHANGED
|
@@ -815,14 +815,16 @@ export async function invoiceDownload( req, res ) {
|
|
|
815
815
|
|
|
816
816
|
invoiceInfo.totalAmount = roundAmount( invoiceInfo.totalAmount, invoiceInfo.currency );
|
|
817
817
|
let AmountinWords = amountToWords( invoiceInfo.totalAmount, invoiceInfo.currency );
|
|
818
|
+
// Fetch the group BEFORE computing the payment term / due-date fallback.
|
|
819
|
+
// Previously `getgroup` was read while still undefined, so `days` always
|
|
820
|
+
// fell back to 30 and the due-date fallback ignored the real paymentTerm —
|
|
821
|
+
// leaving Due Date out of sync with the "Term N" shown on the invoice.
|
|
818
822
|
let getgroup;
|
|
819
|
-
let days = getgroup?.paymentTerm ? getgroup?.paymentTerm : '30';
|
|
820
|
-
let dueDate = invoiceInfo?.dueDate ? dayjs( invoiceInfo?.dueDate ).format( 'DD/MM/YYYY' ) : dayjs().add( days, 'days' ).format( 'DD/MM/YYYY' );
|
|
821
|
-
|
|
822
|
-
console.log( invoiceInfo.groupId );
|
|
823
823
|
if ( invoiceInfo.groupId ) {
|
|
824
824
|
getgroup = await billingService.findOne( { _id: invoiceInfo.groupId } );
|
|
825
825
|
}
|
|
826
|
+
let days = getgroup?.paymentTerm ? getgroup?.paymentTerm : '30';
|
|
827
|
+
let dueDate = invoiceInfo?.dueDate ? dayjs( invoiceInfo?.dueDate ).format( 'DD/MM/YYYY' ) : dayjs().add( days, 'days' ).format( 'DD/MM/YYYY' );
|
|
826
828
|
let virtualAccount = await paymentAccountService.findOneAccount( { clientId: invoiceInfo.clientId } );
|
|
827
829
|
|
|
828
830
|
invoiceData = {
|