Skip to content

Conversation

awasthi21
Copy link
Contributor

@awasthi21 awasthi21 commented Jul 23, 2024

Type of Change

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

Description

1)Datatrans accepts expiry year in YY format only . Fixed that.
2) Removed the Check for 3ds flow (Earlier Not Implemented error was thrown)

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

https://github.com/juspay/hyperswitch-cloud/issues/6000#issuecomment-2238555051

How did you test it?

for 3DS
Request

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key:' \
--data '{
  "amount": 800,
  "currency": "USD",
  "amount_to_capture":800,
  "confirm": true,
  "capture_method": "automatic",
   "authentication_type": "three_ds",
  "payment_method": "card",
  "payment_method_type": "credit",
  "payment_method_data": {
    "card": {
      "card_number": "4444090101010103",
      "card_exp_month": "06",
      "card_exp_year": "2025",
      "card_holder_name": "joseph Doe",
      "card_cvc":"232"
    }
  }
}'

Response

{
    "payment_id": "pay_pftZ6ZUSVQHhl5x1LVqY",
    "merchant_id": "merchant_1721718695",
    "status": "succeeded",
    "amount": 800,
    "net_amount": 800,
    "amount_capturable": 0,
    "amount_received": 800,
    "connector": "datatrans",
    "client_secret": "",
    "created": "2024-07-23T12:45:27.244Z",
    "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": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "0103",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "444409",
            "card_extended_bin": null,
            "card_exp_month": "06",
            "card_exp_year": "2025",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "authentication_type": "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": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "240723144528071750",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_6MuPGJ3Nd98kACtcKri3",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_6Z91ANL4judTAaUtsanU",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-07-23T13:00:27.244Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-07-23T12:45:28.213Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null
}

For YYYY (expiry year in YYYY format)

Request

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: dev_o8aYC1pZ22TWzVF1GpZx2DbTVEnuJThYNJIiLV7ui4voaLh7hsmVsvaZfzBz60RB' \
--data '{
  "amount": 1000,
  "currency": "USD",
  "amount_to_capture":1000,
  "confirm": true,
  "capture_method": "automatic",
  "payment_method": "card",
  "payment_method_type": "credit",
  "payment_method_data": {
    "card": {
      "card_number": "4000000000001000",
      "card_exp_month": "06",
      "card_exp_year": "2045",
      "card_holder_name": "joseph Doe",
      "card_cvc":"232"
    }
  }
}'

Response

{
    "payment_id": "pay_PZlQaLUHloYO8lFr3TYm",
    "merchant_id": "merchant_1721718695",
    "status": "succeeded",
    "amount": 1000,
    "net_amount": 1000,
    "amount_capturable": 0,
    "amount_received": 1000,
    "connector": "datatrans",
    "client_secret": "pay_PZlQaLUHloYO8lFr3TYm_secret_zwBnsh3ejOBVlJDo6y3w",
    "created": "2024-07-23T12:51:23.901Z",
    "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": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1000",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "06",
            "card_exp_year": "2045",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "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": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "240723145124645224",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_6MuPGJ3Nd98kACtcKri3",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_6Z91ANL4judTAaUtsanU",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-07-23T13:06:23.901Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-07-23T12:51:24.760Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_id": null
}

YY -Expiry Year
Request

curl --location 'http://localhost:8080/payments' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key:' \
--data '{
  "amount": 1000,
  "currency": "USD",
  "amount_to_capture":1000,
  "confirm": true,
  "capture_method": "automatic",
  "payment_method": "card",
  "payment_method_type": "credit",
  "payment_method_data": {
    "card": {
      "card_number": "4000000000001000",
      "card_exp_month": "06",
      "card_exp_year": "45",
      "card_holder_name": "joseph Doe",
      "card_cvc":"232"
    }
  }
}'

Response

