Repository: juspay/hyperswitch
File: crates/router/src/core/payment_link/payment_link_initiate/secure_payment_link_initiator.js (JavaScript)

Code before:
        paymentDetails.sdk_layout === "accordion"
        ? "accordion"
        : paymentDetails.sdk_layout;

    var enableSavedPaymentMethod = paymentDetails.enabled_saved_payment_method;
    var hideCardNicknameField = paymentDetails.hide_card_nickname_field;
    var unifiedCheckoutOptions = {
      displaySavedPaymentMethodsCheckbox: enableSavedPaymentMethod,
      displaySavedPaymentMethods: enableSavedPaymentMethod,
      layout: {
        type: type, //accordion , tabs, spaced accordion
        spacedAccordionItems: paymentDetails.sdk_layout === "spaced_accordion",
      },
      branding: "never",
      wallets: {
        walletReturnUrl: paymentDetails.return_url,
        style: {
          theme: "dark",
          type: "default",
          height: 55,
        },
      },
      hideCardNicknameField: hideCardNicknameField,
      showCardFormByDefault: paymentDetails.show_card_form_by_default,
      customMessageForCardTerms: paymentDetails.custom_message_for_card_terms,
      custom_message_for_payment_method_types: paymentDetails.custom_message_for_payment_method_types,
    };
    var showCardTerms = paymentDetails.show_card_terms;
    if (showCardTerms !== null && typeof showCardTerms === "string") {
      unifiedCheckoutOptions.terms = {
        card: showCardTerms
      };
    }
    var paymentMethodsHeaderText = paymentDetails.payment_form_header_text;
    if (paymentMethodsHeaderText !== null && typeof paymentMethodsHeaderText === "string") {
      unifiedCheckoutOptions.paymentMethodsHeaderText = paymentMethodsHeaderText;
    }

    unifiedCheckout = widgets.create("payment", unifiedCheckoutOptions);
    mountUnifiedCheckout("#unified-checkout");
    showSDK(paymentDetails.display_sdk_only, paymentDetails.enable_button_only_on_form_ready);

    let shimmer = document.getElementById("payment-details-shimmer");
    shimmer.classList.add("reduce-opacity");

    setTimeout(() => {
      document.body.removeChild(shimmer);
    }, 500);
  }

  /**

Review comment (suggestion):
```suggestion
      customMessageForPaymentMethodTypes: paymentDetails.custom_message_for_payment_method_types,
```

Code after:
        paymentDetails.sdk_layout === "accordion"
        ? "accordion"
        : paymentDetails.sdk_layout;

    var enableSavedPaymentMethod = paymentDetails.enabled_saved_payment_method;
    var hideCardNicknameField = paymentDetails.hide_card_nickname_field;
    var unifiedCheckoutOptions = {
      displaySavedPaymentMethodsCheckbox: enableSavedPaymentMethod,
      displaySavedPaymentMethods: enableSavedPaymentMethod,
      layout: {
        type: type, //accordion , tabs, spaced accordion
        spacedAccordionItems: paymentDetails.sdk_layout === "spaced_accordion",
      },
      branding: "never",
      wallets: {
        walletReturnUrl: paymentDetails.return_url,
        style: {
          theme: "dark",
          type: "default",
          height: 55,
        },
      },
      hideCardNicknameField: hideCardNicknameField,
      showCardFormByDefault: paymentDetails.show_card_form_by_default,
      customMessageForCardTerms: paymentDetails.custom_message_for_card_terms,
      customMessageForPaymentMethodTypes: paymentDetails.custom_message_for_payment_method_types,
    };
    var showCardTerms = paymentDetails.show_card_terms;
    if (showCardTerms !== null && typeof showCardTerms === "string") {
      unifiedCheckoutOptions.terms = {
        card: showCardTerms
      };
    }
    var paymentMethodsHeaderText = paymentDetails.payment_form_header_text;
    if (paymentMethodsHeaderText !== null && typeof paymentMethodsHeaderText === "string") {
      unifiedCheckoutOptions.paymentMethodsHeaderText = paymentMethodsHeaderText;
    }

    unifiedCheckout = widgets.create("payment", unifiedCheckoutOptions);
    mountUnifiedCheckout("#unified-checkout");
    showSDK(paymentDetails.display_sdk_only, paymentDetails.enable_button_only_on_form_ready);

    let shimmer = document.getElementById("payment-details-shimmer");
    shimmer.classList.add("reduce-opacity");

    setTimeout(() => {
      document.body.removeChild(shimmer);
    }, 500);
  }

  /**