-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(payments): [Payment links] add showCardFormByDefault config for payment links #6663
base: main
Are you sure you want to change the base?
Conversation
Changed Files
|
@@ -153,6 +153,9 @@ pub const DEFAULT_ALLOWED_DOMAINS: Option<HashSet<String>> = None; | |||
/// Default hide card nickname field | |||
pub const DEFAULT_HIDE_CARD_NICKNAME_FIELD: bool = false; | |||
|
|||
/// Show card form by default for payment links | |||
pub const DEFAULT_SHOW_CARD_FORM: bool = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is true, where as in api_models default is 'false'!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes my bad, made the default value 'true' everywhere now
crates/api_models/src/admin.rs
Outdated
@@ -2673,6 +2673,9 @@ pub struct PaymentLinkConfigRequest { | |||
/// Hide card nickname field option for payment link | |||
#[schema(default = false, example = true)] | |||
pub hide_card_nickname_field: Option<bool>, | |||
/// Show card form by default for payment link | |||
#[schema(default = false, example = true)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
9fe7028
to
7d36c1d
Compare
Type of Change
Description
Add showCardFormByDefault config for payment links.
https://docs.hyperswitch.io/explore-hyperswitch/merchant-controls/integration-guide/web/customization#show-card-form-by-default
Functionality:
(By default showCardFormByDefault is true.)
When in PML card is not present + showCardFormByDefault=false, then card form is hidden from the UI. In all other cases card form is shown in UI.
Additional Changes
Motivation and Context
How did you test it?
1. Create a connector with only wallets in `payment_methods_enabled` (Expand to see details)
2. Update `allowed_domains` in business profile (Expand to see details)
3. Create a payment link with `show_card_form_by_default = false` (Expand to see details)
Response of /payments
{ "payment_id": "pay_FmjZdNGEcf4Vkttj9wgF", "merchant_id": "merchant_1732539663", "status": "requires_payment_method", "amount": 100, "net_amount": 100, "shipping_cost": null, "amount_capturable": 100, "amount_received": null, "connector": null, "client_secret": "pay_FmjZdNGEcf4Vkttj9wgF_secret_rMdkJoz3AqMb9E7lD3JC", "created": "2024-11-26T09:52:37.464Z", "currency": "USD", "customer_id": null, "customer": null, "description": null, "refunds": null, "disputes": null, "mandate_id": null, "mandate_data": null, "setup_future_usage": null, "off_session": null, "capture_on": null, "capture_method": null, "payment_method": null, "payment_method_data": null, "payment_token": null, "shipping": null, "billing": null, "order_details": null, "email": null, "name": null, "phone": null, "return_url": "http://127.0.0.1:5500/src/pl_iframe.html", "authentication_type": null, "statement_descriptor_name": null, "statement_descriptor_suffix": null, "next_action": null, "cancellation_reason": null, "error_code": null, "error_message": null, "unified_code": null, "unified_message": null, "payment_experience": null, "payment_method_type": null, "connector_label": null, "business_country": null, "business_label": "default", "business_sub_label": null, "allowed_payment_method_types": null, "ephemeral_key": null, "manual_retry_allowed": null, "connector_transaction_id": null, "frm_message": null, "metadata": null, "connector_metadata": null, "feature_metadata": null, "reference_id": null, "payment_link": { "link": "http://localhost:8080/payment_link/merchant_1732539663/pay_FmjZdNGEcf4Vkttj9wgF?locale=en", "secure_link": "http://localhost:8080/payment_link/s/merchant_1732539663/pay_FmjZdNGEcf4Vkttj9wgF?locale=en", "payment_link_id": "plink_EYi1uYFwZ0TBAQcJKVDH" }, "profile_id": "pro_WY0cgeQScEEXmVNzGWqV", "surcharge_details": null, "attempt_count": 1, "merchant_decision": null, "merchant_connector_id": null, "incremental_authorization_allowed": null, "authorization_count": null, "incremental_authorizations": null, "external_authentication_details": null, "external_3ds_authentication_attempted": false, "expires_on": "2024-12-07T23:39:17.336Z", "fingerprint": null, "browser_info": null, "payment_method_id": null, "payment_method_status": null, "updated": "2024-11-26T09:52:37.572Z", "charges": null, "frm_metadata": null, "merchant_order_reference_id": null, "order_tax_amount": null, "connector_mandate_id": null }
4. Screenshots (Expand to see details)
Open the secure payment link (`secure_link` in API response) in an iframe for validating the functionality. For checking payment_link simply click on the payment_link (`payment_link` in API response)Screenshot for payment link
Screenshot for secured payment link
Expected Behavior: Since PML consists of only wallets and not cards, and
show_card_form_by_default
isfalse
the card form is not shown by default5. Create a payment link with `show_card_form_by_default = true` (Expand to see details)
Response of /payments
{ "payment_id": "pay_t5OgMwdSEHCg0JEgaKyM", "merchant_id": "merchant_1732616040", "status": "requires_payment_method", "amount": 100, "net_amount": 100, "shipping_cost": null, "amount_capturable": 100, "amount_received": null, "connector": null, "client_secret": "pay_t5OgMwdSEHCg0JEgaKyM_secret_36NNyT20Ol3HOs9qLghA", "created": "2024-11-26T10:14:46.689Z", "currency": "USD", "customer_id": null, "customer": null, "description": null, "refunds": null, "disputes": null, "mandate_id": null, "mandate_data": null, "setup_future_usage": null, "off_session": null, "capture_on": null, "capture_method": null, "payment_method": null, "payment_method_data": null, "payment_token": null, "shipping": null, "billing": null, "order_details": null, "email": null, "name": null, "phone": null, "return_url": "http://127.0.0.1:5500/src/pl_iframe.html", "authentication_type": null, "statement_descriptor_name": null, "statement_descriptor_suffix": null, "next_action": null, "cancellation_reason": null, "error_code": null, "error_message": null, "unified_code": null, "unified_message": null, "payment_experience": null, "payment_method_type": null, "connector_label": null, "business_country": null, "business_label": "default", "business_sub_label": null, "allowed_payment_method_types": null, "ephemeral_key": null, "manual_retry_allowed": null, "connector_transaction_id": null, "frm_message": null, "metadata": null, "connector_metadata": null, "feature_metadata": null, "reference_id": null, "payment_link": { "link": "http://localhost:8080/payment_link/merchant_1732616040/pay_t5OgMwdSEHCg0JEgaKyM?locale=en", "secure_link": "http://localhost:8080/payment_link/s/merchant_1732616040/pay_t5OgMwdSEHCg0JEgaKyM?locale=en", "payment_link_id": "plink_py51CKCnCY4qvK98SDMu" }, "profile_id": "pro_ElaKfgKnFwT7Eo348xeM", "surcharge_details": null, "attempt_count": 1, "merchant_decision": null, "merchant_connector_id": null, "incremental_authorization_allowed": null, "authorization_count": null, "incremental_authorizations": null, "external_authentication_details": null, "external_3ds_authentication_attempted": false, "expires_on": "2024-12-08T00:01:26.671Z", "fingerprint": null, "browser_info": null, "payment_method_id": null, "payment_method_status": null, "updated": "2024-11-26T10:14:46.743Z", "charges": null, "frm_metadata": null, "merchant_order_reference_id": null, "order_tax_amount": null, "connector_mandate_id": null }
6. Screenshots (Expand to see details)
Open the secure payment link (`secure_link` in API response) in an iframe for validating the functionality. For checking payment_link simply click on the payment_link (`payment_link` in API response)Screenshot for payment link
Screenshot for secured payment link
Expected Behavior: Since PML consists of only wallets and not cards, and
show_card_form_by_default
istrue
the card form is shown by defaultChecklist
cargo +nightly fmt --all
cargo clippy