fix(connector): [globalpay] handle edge case where currency comes as empty upon payment decline#7812
Merged
likhinbopanna merged 3 commits intomainfrom Apr 17, 2025
Merged
Conversation
Changed Files
|
swangi-kumari
approved these changes
Apr 15, 2025
deepanshu-iiitu
requested changes
Apr 16, 2025
| /// The country in ISO-3166-1(alpha-2 code) format. | ||
| pub country: Option<String>, | ||
| /// The currency of the amount in ISO-4217(alpha-3) | ||
| #[serde(deserialize_with = "deserialize_optional_currency")] |
Contributor
There was a problem hiding this comment.
Should we do this change for amount as well?
Member
Author
There was a problem hiding this comment.
i do not think changes to amount is needed.
StringMinorUnit is inherently a String. so, an empty string does not cause any deserialization issues.
and yes, the after change, i'm unable to reproduce the bug even though the connector sends amount as "".
deepanshu-iiitu
approved these changes
Apr 16, 2025
pixincreate
added a commit
that referenced
this pull request
Apr 21, 2025
…acilitapay-pix-pmt * 'main' of github.com:juspay/hyperswitch: (21 commits) refactor(required_fields): move pm required fields to pm crate (#7539) fix(connector): [noon] address `next_action_url` being `null` for cards in 3ds payment (#7832) refactor(middleware): add middleware to record metrics for request count and duration (#7803) chore(version): 2025.04.18.0 chore(postman): update Postman collection files fix(connector): [globalpay] handle edge case where currency comes as empty upon payment decline (#7812) refactor(cypress-v2): change `Authorization` and `payment_methods_enabled` for v2 cypress tests (#7805) fix(connector): [Cybersource] send type selection indicator for co-batch cards (#7828) feat(payment_method): add logic for setup_future_usage downgrade and add filter based on zero mandate config (#7775) refactor(accounts): move dashboard_metadata table to accounts_schema and point v2 to v1 dashboard_metadata (#7793) chore(analytics): opensearch client creation based on config (#7810) ci(postman): update assertion error message for nmi collection (#7765) feat: add primary key not null query to generic filter function (#7785) chore(version): 2025.04.17.0 chore: change payment method files ownership to `hyperswitch-payment-methods` (#7808) feat(vsaas): modify api key auth to support vsaas cases (#7593) ci(cypress): verify mandate id to be `null` if payment id not `succeeded` (#7749) feat(connector): [chargebee] consumes required fields to support transaction monitoring (#7774) ci(configs): remove vault private key from configs (#7825) chore(version): 2025.04.16.0 ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Change
Description
This PR fixes an edge case with GlobalPay where, upon payment decline, we get a deserialization error and that is because
currencyfield is not expected to be empty but rather a validCurrencyenum.Additional Changes
Motivation and Context
closes #7813
How did you test it?
cards:
create a payment:
{ "payment_id": "pay_9iWUNJmnm8Le4l8iZCV9", "merchant_id": "postman_merchant_GHAction_95a905d4-93fe-42b4-b125-c1ddafa26313", "status": "failed", "amount": 1000, "net_amount": 1000, "shipping_cost": null, "amount_capturable": 0, "amount_received": null, "connector": "globalpay", "client_secret": "pay_9iWUNJmnm8Le4l8iZCV9_secret_RyifkSKcDrOFEEqC0OZ7", "created": "2025-04-15T09:21:39.674Z", "currency": "USD", "customer_id": "StripeCustomer", "customer": { "id": "StripeCustomer", "name": "John Doe", "email": "abcdef123@gmail.com", "phone": "999999999", "phone_country_code": "+65" }, "description": "Its my first payment request", "refunds": null, "disputes": null, "mandate_id": null, "mandate_data": null, "setup_future_usage": null, "off_session": null, "capture_on": null, "capture_method": "automatic", "payment_method": "card", "payment_method_data": { "card": { "last4": "0091", "card_type": "CREDIT", "card_network": "Visa", "card_issuer": "STRIPE PAYMENTS UK LIMITED", "card_issuing_country": "UNITEDKINGDOM", "card_isin": "424242", "card_extended_bin": null, "card_exp_month": "10", "card_exp_year": "25", "card_holder_name": "joseph Doe", "payment_checks": null, "authentication_data": null }, "billing": null }, "payment_token": null, "shipping": null, "billing": { "address": { "city": null, "country": "US", "line1": null, "line2": null, "line3": null, "zip": null, "state": null, "first_name": null, "last_name": null }, "phone": null, "email": null }, "order_details": null, "email": "abcdef123@gmail.com", "name": "John Doe", "phone": "999999999", "return_url": "https://google.com/", "authentication_type": "three_ds", "statement_descriptor_name": "joseph", "statement_descriptor_suffix": "JS", "next_action": null, "cancellation_reason": null, "error_code": "111", "error_message": "(111)[ test system ] Strong Customer Authentication Required", "unified_code": "UE_9000", "unified_message": "Something went wrong", "payment_experience": null, "payment_method_type": "credit", "connector_label": null, "business_country": null, "business_label": "default", "business_sub_label": null, "allowed_payment_method_types": null, "ephemeral_key": { "customer_id": "StripeCustomer", "created_at": 1744708899, "expires": 1744712499, "secret": "epk_24e7b6b84ca647aaa39a01fbdf5c0f42" }, "manual_retry_allowed": true, "connector_transaction_id": "TRN_uRk00jWtySUhGnJD4e7mZhEQQwZ6vF_Le4l8iZCV9_1", "frm_message": null, "metadata": null, "connector_metadata": null, "feature_metadata": null, "reference_id": null, "payment_link": null, "profile_id": "pro_I2x5oXH0EQeuMaAZSe6G", "surcharge_details": null, "attempt_count": 1, "merchant_decision": null, "merchant_connector_id": "mca_NN71g0D5WXMeggXKXhBM", "incremental_authorization_allowed": false, "authorization_count": null, "incremental_authorizations": null, "external_authentication_details": null, "external_3ds_authentication_attempted": false, "expires_on": "2025-04-15T09:36:39.674Z", "fingerprint": null, "browser_info": null, "payment_method_id": null, "payment_method_status": null, "updated": "2025-04-15T09:21:41.821Z", "split_payments": null, "frm_metadata": null, "extended_authorization_applied": null, "capture_before": null, "merchant_order_reference_id": null, "order_tax_amount": null, "connector_mandate_id": null, "card_discovery": "manual", "force_3ds_challenge": false, "force_3ds_challenge_trigger": false, "issuer_error_code": "111", "issuer_error_message": "(111)[ test system ] Strong Customer Authentication Required" }payment now fails with valid error message when
failurecards are used.previously, we would get a 5xx:
Checklist
cargo +nightly fmt --allcargo clippy