Skip to content

Commit f2eeb8e

Browse files
committed
link the + icon always to an enabled payment method
1 parent d94e1cf commit f2eeb8e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/components/easycredit-widget/easycredit-widget.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,16 @@ export class EasycreditWidget {
205205
const info = state.webshopInfo
206206
paymentType = this.amount >= info.minInstallmentValue && this.amount <= info.maxInstallmentValue ? METHODS.INSTALLMENT : METHODS.BILL;
207207
}
208-
if (this.isEnabled(paymentType)) {
209-
url.searchParams.append('paymentType', paymentType + '_PAYMENT');
208+
if (!this.isEnabled(paymentType)) {
209+
paymentType = paymentType === METHODS.INSTALLMENT ? METHODS.BILL : METHODS.INSTALLMENT;
210210
}
211+
212+
url.searchParams.append('paymentType', paymentType + '_PAYMENT');
213+
211214
return url.origin + url.pathname + url.hash + url.search;
212215
}
213216

214217
getModalFragment () {
215-
//const url = this.getInstallmentPlan()?.url ?? this.getDefaultModalUrl()
216218
return ([
217219
<easycredit-modal ref={(el) => this.modal = el as HTMLEasycreditModalElement} size="payment">
218220
<iframe slot="content"></iframe>

0 commit comments

Comments
 (0)