Skip to content

Commit

Permalink
feat(connector): [ProphetPay] Implement Card Redirect PaymentMethodTy…
Browse files Browse the repository at this point in the history
…pe and flows for Authorize, CompleteAuthorize, Psync, Refund, Rsync and Void (#2641)

Co-authored-by: Arjun Karthik <[email protected]>
  • Loading branch information
Sakilmostak and ArjunKarthik authored Nov 16, 2023
1 parent e8de3a7 commit 8d4adc5
Show file tree
Hide file tree
Showing 29 changed files with 722 additions and 151 deletions.
3 changes: 3 additions & 0 deletions config/config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,9 @@ ach = { currency = "USD" }
[pm_filters.stripe]
cashapp = {country = "US", currency = "USD"}

[pm_filters.prophetpay]
card_redirect = { currency = "USD" }

[connector_customer]
connector_list = "gocardless,stax,stripe"
payout_connector_list = "wise"
Expand Down
3 changes: 3 additions & 0 deletions config/development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,9 @@ credit = { currency = "USD" }
debit = { currency = "USD" }
ach = { currency = "USD" }

[pm_filters.prophetpay]
card_redirect = { currency = "USD" }

[pm_filters.trustpay]
credit = { not_available_flows = { capture_method = "manual" } }
debit = { not_available_flows = { capture_method = "manual" } }
Expand Down
3 changes: 3 additions & 0 deletions config/docker_compose.toml
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@ red_pagos = { country = "UY", currency = "UYU" }
[pm_filters.stripe]
cashapp = {country = "US", currency = "USD"}

[pm_filters.prophetpay]
card_redirect = { currency = "USD" }

[pm_filters.stax]
credit = { currency = "USD" }
debit = { currency = "USD" }
Expand Down
4 changes: 2 additions & 2 deletions crates/api_models/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pub enum Connector {
Paypal,
Payu,
Powertranz,
// Prophetpay, added as a template code for future usage
Prophetpay,
Rapyd,
Shift4,
Square,
Expand Down Expand Up @@ -229,7 +229,7 @@ pub enum RoutableConnectors {
Paypal,
Payu,
Powertranz,
// Prophetpay, added as a template code for future usage
Prophetpay,
Rapyd,
Shift4,
Square,
Expand Down
2 changes: 2 additions & 0 deletions crates/api_models/src/payments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,7 @@ pub enum CardRedirectData {
Knet {},
Benefit {},
MomoAtm {},
CardRedirect {},
}

#[derive(Eq, PartialEq, Clone, Debug, serde::Deserialize, serde::Serialize, ToSchema)]
Expand Down Expand Up @@ -868,6 +869,7 @@ impl GetPaymentMethodType for CardRedirectData {
Self::Knet {} => api_enums::PaymentMethodType::Knet,
Self::Benefit {} => api_enums::PaymentMethodType::Benefit,
Self::MomoAtm {} => api_enums::PaymentMethodType::MomoAtm,
Self::CardRedirect {} => api_enums::PaymentMethodType::CardRedirect,
}
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/api_models/src/routing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ impl From<RoutableConnectorChoice> for ast::ConnectorChoice {
RoutableConnectors::Paypal => euclid_enums::Connector::Paypal,
RoutableConnectors::Payu => euclid_enums::Connector::Payu,
RoutableConnectors::Powertranz => euclid_enums::Connector::Powertranz,
RoutableConnectors::Prophetpay => euclid_enums::Connector::Prophetpay,
RoutableConnectors::Rapyd => euclid_enums::Connector::Rapyd,
RoutableConnectors::Shift4 => euclid_enums::Connector::Shift4,
RoutableConnectors::Square => euclid_enums::Connector::Square,
Expand Down
1 change: 1 addition & 0 deletions crates/common_enums/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,7 @@ pub enum PaymentMethodType {
BcaBankTransfer,
BniVa,
BriVa,
CardRedirect,
CimbVa,
#[serde(rename = "classic")]
ClassicReward,
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 @@ -1807,6 +1807,7 @@ impl From<PaymentMethodType> for PaymentMethod {
PaymentMethodType::Bizum => Self::BankRedirect,
PaymentMethodType::Blik => Self::BankRedirect,
PaymentMethodType::Alfamart => Self::Voucher,
PaymentMethodType::CardRedirect => Self::CardRedirect,
PaymentMethodType::CimbVa => Self::BankTransfer,
PaymentMethodType::ClassicReward => Self::Reward,
PaymentMethodType::Credit => Self::Card,
Expand Down
6 changes: 6 additions & 0 deletions crates/common_utils/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,9 @@ pub const DEFAULT_PRODUCT_IMG: &str = "https://i.imgur.com/On3VtKF.png";

/// Default Merchant Logo Link
pub const DEFAULT_MERCHANT_LOGO: &str = "https://i.imgur.com/RfxPFQo.png";

/// Redirect url for Prophetpay
pub const PROPHETPAY_REDIRECT_URL: &str = "https://ccm-thirdparty.cps.golf/hp/tokenize/";

/// Variable which store the card token for Prophetpay
pub const PROPHETPAY_TOKEN: &str = "cctoken";
1 change: 1 addition & 0 deletions crates/euclid/src/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ pub enum Connector {
Paypal,
Payu,
Powertranz,
Prophetpay,
Rapyd,
Shift4,
Square,
Expand Down
1 change: 1 addition & 0 deletions crates/euclid/src/frontend/dir/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ pub enum CardRedirectType {
Benefit,
Knet,
MomoAtm,
CardRedirect,
}

#[derive(
Expand Down
1 change: 1 addition & 0 deletions crates/euclid/src/frontend/dir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ impl From<enums::CardRedirectType> for global_enums::PaymentMethodType {
enums::CardRedirectType::Benefit => Self::Benefit,
enums::CardRedirectType::Knet => Self::Knet,
enums::CardRedirectType::MomoAtm => Self::MomoAtm,
enums::CardRedirectType::CardRedirect => Self::CardRedirect,
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions crates/euclid/src/frontend/dir/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ impl IntoDirValue for (global_enums::PaymentMethodType, global_enums::PaymentMet
}
global_enums::PaymentMethodType::MomoAtm => Ok(dirval!(CardRedirectType = MomoAtm)),
global_enums::PaymentMethodType::Oxxo => Ok(dirval!(VoucherType = Oxxo)),
global_enums::PaymentMethodType::CardRedirect => {
Ok(dirval!(CardRedirectType = CardRedirect))
}
}
}
}
3 changes: 3 additions & 0 deletions crates/kgraph_utils/src/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ impl IntoDirValue for (api_enums::PaymentMethodType, api_enums::PaymentMethod) {
}
api_enums::PaymentMethodType::MomoAtm => Ok(dirval!(CardRedirectType = MomoAtm)),
api_enums::PaymentMethodType::Oxxo => Ok(dirval!(VoucherType = Oxxo)),
api_enums::PaymentMethodType::CardRedirect => {
Ok(dirval!(CardRedirectType = CardRedirect))
}
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions crates/router/src/connector/adyen/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2201,6 +2201,12 @@ impl<'a> TryFrom<&api_models::payments::CardRedirectData> for AdyenPaymentMethod
payments::CardRedirectData::Knet {} => Ok(AdyenPaymentMethod::Knet),
payments::CardRedirectData::Benefit {} => Ok(AdyenPaymentMethod::Benefit),
payments::CardRedirectData::MomoAtm {} => Ok(AdyenPaymentMethod::MomoAtm),
payments::CardRedirectData::CardRedirect {} => {
Err(errors::ConnectorError::NotImplemented(
utils::get_unimplemented_payment_method_error_message("Adyen"),
)
.into())
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/router/src/connector/klarna.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ impl
| api_models::enums::PaymentMethodType::BcaBankTransfer
| api_models::enums::PaymentMethodType::BniVa
| api_models::enums::PaymentMethodType::BriVa
| api_models::enums::PaymentMethodType::CardRedirect
| api_models::enums::PaymentMethodType::CimbVa
| api_models::enums::PaymentMethodType::ClassicReward
| api_models::enums::PaymentMethodType::Credit
Expand Down
3 changes: 2 additions & 1 deletion crates/router/src/connector/paypal/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@ impl TryFrom<&api_models::payments::CardRedirectData> for PaypalPaymentsRequest
match value {
api_models::payments::CardRedirectData::Knet {}
| api_models::payments::CardRedirectData::Benefit {}
| api_models::payments::CardRedirectData::MomoAtm {} => {
| api_models::payments::CardRedirectData::MomoAtm {}
| api_models::payments::CardRedirectData::CardRedirect {} => {
Err(errors::ConnectorError::NotSupported {
message: utils::SELECTED_PAYMENT_METHOD.to_string(),
connector: "Paypal",
Expand Down
Loading

0 comments on commit 8d4adc5

Please sign in to comment.