hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

Feature(core): Added a new CaptureMethod : SequentialAutomatic to Support CIT Mandates for Paybox

Open awasthi21 opened this issue 1 year ago • 1 comments

Type of Change

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

Description

  1. Added a new CaptureMethod : SequentialAutomatic -> does Auth and capture in two api calls one after the other
  1. For Paybox:

    • If the payment is a Customer-Initiated Transaction (CIT), two API calls will be made:
      • First for Authorization (Auth)
      • Followed by Capture (Capture)
    • For all other payment types, SequentialAutomatic will function the same as Automatic.
  2. For other connectors:

    • SequentialAutomatic will behave the same as Automatic.

Additional Changes

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

Motivation and Context

For Customer-Initiated Transactions (CIT) with Paybox, authorization and capture must be performed as two separate operations. Paybox does not support a combined authorization and capture in a single request. To avoid requiring the merchant to handle this process, we introduced a new capture method: SequentialAutomatic, which ensures that two API calls are made automatically.

How did you test it?

Checklist

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

awasthi21 avatar Nov 15 '24 19:11 awasthi21

Review changes with  SemanticDiff

Changed Files
File Status
  crates/hyperswitch_connectors/src/connectors/airwallex/transformers.rs  85% smaller
  crates/hyperswitch_connectors/src/connectors/elavon.rs  85% smaller
  crates/hyperswitch_connectors/src/connectors/fiuu.rs  85% smaller
  crates/hyperswitch_connectors/src/connectors/payeezy.rs  85% smaller
  crates/router/src/connector/datatrans.rs  85% smaller
  crates/hyperswitch_connectors/src/connectors/rapyd/transformers.rs  85% smaller
  crates/hyperswitch_connectors/src/connectors/worldpay/transformers.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/fiservemea/transformers.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/airwallex.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/bambora.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/bamboraapac.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/boku.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/cashtocode.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/coinbase.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/deutschebank.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/dlocal.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/fiserv.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/fiservemea.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/forte.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/helcim.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/nexixpay.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/novalnet.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/payu.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/powertranz.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/rapyd.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/shift4.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/square.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/stax.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/tsys.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/worldline.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/worldpay.rs  84% smaller
  crates/router/src/connector/authorizedotnet.rs  84% smaller
  crates/router/src/connector/bankofamerica.rs  84% smaller
  crates/router/src/connector/bluesnap.rs  84% smaller
  crates/router/src/connector/braintree.rs  84% smaller
  crates/router/src/connector/cybersource.rs  84% smaller
  crates/router/src/connector/dummyconnector.rs  84% smaller
  crates/router/src/connector/klarna.rs  84% smaller
  crates/router/src/connector/nmi.rs  84% smaller
  crates/router/src/connector/noon.rs  84% smaller
  crates/router/src/connector/nuvei.rs  84% smaller
  crates/router/src/connector/opayo.rs  84% smaller
  crates/router/src/connector/paybox.rs  84% smaller
  crates/router/src/connector/payme.rs  84% smaller
  crates/router/src/connector/paypal.rs  84% smaller
  crates/router/src/connector/wellsfargo.rs  84% smaller
  crates/router/src/core/payments.rs  84% smaller
  crates/hyperswitch_connectors/src/connectors/billwerk.rs  83% smaller
  crates/hyperswitch_connectors/src/connectors/nexinets.rs  83% smaller
  crates/router/src/core/utils.rs  83% smaller
  crates/hyperswitch_connectors/src/connectors/fiserv/transformers.rs  83% smaller
  crates/router/src/connector/wellsfargo/transformers.rs  83% smaller
  crates/hyperswitch_connectors/src/utils.rs  82% smaller
  crates/router/src/connector/checkout/transformers.rs  82% smaller
  crates/hyperswitch_connectors/src/connectors/worldline/transformers.rs  81% smaller
  crates/router/src/connector/globalpay.rs  79% smaller
  crates/router/src/connector/stripe.rs  75% smaller
  crates/router/src/core/payments/helpers.rs  75% smaller
  crates/hyperswitch_connectors/src/connectors/globepay.rs  74% smaller
  crates/router/src/connector/paybox/transformers.rs  74% smaller
  crates/router/src/connector/authorizedotnet/transformers.rs  72% smaller
  api-reference-v2/openapi_spec.json  67% smaller
  api-reference/openapi_spec.json  67% smaller
  crates/router/src/connector/adyen.rs  67% smaller
  crates/hyperswitch_connectors/src/connectors/payeezy/transformers.rs  64% smaller
  crates/router/src/connector/stripe/transformers.rs  64% smaller
  crates/hyperswitch_connectors/src/connectors/nexixpay/transformers.rs  64% smaller
  crates/hyperswitch_connectors/src/connectors/fiuu/transformers.rs  63% smaller
  crates/router/src/connector/utils.rs  50% smaller
  crates/router/src/connector/checkout.rs  26% smaller
  crates/router/src/core/payments/flows/authorize_flow.rs  8% smaller
  crates/hyperswitch_domain_models/src/router_response_types.rs  4% smaller
  crates/hyperswitch_interfaces/src/api.rs  3% smaller
  crates/router/src/core/fraud_check/operation/fraud_check_post.rs  3% smaller
  crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs  3% smaller
  crates/hyperswitch_connectors/src/connectors/gocardless.rs  3% smaller
  crates/hyperswitch_connectors/src/connectors/mollie/transformers.rs  3% smaller
  crates/hyperswitch_connectors/src/connectors/multisafepay.rs  3% smaller
  crates/hyperswitch_connectors/src/connectors/zsl.rs  3% smaller
  crates/router/src/connector/placetopay.rs  3% smaller
  crates/router/src/types.rs  2% smaller
  crates/router/src/core/payments/flows/complete_authorize_flow.rs  1% smaller
  crates/router/src/core/payments/flows.rs  1% smaller
  crates/common_enums/src/enums.rs  0% smaller
  crates/hyperswitch_connectors/src/connectors/dlocal/transformers.rs  0% smaller
  crates/router/src/core/payments/routing/transformers.rs  0% smaller
  migrations/2024-11-15-171347_add_capture_method_sequential_automatic/down.sql Unsupported file format
  migrations/2024-11-15-171347_add_capture_method_sequential_automatic/up.sql Unsupported file format

semanticdiff-com[bot] avatar Nov 15 '24 19:11 semanticdiff-com[bot]

Can we add cypress test for this ?

likhinbopanna avatar Dec 04 '24 20:12 likhinbopanna

@likhinbopanna we dont support SequentialAutomatic capture method yet in the cypress tests(only have manual and automatic) So can we merge this without cypress for now?

awasthi21 avatar Dec 05 '24 00:12 awasthi21