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

Code before:
  var type =
    paymentDetails.sdk_layout === "spaced_accordion" ||
      paymentDetails.sdk_layout === "accordion"
      ? "accordion"
      : paymentDetails.sdk_layout;
  var hideCardNicknameField = paymentDetails.hide_card_nickname_field;
  var unifiedCheckoutOptions = {
    displaySavedPaymentMethodsCheckbox: false,
    displaySavedPaymentMethods: false,
    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,
      },
    },
    showCardFormByDefault: paymentDetails.show_card_form_by_default,
    hideCardNicknameField: hideCardNicknameField,
    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);
}

/**
 * Use - redirect to /payment_link/status

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

Code after:
  var type =
    paymentDetails.sdk_layout === "spaced_accordion" ||
      paymentDetails.sdk_layout === "accordion"
      ? "accordion"
      : paymentDetails.sdk_layout;
  var hideCardNicknameField = paymentDetails.hide_card_nickname_field;
  var unifiedCheckoutOptions = {
    displaySavedPaymentMethodsCheckbox: false,
    displaySavedPaymentMethods: false,
    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,
      },
    },
    showCardFormByDefault: paymentDetails.show_card_form_by_default,
    hideCardNicknameField: hideCardNicknameField,
    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);
}

/**
 * Use - redirect to /payment_link/status