Override hosted fields configurtation when PayPal subscriptions is enabled

This commit is contained in:
Emili Castells Guasch 2023-05-09 11:42:31 +02:00
parent 69542e37f3
commit 69da3f78ed
2 changed files with 4 additions and 4 deletions

View file

@ -68,11 +68,11 @@ class CheckoutBootstap {
PayPalCommerceGateway.data_client_id.has_subscriptions PayPalCommerceGateway.data_client_id.has_subscriptions
&& PayPalCommerceGateway.data_client_id.paypal_subscriptions_enabled && PayPalCommerceGateway.data_client_id.paypal_subscriptions_enabled
) { ) {
this.renderer.render(actionHandler.subscriptionsConfiguration()); this.renderer.render(actionHandler.subscriptionsConfiguration(), {}, actionHandler.configuration());
return; return;
} }
this.renderer.render(actionHandler.configuration()); this.renderer.render(actionHandler.configuration(), {}, actionHandler.configuration());
} }
updateUi() { updateUi() {

View file

@ -10,7 +10,7 @@ class Renderer {
this.renderedSources = new Set(); this.renderedSources = new Set();
} }
render(contextConfig, settingsOverride = {}) { render(contextConfig, settingsOverride = {}, contextConfigOverride = () => {}) {
const settings = merge(this.defaultSettings, settingsOverride); const settings = merge(this.defaultSettings, settingsOverride);
const enabledSeparateGateways = Object.fromEntries(Object.entries( const enabledSeparateGateways = Object.fromEntries(Object.entries(
@ -50,7 +50,7 @@ class Renderer {
} }
if (this.creditCardRenderer) { if (this.creditCardRenderer) {
this.creditCardRenderer.render(settings.hosted_fields.wrapper, contextConfig); this.creditCardRenderer.render(settings.hosted_fields.wrapper, contextConfigOverride);
} }
for (const [fundingSource, data] of Object.entries(enabledSeparateGateways)) { for (const [fundingSource, data] of Object.entries(enabledSeparateGateways)) {