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(core): Payments core modification for open banking connectors #3947

Merged
merged 68 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
f9848a0
feat(mca): Added recipient connector call for open banking connectors
Sarthak1799 Feb 20, 2024
708774f
chore: run formatter
hyperswitch-bot[bot] Feb 21, 2024
5315345
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] Feb 21, 2024
97113e3
Merge branch 'mca-merchant-recipient' of github.com:juspay/hyperswitc…
Sarthak1799 Mar 4, 2024
712796d
feat(core): Post Processing flows for open banking integration
Sarthak1799 Mar 4, 2024
1886c11
Merge branch 'main' of github.com:juspay/hyperswitch into mca-merchan…
Sarthak1799 Mar 4, 2024
41666a0
fix(mca): Some fixes
Sarthak1799 Mar 4, 2024
b74435b
Merge branch 'mca-merchant-recipient' of github.com:juspay/hyperswitc…
Sarthak1799 Mar 4, 2024
e6a8754
fix(mca): Use merchant_id for customer in lcoker call
Sarthak1799 Mar 5, 2024
cd248fa
Merge branch 'mca-merchant-recipient' of github.com:juspay/hyperswitc…
Sarthak1799 Mar 5, 2024
a8e840a
fix(core): Pass merchant_id as cust_id for locker call
Sarthak1799 Mar 5, 2024
b2c0b5a
fix(core): Additional changes
Sarthak1799 Mar 5, 2024
8b78b91
fix(mca) :Fixed clippy errors
Sarthak1799 Mar 11, 2024
add3a15
Merge branch 'mca-merchant-recipient' of github.com:juspay/hyperswitc…
Sarthak1799 Mar 11, 2024
89d9e7e
chore: run formatter
hyperswitch-bot[bot] Mar 11, 2024
40547b3
fix(core): Fixed clippy errors
Sarthak1799 Mar 11, 2024
68fd2db
chore: run formatter
hyperswitch-bot[bot] Mar 11, 2024
6ae507e
fix(mca): Fixed mca response
Sarthak1799 Mar 12, 2024
2f72a23
Merge branch 'mca-merchant-recipient' of github.com:juspay/hyperswitc…
Sarthak1799 Mar 12, 2024
d7839fe
Merge branch 'main' of github.com:juspay/hyperswitch into mca-merchan…
Sarthak1799 Mar 13, 2024
1bbd8c3
chore: run formatter
hyperswitch-bot[bot] Mar 13, 2024
7ba1295
fix(mca): Resolved comments
Sarthak1799 Mar 15, 2024
516e1f8
fix(mca): Resolved comments
Sarthak1799 Mar 15, 2024
6df183d
chore: run formatter
hyperswitch-bot[bot] Mar 15, 2024
aba43fb
Merge branch 'main' of github.com:juspay/hyperswitch into mca-merchan…
Sarthak1799 Apr 12, 2024
0265a1f
refactor(mca): Additional merchant data in mca
Sarthak1799 Apr 22, 2024
601dc3b
Merge branch 'main' of github.com:juspay/hyperswitch into mca-merchan…
Sarthak1799 Apr 22, 2024
a9608ef
fix(mca): Fixed errors
Sarthak1799 Apr 22, 2024
83c98ec
fix(mca): Fixed errors
Sarthak1799 Apr 23, 2024
5c1fd4d
fix(mca): fixed more errors
Sarthak1799 Apr 23, 2024
bc5e523
fix(mca): Fixed more errors
Sarthak1799 Apr 23, 2024
b3d291c
Merge branch 'main' of github.com:juspay/hyperswitch into mca-merchan…
Sarthak1799 May 14, 2024
cf62cbf
fix(mca): Resolved comments
Sarthak1799 May 14, 2024
a7ec74a
fix(mca): Added config
Sarthak1799 May 16, 2024
237148e
Merge branch 'main' of github.com:juspay/hyperswitch into mca-merchan…
Sarthak1799 May 23, 2024
1296af5
Merge branch 'main' of github.com:juspay/hyperswitch into mca-merchan…
Sarthak1799 Jul 8, 2024
15bf83a
fix(mca): Fixed errors
Sarthak1799 Jul 8, 2024
91cb50f
fix(mca): Fixed errors
Sarthak1799 Jul 8, 2024
4ad6e68
Merge branch 'mca-merchant-recipient' of github.com:juspay/hyperswitc…
Sarthak1799 Jul 9, 2024
4bf7b65
Merge branch 'mca-merchant-recipient' of github.com:juspay/hyperswitc…
Sarthak1799 Jul 10, 2024
0a2e266
Merge branch 'main' of github.com:juspay/hyperswitch into mca-merchan…
Sarthak1799 Jul 10, 2024
4cff58f
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] Jul 10, 2024
b5ee966
refactor(core): Refactored a bit
Sarthak1799 Jul 10, 2024
bc6ec0b
fix(mca): Resolved comments
Sarthak1799 Jul 10, 2024
2cf744a
fix(mca): Fixed errors
Sarthak1799 Jul 10, 2024
f1affe5
fix(mca): Fixed errors
Sarthak1799 Jul 10, 2024
d177e87
fix(mca): Resolved comments
Sarthak1799 Jul 11, 2024
791ba58
fix(mca): Resolved errors
Sarthak1799 Jul 11, 2024
f41a4c4
Merge branch 'main' of github.com:juspay/hyperswitch into mca-merchan…
Sarthak1799 Jul 11, 2024
1adb8d2
fix(mca): Resolved errors
Sarthak1799 Jul 11, 2024
72dc3f9
Merge branch 'main' into mca-merchant-recipient
Sarthak1799 Jul 11, 2024
cc1fba3
fix(mca): Fixed errors
Sarthak1799 Jul 11, 2024
a2de372
Merge branch 'mca-merchant-recipient' of github.com:juspay/hyperswitc…
Sarthak1799 Jul 12, 2024
3dbcafa
fix(core): Fixed errors
Sarthak1799 Jul 12, 2024
9c57b92
fix(core): Fixed errrors
Sarthak1799 Jul 12, 2024
b0d071e
fix(core): Fixed errors
Sarthak1799 Jul 13, 2024
31df9f6
fix(core): Fixed errors
Sarthak1799 Jul 15, 2024
5d7d3ff
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] Jul 15, 2024
6d50f73
fix(mca): Fixed some errors
Sarthak1799 Jul 15, 2024
5fda453
Merge branch 'mca-merchant-recipient' of github.com:juspay/hyperswitc…
Sarthak1799 Jul 15, 2024
dfe2884
fix(core): Fixed errors
Sarthak1799 Jul 15, 2024
242fa34
fix(core): Fixed errors
Sarthak1799 Jul 15, 2024
9e28857
fix(core): Fixed conn_transaction_id error
Sarthak1799 Jul 15, 2024
a3f7308
Merge branch 'main' into open-banking-payments-core
Sarthak1799 Jul 16, 2024
b070d80
fix(core): Resolved comments
Sarthak1799 Jul 16, 2024
c159814
fix(core): Resolved comments
Sarthak1799 Jul 16, 2024
c165f13
chore: run formatter
hyperswitch-bot[bot] Jul 16, 2024
18fd925
fix(core): Resolved comments
Sarthak1799 Jul 16, 2024
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
77 changes: 75 additions & 2 deletions api-reference/openapi_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -12704,6 +12704,33 @@
},
"additionalProperties": false
},
"OpenBankingData": {
"oneOf": [
{
"type": "object",
"required": [
"open_banking_pis"
],
"properties": {
"open_banking_pis": {
"type": "object"
}
}
}
]
},
"OpenBankingSessionToken": {
"type": "object",
"required": [
"open_banking_session_token"
],
"properties": {
"open_banking_session_token": {
"type": "string",
"description": "The session token for OpenBanking Connectors"
}
}
},
"OrderDetails": {
"type": "object",
"required": [
Expand Down Expand Up @@ -13727,7 +13754,8 @@
"real_time_payment",
"upi",
"voucher",
"gift_card"
"gift_card",
"open_banking"
]
},
"PaymentMethodCollectLinkRequest": {
Expand Down Expand Up @@ -14122,6 +14150,18 @@
"$ref": "#/components/schemas/CardToken"
}
}
},
{
"type": "object",
"title": "OpenBanking",
"required": [
"open_banking"
],
"properties": {
"open_banking": {
"$ref": "#/components/schemas/OpenBankingData"
}
}
}
]
},
Expand Down Expand Up @@ -14328,6 +14368,17 @@
"type": "object"
}
}
},
{
"type": "object",
"required": [
"open_banking"
],
"properties": {
"open_banking": {
"type": "object"
}
}
}
]
},
Expand Down Expand Up @@ -14690,7 +14741,8 @@
"seicomart",
"pay_easy",
"local_bank_transfer",
"mifinity"
"mifinity",
"open_banking_pis"
]
},
"PaymentMethodUpdate": {
Expand Down Expand Up @@ -20161,6 +20213,27 @@
}
]
},
{
"allOf": [
{
"$ref": "#/components/schemas/OpenBankingSessionToken"
},
{
"type": "object",
"required": [
"wallet_name"
],
"properties": {
"wallet_name": {
"type": "string",
"enum": [
"open_banking"
]
}
}
}
]
},
{
"type": "object",
"required": [
Expand Down
32 changes: 32 additions & 0 deletions crates/api_models/src/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1600,6 +1600,7 @@ mod payment_method_data_serde {
| PaymentMethodData::Voucher(_)
| PaymentMethodData::Card(_)
| PaymentMethodData::MandatePayment
| PaymentMethodData::OpenBanking(_)
| PaymentMethodData::Wallet(_) => {
payment_method_data_request.serialize(serializer)
}
Expand Down Expand Up @@ -1657,6 +1658,8 @@ pub enum PaymentMethodData {
GiftCard(Box<GiftCardData>),
#[schema(title = "CardToken")]
CardToken(CardToken),
#[schema(title = "OpenBanking")]
OpenBanking(OpenBankingData),
}

pub trait GetAddressFromPaymentMethodData {
Expand All @@ -1680,6 +1683,7 @@ impl GetAddressFromPaymentMethodData for PaymentMethodData {
| Self::Upi(_)
| Self::GiftCard(_)
| Self::CardToken(_)
| Self::OpenBanking(_)
| Self::MandatePayment => None,
}
}
Expand Down Expand Up @@ -1717,6 +1721,7 @@ impl PaymentMethodData {
Self::Upi(_) => Some(api_enums::PaymentMethod::Upi),
Self::Voucher(_) => Some(api_enums::PaymentMethod::Voucher),
Self::GiftCard(_) => Some(api_enums::PaymentMethod::GiftCard),
Self::OpenBanking(_) => Some(api_enums::PaymentMethod::OpenBanking),
Self::CardToken(_) | Self::MandatePayment => None,
}
}
Expand Down Expand Up @@ -1785,6 +1790,14 @@ impl GetPaymentMethodType for PayLaterData {
}
}

impl GetPaymentMethodType for OpenBankingData {
fn get_payment_method_type(&self) -> api_enums::PaymentMethodType {
match self {
Self::OpenBankingPIS {} => api_enums::PaymentMethodType::OpenBankingPIS,
}
}
}

impl GetPaymentMethodType for BankRedirectData {
fn get_payment_method_type(&self) -> api_enums::PaymentMethodType {
match self {
Expand Down Expand Up @@ -1983,6 +1996,7 @@ pub enum AdditionalPaymentData {
Voucher {},
CardRedirect {},
CardToken {},
OpenBanking {},
}

#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
Expand Down Expand Up @@ -2673,6 +2687,12 @@ pub struct SamsungPayWalletData {
pub token: Secret<String>,
}

#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum OpenBankingData {
#[serde(rename = "open_banking_pis")]
OpenBankingPIS {},
}
#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub struct GooglePayWalletData {
Expand Down Expand Up @@ -2946,6 +2966,7 @@ where
| PaymentMethodDataResponse::Upi {}
| PaymentMethodDataResponse::Wallet {}
| PaymentMethodDataResponse::BankTransfer {}
| PaymentMethodDataResponse::OpenBanking {}
| PaymentMethodDataResponse::Voucher {} => {
payment_method_data_response.serialize(serializer)
}
Expand Down Expand Up @@ -2979,6 +3000,7 @@ pub enum PaymentMethodDataResponse {
GiftCard {},
CardRedirect {},
CardToken {},
OpenBanking {},
}

#[derive(Eq, PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize, ToSchema)]
Expand Down Expand Up @@ -4146,6 +4168,7 @@ impl From<AdditionalPaymentData> for PaymentMethodDataResponse {
AdditionalPaymentData::GiftCard {} => Self::GiftCard {},
AdditionalPaymentData::CardRedirect {} => Self::CardRedirect {},
AdditionalPaymentData::CardToken {} => Self::CardToken {},
AdditionalPaymentData::OpenBanking {} => Self::OpenBanking {},
}
}
}
Expand Down Expand Up @@ -4531,6 +4554,8 @@ pub enum SessionToken {
Paypal(Box<PaypalSessionTokenResponse>),
/// The session response structure for Apple Pay
ApplePay(Box<ApplepaySessionTokenResponse>),
/// Session token for OpenBanking PIS flow
OpenBanking(OpenBankingSessionToken),
/// Whenever there is no session token response or an error in session response
NoSessionTokenReceived,
}
Expand Down Expand Up @@ -4607,6 +4632,13 @@ pub struct PaypalSessionTokenResponse {
pub sdk_next_action: SdkNextAction,
}

#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, ToSchema)]
#[serde(rename_all = "lowercase")]
pub struct OpenBankingSessionToken {
/// The session token for OpenBanking Connectors
pub open_banking_session_token: String,
}

#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, ToSchema)]
#[serde(rename_all = "lowercase")]
pub struct ApplepaySessionTokenResponse {
Expand Down
3 changes: 3 additions & 0 deletions crates/common_enums/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1569,6 +1569,8 @@ pub enum PaymentMethodType {
PayEasy,
LocalBankTransfer,
Mifinity,
#[serde(rename = "open_banking_pis")]
OpenBankingPIS,
}

/// Indicates the type of payment method. Eg: 'card', 'wallet', etc.
Expand Down Expand Up @@ -1606,6 +1608,7 @@ pub enum PaymentMethod {
Upi,
Voucher,
GiftCard,
OpenBanking,
}

/// The type of the payment that differentiates between normal and various types of mandate payments. Use 'setup_mandate' in case of zero auth flow.
Expand Down
1 change: 1 addition & 0 deletions crates/common_enums/src/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1882,6 +1882,7 @@ impl From<PaymentMethodType> for PaymentMethod {
PaymentMethodType::FamilyMart => Self::Voucher,
PaymentMethodType::Seicomart => Self::Voucher,
PaymentMethodType::PayEasy => Self::Voucher,
PaymentMethodType::OpenBankingPIS => Self::OpenBanking,
}
}
}
Expand Down
13 changes: 13 additions & 0 deletions crates/connector_configs/src/response_modifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ impl ConnectorApiIntegrationPayload {
let mut voucher_details: Vec<Provider> = Vec::new();
let mut gift_card_details: Vec<Provider> = Vec::new();
let mut card_redirect_details: Vec<Provider> = Vec::new();
let mut open_banking_details: Vec<Provider> = Vec::new();

if let Some(payment_methods_enabled) = response.payment_methods_enabled.clone() {
for methods in payment_methods_enabled {
Expand Down Expand Up @@ -160,6 +161,18 @@ impl ConnectorApiIntegrationPayload {
}
}
}
api_models::enums::PaymentMethod::OpenBanking => {
if let Some(payment_method_types) = methods.payment_method_types {
for method_type in payment_method_types {
open_banking_details.push(Provider {
payment_method_type: method_type.payment_method_type,
accepted_currencies: method_type.accepted_currencies.clone(),
accepted_countries: method_type.accepted_countries.clone(),
payment_experience: method_type.payment_experience,
})
}
}
}
api_models::enums::PaymentMethod::Upi => {
if let Some(payment_method_types) = methods.payment_method_types {
for method_type in payment_method_types {
Expand Down
1 change: 1 addition & 0 deletions crates/connector_configs/src/transformer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ impl DashboardRequestPayload {
| PaymentMethod::Upi
| PaymentMethod::Voucher
| PaymentMethod::GiftCard
| PaymentMethod::OpenBanking
| PaymentMethod::CardRedirect => {
if let Some(provider) = payload.provider {
let val = Self::transform_payment_method(
Expand Down
1 change: 1 addition & 0 deletions crates/euclid/src/dssa/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ impl cgraph::NodeViz for dir::DirValue {
Self::SetupFutureUsage(sfu) => sfu.to_string(),
Self::CardRedirectType(crt) => crt.to_string(),
Self::RealTimePaymentType(rtpt) => rtpt.to_string(),
Self::OpenBankingType(ob) => ob.to_string(),
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions crates/euclid/src/frontend/ast/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ fn lower_comparison_inner<O: EuclidDirFilter>(

dir::DirKeyKind::UpiType => lower_enum!(UpiType, value),

dir::DirKeyKind::OpenBankingType => lower_enum!(OpenBankingType, value),

dir::DirKeyKind::VoucherType => lower_enum!(VoucherType, value),

dir::DirKeyKind::GiftCardType => lower_enum!(GiftCardType, value),
Expand Down
17 changes: 17 additions & 0 deletions crates/euclid/src/frontend/dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,13 @@ pub enum DirKeyKind {
props(Category = "Payment Method Types")
)]
RealTimePaymentType,
#[serde(rename = "open_banking")]
#[strum(
serialize = "open_banking",
detailed_message = "Supported types of open banking payment method",
props(Category = "Payment Method Types")
)]
OpenBankingType,
}

pub trait EuclidDirFilter: Sized
Expand Down Expand Up @@ -367,6 +374,7 @@ impl DirKeyKind {
Self::SetupFutureUsage => types::DataType::EnumVariant,
Self::CardRedirectType => types::DataType::EnumVariant,
Self::RealTimePaymentType => types::DataType::EnumVariant,
Self::OpenBankingType => types::DataType::EnumVariant,
}
}
pub fn get_value_set(&self) -> Option<Vec<DirValue>> {
Expand Down Expand Up @@ -498,6 +506,11 @@ impl DirKeyKind {
.map(DirValue::RealTimePaymentType)
.collect(),
),
Self::OpenBankingType => Some(
enums::OpenBankingType::iter()
.map(DirValue::OpenBankingType)
.collect(),
),
}
}
}
Expand Down Expand Up @@ -565,6 +578,8 @@ pub enum DirValue {
CardRedirectType(enums::CardRedirectType),
#[serde(rename = "real_time_payment")]
RealTimePaymentType(enums::RealTimePaymentType),
#[serde(rename = "open_banking")]
OpenBankingType(enums::OpenBankingType),
}

impl DirValue {
Expand Down Expand Up @@ -599,6 +614,7 @@ impl DirValue {
Self::VoucherType(_) => (DirKeyKind::VoucherType, None),
Self::GiftCardType(_) => (DirKeyKind::GiftCardType, None),
Self::RealTimePaymentType(_) => (DirKeyKind::RealTimePaymentType, None),
Self::OpenBankingType(_) => (DirKeyKind::OpenBankingType, None),
};

DirKey::new(kind, data)
Expand Down Expand Up @@ -634,6 +650,7 @@ impl DirValue {
Self::SetupFutureUsage(_) => None,
Self::CardRedirectType(_) => None,
Self::RealTimePaymentType(_) => None,
Self::OpenBankingType(_) => None,
}
}

Expand Down
Loading
Loading