@bytebrand/export-cars 1.23.2 → 1.23.3
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
|
@@ -122,15 +122,21 @@ export class FacebookShopTransformer {
|
|
|
122
122
|
downPayment: this.getNum(car, 'rate.firstInstallment'),
|
|
123
123
|
termLength: this.getNum(car, 'rate.paybackPeriod'),
|
|
124
124
|
};
|
|
125
|
-
const rawLeasing = {
|
|
126
|
-
monthlyPayment: this.getNum(car, 'leasing.monthlyInstallment'),
|
|
127
|
-
downPayment: this.getNum(car, 'leasing.firstInstallment'),
|
|
128
|
-
termLength: this.getNum(car, 'leasing.paybackPeriod'),
|
|
129
|
-
};
|
|
130
125
|
const leasingIsEligible = this.isLeasingEligible(car);
|
|
131
126
|
|
|
132
127
|
const { financing: computedFinancing, leasing: computedLeasing } = this.computeFinancials(car);
|
|
133
128
|
|
|
129
|
+
// Unlike financing, the CDP never reads a pre-stored leasing.monthlyInstallment — it
|
|
130
|
+
// always computes it live from RWG + price (see fe-main SearchResultsStore/NewMainPage,
|
|
131
|
+
// same isLeasingEligible formula). The raw car.leasing.monthlyInstallment field can be
|
|
132
|
+
// stale/unset even when the CDP shows an active leasing tab, so the computed value is the
|
|
133
|
+
// one that actually matches what the customer sees.
|
|
134
|
+
const computedLeasingValues = {
|
|
135
|
+
monthlyPayment: this.getNum(computedLeasing, 'monthlyInstallment'),
|
|
136
|
+
downPayment: this.getNum(computedLeasing, 'firstInstallment'),
|
|
137
|
+
termLength: this.getNum(computedLeasing, 'paybackPeriod'),
|
|
138
|
+
};
|
|
139
|
+
|
|
134
140
|
if (offersFinancing && rawFinancing.monthlyPayment && computedFinancing) {
|
|
135
141
|
offers.push({
|
|
136
142
|
offerType: OfferType.financing,
|
|
@@ -148,15 +154,15 @@ export class FacebookShopTransformer {
|
|
|
148
154
|
});
|
|
149
155
|
}
|
|
150
156
|
|
|
151
|
-
if (leasingIsEligible &&
|
|
157
|
+
if (leasingIsEligible && computedLeasingValues.monthlyPayment && computedLeasing) {
|
|
152
158
|
offers.push({
|
|
153
159
|
offerType: OfferType.leasing,
|
|
154
|
-
title: `${make} ${model} leasen – z. B. ab ${this.formatEUR(
|
|
155
|
-
description: `${make} ${model} leasen – ${
|
|
156
|
-
`${this.formatEUR(
|
|
160
|
+
title: `${make} ${model} leasen – z. B. ab ${this.formatEUR(computedLeasingValues.monthlyPayment)} €/Monat`,
|
|
161
|
+
description: `${make} ${model} leasen – ${computedLeasingValues.termLength} Monate Laufzeit, ` +
|
|
162
|
+
`${this.formatEUR(computedLeasingValues.downPayment)} € Anzahlung`,
|
|
157
163
|
disclaimer: OFFER_DISCLAIMER,
|
|
158
164
|
financials: {
|
|
159
|
-
...
|
|
165
|
+
...computedLeasingValues,
|
|
160
166
|
apr: this.getNum(computedLeasing, 'annualPercentageRate'),
|
|
161
167
|
finalPayment: this.getNum(computedLeasing, 'finalInstallment'),
|
|
162
168
|
totalAmount: this.getNum(computedLeasing, 'grossLoanAmount'),
|