Skip to content
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(router): [Cybersource] add PLN to the currency config #6628

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

AkshayaFoiger
Copy link
Contributor

@AkshayaFoiger AkshayaFoiger commented Nov 21, 2024

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

Add PLN to the currency config of card, googlepay and applepay via Cybersource.

Test Case

  1. Do a googlepay payment via PLN cybersource
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_0GGWV59O1lNRZ09AZbD3Kro4CFqhkWBlUSC8QBd072jy4E7T4rsi0Bp07CawLE1N' \
--data-raw '{
    "amount": 10000,
    "currency": "PLN",
    "confirm": true,
    "capture_method": "automatic",
    "capture_on": "2022-09-10T10:11:12Z",
    "customer_id": "CustomerX",
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "phone_country_code": "+1",
    "description": "Its my first payment request",
    "authentication_type": "no_three_ds",
    "return_url": "https://google.com",
    "payment_method": "wallet",
    "payment_method_type": "google_pay",
    "payment_method_data": {
        "wallet": {
            "google_pay": {
                "type": "CARD",
                "description": "Visa •••• 1111",
                "info": {
                    "card_network": "VISA",
                    "card_details": "1111"
                },
                "tokenization_data": {
                    "type": "PAYMENT_GATEWAY",
                    "token": "{\"signature\":\"Mz\"}"
                }
            }
        }
    },
    "billing": {
        "address": {
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "city": "San Fransico",
            "state": "Dubai",
            "zip": "94122",
            "country": "AE",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+97"
        }
    },
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS"
    
    ,
    "mandate_data": {
        "customer_acceptance": {
            "acceptance_type": "offline",
            "accepted_at": "1963-05-03T04:07:52.723Z",
            "online": {
                "ip_address": "125.0.0.1",
                "user_agent": "amet irure esse"
            }
        },
        "mandate_type": {
            "multi_use": {
                "amount": 1000,
                "currency": "USD",
                "start_date": "2023-04-21T00:00:00Z",
                "end_date": "2023-05-21T00:00:00Z",
                "metadata": {
                    "frequency": "13"
                }
            }
        }
    },
    "setup_future_usage": "off_session"

}'

Response

