Skip to content

feat(connector): [payload] add recurring payments #8597

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

Merged
merged 29 commits into from
Jul 31, 2025
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ea98601
fix: throw an error if billing address fields are missing
pixincreate Jul 4, 2025
3c923c2
ci(cypress): address comments added in #8545
pixincreate Jul 6, 2025
337981b
feat(webhook): implement response struct for payload webhook
pixincreate Jul 6, 2025
d7ea690
feat(webhook): implement traits and impl for payload webhook
pixincreate Jul 6, 2025
697921b
fix(mandate): [payload] throw 501 for setup mandates
pixincreate Jul 6, 2025
4425c9b
chore(env): payload does not support source verification
pixincreate Jul 6, 2025
fdf166f
chore: run formatter
pixincreate Jul 6, 2025
b148387
fix: webhook comment
pixincreate Jul 7, 2025
2b29029
refactor: add source verification (false), and fix mapping
pixincreate Jul 7, 2025
661fbbe
Merge branch 'main' of github.com:juspay/hyperswitch into connector/p…
pixincreate Jul 9, 2025
c83426f
Merge branch 'main' of github.com:juspay/hyperswitch into connector/p…
pixincreate Jul 11, 2025
18c86ec
chore: update configs for payload connector
pixincreate Jul 9, 2025
a9d88a9
chore: remove country filters
pixincreate Jul 9, 2025
b4c9e9d
refactor: update auth key type to `CurrencyAuthKey` instead of `Heade…
pixincreate Jul 9, 2025
32c0906
fix: issues
pixincreate Jul 10, 2025
1304e9f
chore: enable connector customer and mandate config for payload
pixincreate Jul 10, 2025
486ac82
feat: add `connectorCustomer` support, `mandate` support, use `string…
pixincreate Jul 10, 2025
9e3d426
chore: lints and format
pixincreate Jul 10, 2025
a01f905
fix: pass mandate details in `router_request_types`
pixincreate Jul 11, 2025
770d8bd
feat: add manual capture support for mandates
pixincreate Jul 11, 2025
a9c093d
ci: add tests for mandates in cypress
pixincreate Jul 11, 2025
813459a
chore: lints
pixincreate Jul 11, 2025
cfc91ba
refactor: remove unnecessary fields
pixincreate Jul 11, 2025
6dbff2d
revert: unit changes
pixincreate Jul 19, 2025
14f321e
remove: connector customer support
pixincreate Jul 19, 2025
704b77e
refactor: directly use `payment_method_id` to do recurring payment in…
pixincreate Jul 19, 2025
1f9c871
Merge branch 'main' of github.com:juspay/hyperswitch into connector/p…
pixincreate Jul 22, 2025
e1fb89b
chore: re-use in cypress
pixincreate Jul 25, 2025
abd569f
refactor: remove `setup_mandate_details` as it does not affect the flow
pixincreate Jul 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions config/config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,10 @@ crypto_currency = { country = "US, CA, GB, AT, BE, BG, HR, CY, CZ, DK, EE, FI, F
debit = { country = "FR", currency = "CAD, AUD, EUR, USD" }
credit = { country = "FR", currency = "CAD, AUD, EUR, USD" }

[pm_filters.payload]
debit = { currency = "USD,CAD" }
credit = { currency = "USD,CAD" }

[pm_filters.digitalvirgo]
direct_carrier_billing = {country = "MA, CM, ZA, EG, SN, DZ, TN, ML, GN, GH, LY, GA, CG, MG, BW, SD, NG, ID, SG, AZ, TR, FR, ES, PL, GB, PT, DE, IT, BE, IE, SK, GR, NL, CH, BR, MX, AR, CL, AE, IQ, KW, BH, SA, QA, PS, JO, OM, RU" , currency = "MAD, XOF, XAF, ZAR, EGP, DZD, TND, GNF, GHS, LYD, XAF, CDF, MGA, BWP, SDG, NGN, IDR, SGD, RUB, AZN, TRY, EUR, PLN, GBP, CHF, BRL, MXN, ARS, CLP, AED, IQD, KWD, BHD, SAR, QAR, ILS, JOD, OMR" }

Expand Down
8 changes: 6 additions & 2 deletions config/deployments/integration_test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen,stripe" }
bank_debit.becs = { connector_list = "gocardless,stripe,adyen" }
bank_debit.bacs = { connector_list = "stripe,gocardless" }
bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv"
card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv"
card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
pay_later.klarna.connector_list = "adyen,aci"
wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet,wellsfargo"
wallet.samsung_pay.connector_list = "cybersource"
Expand Down Expand Up @@ -436,6 +436,10 @@ crypto_currency = { country = "US, CA, GB, AT, BE, BG, HR, CY, CZ, DK, EE, FI, F
debit = { country = "FR", currency = "CAD, AUD, EUR, USD" }
credit = { country = "FR", currency = "CAD, AUD, EUR, USD" }

[pm_filters.payload]
debit = { currency = "USD,CAD" }
credit = { currency = "USD,CAD" }

[pm_filters.digitalvirgo]
direct_carrier_billing = {country = "MA, CM, ZA, EG, SN, DZ, TN, ML, GN, GH, LY, GA, CG, MG, BW, SD, NG, ID, SG, AZ, TR, FR, ES, PL, GB, PT, DE, IT, BE, IE, SK, GR, NL, CH, BR, MX, AR, CL, AE, IQ, KW, BH, SA, QA, PS, JO, OM, RU" , currency = "MAD, XOF, XAF, ZAR, EGP, DZD, TND, GNF, GHS, LYD, XAF, CDF, MGA, BWP, SDG, NGN, IDR, SGD, RUB, AZN, TRY, EUR, PLN, GBP, CHF, BRL, MXN, ARS, CLP, AED, IQD, KWD, BHD, SAR, QAR, ILS, JOD, OMR" }

Expand Down
8 changes: 6 additions & 2 deletions config/deployments/production.toml
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen,stripe" }
bank_debit.becs = { connector_list = "gocardless,stripe,adyen" }
bank_debit.bacs = { connector_list = "stripe,gocardless" }
bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv"
card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv"
card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
pay_later.klarna.connector_list = "adyen,aci"
wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet,wellsfargo"
wallet.samsung_pay.connector_list = "cybersource"
Expand Down Expand Up @@ -514,6 +514,10 @@ crypto_currency = { country = "US, CA, GB, AT, BE, BG, HR, CY, CZ, DK, EE, FI, F
debit = { country = "FR", currency = "CAD, AUD, EUR, USD" }
credit = { country = "FR", currency = "CAD, AUD, EUR, USD" }

[pm_filters.payload]
debit = { currency = "USD,CAD" }
credit = { currency = "USD,CAD" }

[pm_filters.digitalvirgo]
direct_carrier_billing = {country = "MA, CM, ZA, EG, SN, DZ, TN, ML, GN, GH, LY, GA, CG, MG, BW, SD, NG, ID, SG, AZ, TR, FR, ES, PL, GB, PT, DE, IT, BE, IE, SK, GR, NL, CH, BR, MX, AR, CL, AE, IQ, KW, BH, SA, QA, PS, JO, OM, RU" , currency = "MAD, XOF, XAF, ZAR, EGP, DZD, TND, GNF, GHS, LYD, XAF, CDF, MGA, BWP, SDG, NGN, IDR, SGD, RUB, AZN, TRY, EUR, PLN, GBP, CHF, BRL, MXN, ARS, CLP, AED, IQD, KWD, BHD, SAR, QAR, ILS, JOD, OMR" }

Expand Down
8 changes: 6 additions & 2 deletions config/deployments/sandbox.toml
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen,stripe" }
bank_debit.becs = { connector_list = "gocardless,stripe,adyen" }
bank_debit.bacs = { connector_list = "stripe,gocardless" }
bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv"
card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv"
card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
pay_later.klarna.connector_list = "adyen,aci"
wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet,wellsfargo"
wallet.samsung_pay.connector_list = "cybersource"
Expand Down Expand Up @@ -526,6 +526,10 @@ direct_carrier_billing = {country = "MA, CM, ZA, EG, SN, DZ, TN, ML, GN, GH, LY,
debit = { country = "FR", currency = "CAD, AUD, EUR, USD" }
credit = { country = "FR", currency = "CAD, AUD, EUR, USD" }

[pm_filters.payload]
debit = { currency = "USD,CAD" }
credit = { currency = "USD,CAD" }

[pm_filters.klarna]
klarna = { country = "AU,AT,BE,CA,CZ,DK,FI,FR,DE,GR,IE,IT,NL,NZ,NO,PL,PT,ES,SE,CH,GB,US", currency = "CHF,DKK,EUR,GBP,NOK,PLN,SEK,USD,AUD,NZD,CAD" }

Expand Down
8 changes: 6 additions & 2 deletions config/development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,10 @@ crypto_currency = { country = "US, CA, GB, AT, BE, BG, HR, CY, CZ, DK, EE, FI, F
debit = { country = "FR", currency = "CAD, AUD, EUR, USD" }
credit = { country = "FR", currency = "CAD, AUD, EUR, USD" }

[pm_filters.payload]
debit = { currency = "USD,CAD" }
credit = { currency = "USD,CAD" }

[pm_filters.digitalvirgo]
direct_carrier_billing = {country = "MA, CM, ZA, EG, SN, DZ, TN, ML, GN, GH, LY, GA, CG, MG, BW, SD, NG, ID, SG, AZ, TR, FR, ES, PL, GB, PT, DE, IT, BE, IE, SK, GR, NL, CH, BR, MX, AR, CL, AE, IQ, KW, BH, SA, QA, PS, JO, OM, RU" , currency = "MAD, XOF, XAF, ZAR, EGP, DZD, TND, GNF, GHS, LYD, XAF, CDF, MGA, BWP, SDG, NGN, IDR, SGD, RUB, AZN, TRY, EUR, PLN, GBP, CHF, BRL, MXN, ARS, CLP, AED, IQD, KWD, BHD, SAR, QAR, ILS, JOD, OMR" }

Expand Down Expand Up @@ -976,8 +980,8 @@ bank_debit.ach = { connector_list = "gocardless,adyen,stripe" }
bank_debit.becs = { connector_list = "gocardless,stripe,adyen" }
bank_debit.bacs = { connector_list = "stripe,gocardless" }
bank_debit.sepa = { connector_list = "gocardless,adyen,stripe,deutschebank" }
card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv"
card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv"
card.credit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
card.debit.connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,braintree,nuvei,payme,wellsfargo,bamboraapac,elavon,fiuu,nexixpay,novalnet,paybox,paypal,xendit,moneris,archipel,worldpayvantiv,payload"
pay_later.klarna.connector_list = "adyen,aci"
wallet.apple_pay.connector_list = "stripe,adyen,cybersource,noon,bankofamerica,nexinets,novalnet,authorizedotnet,wellsfargo"
wallet.samsung_pay.connector_list = "cybersource"
Expand Down
8 changes: 6 additions & 2 deletions config/docker_compose.toml
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,10 @@ crypto_currency = { country = "US, CA, GB, AT, BE, BG, HR, CY, CZ, DK, EE, FI, F
debit = { country = "FR", currency = "CAD, AUD, EUR, USD" }
credit = { country = "FR", currency = "CAD, AUD, EUR, USD" }

[pm_filters.payload]
debit = { currency = "USD,CAD" }
credit = { currency = "USD,CAD" }

[pm_filters.digitalvirgo]
direct_carrier_billing = {country = "MA, CM, ZA, EG, SN, DZ, TN, ML, GN, GH, LY, GA, CG, MG, BW, SD, NG, ID, SG, AZ, TR, FR, ES, PL, GB, PT, DE, IT, BE, IE, SK, GR, NL, CH, BR, MX, AR, CL, AE, IQ, KW, BH, SA, QA, PS, JO, OM, RU" , currency = "MAD, XOF, XAF, ZAR, EGP, DZD, TND, GNF, GHS, LYD, XAF, CDF, MGA, BWP, SDG, NGN, IDR, SGD, RUB, AZN, TRY, EUR, PLN, GBP, CHF, BRL, MXN, ARS, CLP, AED, IQD, KWD, BHD, SAR, QAR, ILS, JOD, OMR" }

Expand Down Expand Up @@ -899,8 +903,8 @@ wallet.google_pay = { connector_list = "stripe,adyen,bankofamerica,authorizedotn
wallet.apple_pay = { connector_list = "stripe,adyen,cybersource,noon,bankofamerica,authorizedotnet,novalnet,multisafepay,wellsfargo" }
wallet.samsung_pay = { connector_list = "cybersource" }
wallet.paypal = { connector_list = "adyen,novalnet,authorizedotnet" }
card.credit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,elavon,xendit,novalnet,bamboraapac,archipel,wellsfargo,worldpayvantiv" }
card.debit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,elavon,xendit,novalnet,bamboraapac,archipel,wellsfargo,worldpayvantiv" }
card.credit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,elavon,xendit,novalnet,bamboraapac,archipel,wellsfargo,worldpayvantiv,payload" }
card.debit = { connector_list = "stripe,adyen,authorizedotnet,cybersource,datatrans,globalpay,worldpay,multisafepay,nmi,nexinets,noon,bankofamerica,elavon,xendit,novalnet,bamboraapac,archipel,wellsfargo,worldpayvantiv,payload" }
bank_debit.ach = { connector_list = "gocardless,adyen" }
bank_debit.becs = { connector_list = "gocardless" }
bank_debit.bacs = { connector_list = "adyen" }
Expand Down
9 changes: 7 additions & 2 deletions crates/connector_configs/toml/development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6326,9 +6326,14 @@ type="Text"
payment_method_type = "Mastercard"
[[payload.debit]]
payment_method_type = "Visa"
[payload.connector_auth.HeaderKey]
api_key="API Key"

[payload.connector_auth.CurrencyAuthKey.auth_key_map.USD]
processing_account_id = "processing_account_id"
api_key = "API Key"
[payload.connector_auth.CurrencyAuthKey.auth_key_map.CAD]
processing_account_id = "processing_account_id"
api_key = "API Key"

[silverflow]
[silverflow.connector_auth.BodyKey]
api_key="API Key"
Expand Down
7 changes: 6 additions & 1 deletion crates/connector_configs/toml/production.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4935,7 +4935,12 @@ payment_method_type = "Discover"
payment_method_type = "Mastercard"
[[payload.debit]]
payment_method_type = "Visa"
[payload.connector_auth.HeaderKey]

[payload.connector_auth.CurrencyAuthKey.auth_key_map.USD]
processing_account_id = "processing_account_id"
api_key = "API Key"
[payload.connector_auth.CurrencyAuthKey.auth_key_map.CAD]
processing_account_id = "processing_account_id"
api_key = "API Key"

[silverflow]
Expand Down
7 changes: 6 additions & 1 deletion crates/connector_configs/toml/sandbox.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6305,7 +6305,12 @@ payment_method_type = "Discover"
payment_method_type = "Mastercard"
[[payload.debit]]
payment_method_type = "Visa"
[payload.connector_auth.HeaderKey]

[payload.connector_auth.CurrencyAuthKey.auth_key_map.USD]
processing_account_id = "processing_account_id"
api_key = "API Key"
[payload.connector_auth.CurrencyAuthKey.auth_key_map.CAD]
processing_account_id = "processing_account_id"
api_key = "API Key"

[silverflow]
Expand Down
41 changes: 17 additions & 24 deletions crates/hyperswitch_connectors/src/connectors/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,16 @@ impl ConnectorCommon for Payload {
) -> CustomResult<Vec<(String, masking::Maskable<String>)>, errors::ConnectorError> {
let auth = payload::PayloadAuthType::try_from(auth_type)
.change_context(errors::ConnectorError::FailedToObtainAuthType)?;
let encoded_api_key = BASE64_ENGINE.encode(format!("{}:", auth.api_key.expose()));
// The API key is the same for all currencies, so we can take any.
let api_key = auth
.auths
.values()
.next()
.ok_or(errors::ConnectorError::FailedToObtainAuthType)?
.api_key
.clone();

let encoded_api_key = BASE64_ENGINE.encode(format!("{}:", api_key.expose()));
Ok(vec![(
headers::AUTHORIZATION.to_string(),
format!("Basic {encoded_api_key}").into_masked(),
Expand Down Expand Up @@ -166,32 +175,16 @@ impl ConnectorCommon for Payload {
impl ConnectorValidation for Payload {
fn validate_mandate_payment(
&self,
_pm_type: Option<enums::PaymentMethodType>,
pm_type: Option<enums::PaymentMethodType>,
pm_data: PaymentMethodData,
) -> CustomResult<(), errors::ConnectorError> {
match pm_data {
PaymentMethodData::Card(_) => Err(errors::ConnectorError::NotImplemented(
"validate_mandate_payment does not support cards".to_string(),
)
.into()),
_ => Ok(()),
}
}

fn validate_psync_reference_id(
&self,
_data: &PaymentsSyncData,
_is_three_ds: bool,
_status: enums::AttemptStatus,
_connector_meta_data: Option<common_utils::pii::SecretSerdeValue>,
) -> CustomResult<(), errors::ConnectorError> {
Ok(())
let mandate_supported_pmd =
std::collections::HashSet::from([utils::PaymentMethodDataType::Card]);
utils::is_mandate_supported(pm_data, pm_type, mandate_supported_pmd, self.id())
}
}

impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Payload {
//TODO: implement sessions flow
}
impl ConnectorIntegration<Session, PaymentsSessionData, PaymentsResponseData> for Payload {}

impl ConnectorIntegration<AccessTokenAuth, AccessTokenRequestData, AccessToken> for Payload {}

Expand Down Expand Up @@ -822,7 +815,7 @@ static PAYLOAD_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = La
enums::PaymentMethod::Card,
enums::PaymentMethodType::Credit,
PaymentMethodDetails {
mandates: enums::FeatureStatus::NotSupported,
mandates: enums::FeatureStatus::Supported,
refunds: enums::FeatureStatus::Supported,
supported_capture_methods: supported_capture_methods.clone(),
specific_features: Some(
Expand All @@ -840,7 +833,7 @@ static PAYLOAD_SUPPORTED_PAYMENT_METHODS: LazyLock<SupportedPaymentMethods> = La
enums::PaymentMethod::Card,
enums::PaymentMethodType::Debit,
PaymentMethodDetails {
mandates: enums::FeatureStatus::NotSupported,
mandates: enums::FeatureStatus::Supported,
refunds: enums::FeatureStatus::Supported,
supported_capture_methods: supported_capture_methods.clone(),
specific_features: Some(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ use crate::connectors::payload::responses;
#[derive(Debug, Serialize, PartialEq)]
#[serde(untagged)]
pub enum PayloadPaymentsRequest {
PayloadCardsRequest(PayloadCardsRequestData),
PayloadCardsRequest(Box<PayloadCardsRequestData>),
PayloadMandateRequest(Box<PayloadMandateRequestData>),
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
Expand Down Expand Up @@ -51,6 +52,24 @@ pub struct PayloadCardsRequestData {
// Billing address fields are for AVS validation
#[serde(flatten)]
pub billing_address: BillingAddress,
pub processing_id: Option<Secret<String>>,
/// Allows one-time payment by customer without saving their payment method
/// This is true by default
#[serde(rename = "payment_method[keep_active]")]
pub keep_active: bool,
}

#[derive(Debug, Clone, Serialize, PartialEq)]
pub struct PayloadMandateRequestData {
pub amount: StringMajorUnit,
#[serde(rename = "type")]
pub transaction_types: TransactionTypes,
// Based on the connectors' response, we can do recurring payment either based on a default payment method id saved in the customer profile or a specific payment method id
// Connector by default, saves every payment method
pub payment_method_id: Secret<String>,
// For manual capture, set status to "authorized", otherwise omit
#[serde(skip_serializing_if = "Option::is_none")]
pub status: Option<responses::PayloadPaymentStatus>,
}

#[derive(Default, Clone, Debug, Serialize, Eq, PartialEq)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ pub enum AvsResponse {
pub struct PayloadCardsResponseData {
pub amount: f64,
pub avs: Option<AvsResponse>,
pub customer_id: Option<String>,
pub customer_id: Option<Secret<String>>,
#[serde(rename = "id")]
pub transaction_id: String,
pub payment_method_id: Option<Secret<String>>,
// Connector customer id
pub processing_id: Option<String>,
#[serde(rename = "payment_method_id")]
pub connector_payment_method_id: Option<Secret<String>>,
pub processing_id: Option<Secret<String>>,
pub processing_method_id: Option<String>,
pub ref_number: Option<String>,
pub status: PayloadPaymentStatus,
Expand Down Expand Up @@ -84,9 +84,9 @@ pub struct PayloadRefundResponse {
#[serde(rename = "id")]
pub transaction_id: String,
pub ledger: Vec<RefundsLedger>,
pub payment_method_id: Option<Secret<String>>,
// Connector customer id
pub processing_id: Option<String>,
#[serde(rename = "payment_method_id")]
pub connector_payment_method_id: Option<Secret<String>>,
pub processing_id: Option<Secret<String>>,
pub ref_number: Option<String>,
pub status: RefundStatus,
pub status_code: Option<String>,
Expand Down
Loading
Loading