{
    "payment_id": "pay_cNh1ZMQY66KYko3NW1Wf",
    "merchant_id": "merchant_1721718695",
    "status": "succeeded",
    "amount": 1000,
    "net_amount": 1000,
    "amount_capturable": 0,
    "amount_received": 1000,
    "connector": "datatrans",
    "client_secret": "pay_cNh1ZMQY66KYko3NW1Wf_secret_8iRn3JhcSLw6DoMX0fOu",
    "created": "2024-07-23T14:13:23.596Z",
    "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": "automatic",
    "payment_method": "card",
    "payment_method_data": {
        "card": {
            "last4": "1000",
            "card_type": null,
            "card_network": null,
            "card_issuer": null,
            "card_issuing_country": null,
            "card_isin": "400000",
            "card_extended_bin": null,
            "card_exp_month": "06",
            "card_exp_year": "45",
            "card_holder_name": "joseph Doe",
            "payment_checks": null,
            "authentication_data": null
        },
        "billing": null
    },
    "payment_token": null,
    "shipping": null,
    "billing": null,
    "order_details": null,
    "email": null,
    "name": null,
    "phone": null,
    "return_url": null,
    "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": null,
    "business_country": null,
    "business_label": "default",
    "business_sub_label": null,
    "allowed_payment_method_types": null,
    "ephemeral_key": null,
    "manual_retry_allowed": false,
    "connector_transaction_id": "240723161326887353",
    "frm_message": null,
    "metadata": null,
    "connector_metadata": null,
    "feature_metadata": null,
    "reference_id": null,
    "payment_link": null,
    "profile_id": "pro_6MuPGJ3Nd98kACtcKri3",
    "surcharge_details": null,
    "attempt_count": 1,
    "merchant_decision": null,
    "merchant_connector_id": "mca_6Z91ANL4judTAaUtsanU",
    "incremental_authorization_allowed": null,
    "authorization_count": null,
    "incremental_authorizations": null,
    "external_authentication_details": null,
    "external_3ds_authentication_attempted": false,
    "expires_on": "2024-07-23T14:28:23.596Z",
    "fingerprint": null,
    "browser_info": null,
    "payment_method_id": null,
    "payment_method_status": null,
    "updated": "2024-07-23T14:13:26.821Z",
    "charges": null,
    "frm_metadata": null,
    "merchant_order_reference_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

@awasthi21 awasthi21 added the A-connector-integration Area: Connector integration label Jul 23, 2024
@awasthi21 awasthi21 self-assigned this Jul 23, 2024
@awasthi21 awasthi21 requested a review from a team as a code owner July 23, 2024 07:52
@awasthi21 awasthi21 changed the title removed the 3ds check ,fixed YYYY to YY issue fix(connector): [Datatrans] Handling for 4-Digit YYYY input and Correct 3DS Routing to no_3ds Jul 23, 2024
Comment on lines 161 to 166
// if item.router_data.is_three_ds() {
// return Err(errors::ConnectorError::NotImplemented(
// "Three_ds payments through Datatrans".to_string(),
// )
// .into());
// };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this rather than commenting

@awasthi21 awasthi21 force-pushed the 5407-fixbug-backend-issue-for-4-digit-input branch from 6e0b9a3 to ab97a4f Compare July 23, 2024 09:16
@likhinbopanna likhinbopanna added this pull request to the merge queue Jul 23, 2024
@likhinbopanna likhinbopanna removed this pull request from the merge queue due to a manual request Jul 23, 2024
@likhinbopanna likhinbopanna added this pull request to the merge queue Jul 23, 2024
Merged via the queue into main with commit 3e16219 Jul 23, 2024
@likhinbopanna likhinbopanna deleted the 5407-fixbug-backend-issue-for-4-digit-input branch July 23, 2024 13:18
pixincreate added a commit that referenced this pull request Jul 24, 2024
* 'main' of github.com:juspay/hyperswitch: (27 commits)
  refactor(connector): added amount conversion framework for billwerk (#4972)
  feat(connector): [Itaubank] Add refund and rsync flow  (#5420)
  feat: create additional columns in organization table (#5380)
  refactor(merchant_id): create domain type for `merchant_id` (#5408)
  fix(euclid): remove business_profile routing feature flag (#5430)
  feat: add create retrieve and update api endpoints for organization resource (#5361)
  chore(version): 2024.07.24.0
  refactor(connector): [Itaubank] add dynamic fields for pix (#5419)
  Feat(connector): [WELLSFARGO] Add template code (#5333)
  fix(connector): [Datatrans] Handling for 4-Digit YYYY input and Correct 3DS Routing to no_3ds (#5410)
  refactor(connector):  add amount conversion framework to volt (#4985)
  chore(users): email templates footer icon style enhance (#5375)
  feat(customer): customer v2 refactor for customer create end point (#5350)
  chore(version): 2024.07.23.0
  fix(router): store `network_transaction_id` in stripe `authorize` flow (#5399)
  ci: handle packages to run are being empty (#5403)
  chore: add customer, shipping and billing details to payment_response for payment list api (#5401)
  refactor(dashboard_metadata): alter query for merchant scoped metadata (#5397)
  refactor(connector): Add billing_country in klarna dynamic fields (#5373)
  feat(connector): [Itau Bank] Add payment and sync flow for Pix (#5342)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-connector-integration Area: Connector integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix(bug): Backend Issue for 4-Digit Input and Correct 3DS Routing Through no_3ds for Datatrans
4 participants