{
    "payment_id": "pay_2EwINOXkho0LWNH3nXmJ",
    "merchant_id": "merchant_1732193622",
    "status": "succeeded",
    "amount": 10000,
    "net_amount": 10000,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 10000,
    "connector": "cybersource",
    "client_secret": "pay_2EwINOXkho0LWNH3nXmJ_secret_LvsitK5yYVopwl6jK6dF",
    "created": "2024-11-21T12:55:19.435Z",
    "currency": "PLN",
    "customer_id": "CustomerX",
    "customer": {
        "id": "CustomerX",
        "name": "John Doe",
        "email": "[email protected]",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": "Its my first payment request",
    "refunds": null,
    "disputes": null,
    "mandate_id": "man_P74lcNfYDTBEdpbxgKER",
    "mandate_data": {
        "update_mandate_id": null,
        "customer_acceptance": {
            "acceptance_type": "offline",
            "accepted_at": "1963-05-03T04:07:52.723Z",
            "online": {
                "ip_address": "125.0.0.1",
                "user_agent": "amet irure esse"
            }
        },
        "mandate_type": {
            "multi_use": {
                "amount": 1000,
                "currency": "USD",
                "start_date": "2023-04-21T00:00:00.000Z",
                "end_date": "2023-05-21T00:00:00.000Z",
                "metadata": {
                    "frequency": "13"
                }
            }
        }
    },
    "setup_future_usage": "off_session",
    "off_session": null,
    "capture_on": null,
    "capture_method": "automatic",
    "payment_method": "wallet",
    "payment_method_data": {
        "wallet": {
            "google_pay": {
                "last4": "1111",
                "card_network": "VISA",
                "type": "CARD"
            }
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": {
        "address": {
            "city": "San Fransico",
            "country": "AE",
            "line1": "1467",
            "line2": "Harrison Street",
            "line3": "Harrison Street",
            "zip": "94122",
            "state": "Dubai",
            "first_name": "joseph",
            "last_name": "Doe"
        },
        "phone": {
            "number": "8056594427",
            "country_code": "+97"
        },
        "email": null
    },
    "order_details": null,
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "statement_descriptor_name": "joseph",
    "statement_descriptor_suffix": "JS",
    "next_action": null,
    "cancellation_reason": null,
    "error_code": null,
    "error_message": null,
    "unified_code": null,
    "unified_message": null,
    "payment_experience": null,
    "payment_method_type": "google_pay",
    "connector_label": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "CustomerX",
        "created_at": 1732193719,
        "expires": 1732197319,
        "secret": "epk_8b6d16dd3fd14d09a3271f748f2073c7"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7321937196376524304953",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_2EwINOXkho0LWNH3nXmJ_1",
    "payment_link": null,
    "profile_id": "pro_9Lg7G2CtmwcsBHGPmFxJ",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_T01hal3cEXdTRdvr6aL7",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-11-21T13:10:19.435Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": "pm_6aPLImPeEEFrHcMC4ZTI",
    "payment_method_status": null,
    "updated": "2024-11-21T12:55:21.942Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null
}
  1. Do a card payment via PLN cybersource
curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_0GGWV59O1lNRZ09AZbD3Kro4CFqhkWBlUSC8QBd072jy4E7T4rsi0Bp07CawLE1N' \
--data-raw '{


  "amount": 1404,
  "currency": "PLN",
  "confirm": true,
  "capture_method": "automatic",
  "capture_on": "2022-09-10T10:11:12Z",

  "customer_id": "CustomerX",
  "email": "[email protected]",
  "authentication_type": "no_three_ds",
  "return_url": "https://google.com",
  "payment_method": "card",
  "payment_method_type": "credit",
  "payment_method_data": {
    "card": {
    
      "card_number": "4111111111111111",
    
    
      "card_exp_month": "12",
      "card_exp_year": "30",
      "card_holder_name": "joseph Doe",
      "card_cvc": "029"
    }
  },
  "billing": {
    "address": {
      "line1": "cq",
      "city": "dshcvjhdw",
      "state": "whecvjkcdv",
      "zip": "46205",
      "country": "MW",
      "first_name": "joseph",
      "last_name": "doe"
    },
    "phone": {
      "number": "12345",
      "country_code": "+93"
    }
  },
  "metadata": {
    "count_tickets": 1,
    "transaction_number": "5590043"
  },
  "business_label": "food",
  "business_country": "US"
}'

Respone

{
    "payment_id": "pay_XHu3qy854hdtYGEtI21A",
    "merchant_id": "merchant_1732193622",
    "status": "succeeded",
    "amount": 1404,
    "net_amount": 1404,
    "shipping_cost": null,
    "amount_capturable": 0,
    "amount_received": 1404,
    "connector": "cybersource",
    "client_secret": "pay_XHu3qy854hdtYGEtI21A_secret_YdyQwjtFTdkrbUsNQsFj",
    "created": "2024-11-21T12:57:03.858Z",
    "currency": "PLN",
    "customer_id": "CustomerX",
    "customer": {
        "id": "CustomerX",
        "name": "John Doe",
        "email": "[email protected]",
        "phone": "999999999",
        "phone_country_code": "+1"
    },
    "description": null,
    "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": "1111",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "411111",
            "card_extended_bin": null,
            "card_exp_month": "12",
            "card_exp_year": "30",
            "card_holder_name": null,
            "payment_checks": {
                "avs_response": {
                    "code": "Y",
                    "codeRaw": "Y"
                },
                "card_verification": null
            },
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": "token_nECUY6AS4l2bqpKF5ZC5",
    "shipping": null,
    "billing": {
        "address": {
            "city": "dshcvjhdw",
            "country": "MW",
            "line1": "cq",
            "line2": null,
            "line3": null,
            "zip": "46205",
            "state": "whecvjkcdv",
            "first_name": "joseph",
            "last_name": "doe"
        },
        "phone": {
            "number": "12345",
            "country_code": "+93"
        },
        "email": null
    },
    "order_details": null,
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "999999999",
    "return_url": "https://google.com/",
    "authentication_type": "no_three_ds",
    "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": "credit",
    "connector_label": "cybersource_US_food_default",
    "business_country": "US",
    "business_label": "food",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": {
        "customer_id": "CustomerX",
        "created_at": 1732193823,
        "expires": 1732197423,
        "secret": "epk_a7cf79e303944fe3887a0db8a9b94aaf"
    },
    "manual_retry_allowed": false,
    "connector_transaction_id": "7321938248516770104953",
    "frm_message": null,
    "metadata": {
        "count_tickets": 1,
        "transaction_number": "5590043"
    },
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": "pay_XHu3qy854hdtYGEtI21A_1",
    "payment_link": null,
    "profile_id": "pro_9Lg7G2CtmwcsBHGPmFxJ",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_T01hal3cEXdTRdvr6aL7",
    "incremental_authorization_allowed": false,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-11-21T13:12:03.858Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-11-21T12:57:05.696Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null,
    "order_tax_amount": null,
    "connector_mandate_id": null
}

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@AkshayaFoiger AkshayaFoiger self-assigned this Nov 21, 2024
@AkshayaFoiger AkshayaFoiger requested a review from a team as a code owner November 21, 2024 10:22
Copy link

Review changes with  SemanticDiff

@AkshayaFoiger AkshayaFoiger added A-connector-compatibility Area: Connector compatibility A-connector-integration Area: Connector integration M-configuration-changes Metadata: This PR involves configuration changes labels Nov 21, 2024
@likhinbopanna likhinbopanna added this pull request to the merge queue Nov 22, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-connector-compatibility Area: Connector compatibility A-connector-integration Area: Connector integration M-configuration-changes Metadata: This PR involves configuration changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants