feat(connector): [Adyen] implement Japanese convenience stores (#1819)

Co-authored-by: Sk Sakil Mostak <skmahim71@gmail.com>
Co-authored-by: Pa1NarK <69745008+pixincreate@users.noreply.github.com>
This commit is contained in:
AkshayaFoiger
2023-08-09 21:21:45 +05:30
committed by GitHub
parent c1e56266df
commit a6fdf6dc34
14 changed files with 277 additions and 8 deletions

View File

@ -356,6 +356,12 @@ indomaret = {country = "ID", currency = "IDR"}
open_banking_uk = {country = "GB", currency = "GBP"}
oxxo = {country = "MX", currency = "MXN"}
pay_safe_card = {country = "AT,AU,BE,BR,BE,CA,HR,CY,CZ,DK,FI,FR,GE,DE,GI,HU,IS,IE,KW,LV,IE,LI,LT,LU,MT,MX,MD,ME,NL,NZ,NO,PY,PE,PL,PT,RO,SA,RS,SK,SI,ES,SE,CH,TR,UAE,UK,US,UY", currency = "EUR,AUD,BRL,CAD,CZK,DKK,GEL,GIP,HUF,ISK,KWD,CHF,MXN,MDL,NZD,NOK,PYG,PEN,PLN,RON,SAR,RSD,SEK,TRY,AED,GBP,USD,UYU"}
seven_eleven = {country = "JP", currency = "JPY"}
lawson = {country = "JP", currency = "JPY"}
mini_stop = {country = "JP", currency = "JPY"}
family_mart = {country = "JP", currency = "JPY"}
seicomart = {country = "JP", currency = "JPY"}
pay_easy = {country = "JP", currency = "JPY"}
[pm_filters.zen]
credit = { not_available_flows = { capture_method = "manual" } }

View File

@ -287,6 +287,12 @@ indomaret = {country = "ID", currency = "IDR"}
open_banking_uk = {country = "GB", currency = "GBP"}
oxxo = {country = "MX", currency = "MXN"}
pay_safe_card = {country = "AT,AU,BE,BR,BE,CA,HR,CY,CZ,DK,FI,FR,GE,DE,GI,HU,IS,IE,KW,LV,IE,LI,LT,LU,MT,MX,MD,ME,NL,NZ,NO,PY,PE,PL,PT,RO,SA,RS,SK,SI,ES,SE,CH,TR,UAE,UK,US,UY", currency = "EUR,AUD,BRL,CAD,CZK,DKK,GEL,GIP,HUF,ISK,KWD,CHF,MXN,MDL,NZD,NOK,PYG,PEN,PLN,RON,SAR,RSD,SEK,TRY,AED,GBP,USD,UYU"}
seven_eleven = {country = "JP", currency = "JPY"}
lawson = {country = "JP", currency = "JPY"}
mini_stop = {country = "JP", currency = "JPY"}
family_mart = {country = "JP", currency = "JPY"}
seicomart = {country = "JP", currency = "JPY"}
pay_easy = {country = "JP", currency = "JPY"}
[pm_filters.braintree]
paypal = { currency = "AUD,BRL,CAD,CNY,CZK,DKK,EUR,HKD,HUF,ILS,JPY,MYR,MXN,TWD,NZD,NOK,PHP,PLN,GBP,RUB,SGD,SEK,CHF,THB,USD" }

View File

@ -235,6 +235,12 @@ indomaret = {country = "ID", currency = "IDR"}
open_banking_uk = {country = "GB", currency = "GBP"}
oxxo = {country = "MX", currency = "MXN"}
pay_safe_card = {country = "AT,AU,BE,BR,BE,CA,HR,CY,CZ,DK,FI,FR,GE,DE,GI,HU,IS,IE,KW,LV,IE,LI,LT,LU,MT,MX,MD,ME,NL,NZ,NO,PY,PE,PL,PT,RO,SA,RS,SK,SI,ES,SE,CH,TR,UAE,UK,US,UY", currency = "EUR,AUD,BRL,CAD,CZK,DKK,GEL,GIP,HUF,ISK,KWD,CHF,MXN,MDL,NZD,NOK,PYG,PEN,PLN,RON,SAR,RSD,SEK,TRY,AED,GBP,USD,UYU"}
seven_eleven = {country = "JP", currency = "JPY"}
lawson = {country = "JP", currency = "JPY"}
mini_stop = {country = "JP", currency = "JPY"}
family_mart = {country = "JP", currency = "JPY"}
seicomart = {country = "JP", currency = "JPY"}
pay_easy = {country = "JP", currency = "JPY"}
[pm_filters.zen]
credit = { not_available_flows = { capture_method = "manual" } }

View File

@ -962,6 +962,22 @@ pub struct IndomaretVoucherData {
pub email: Email,
}
#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct JCSVoucherData {
/// The billing first name for Japanese convenience stores
#[schema(value_type = String, example = "Jane")]
pub first_name: Secret<String>,
/// The billing second name Japanese convenience stores
#[schema(value_type = String, example = "Doe")]
pub last_name: Option<Secret<String>>,
/// The Email ID for Japanese convenience stores
#[schema(value_type = String, example = "example@me.com")]
pub email: Email,
/// The telephone number for Japanese convenience stores
#[schema(value_type = String, example = "9999999999")]
pub phone_number: String,
}
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct AchBillingDetails {
/// The Email ID for ACH billing
@ -1320,6 +1336,12 @@ pub enum VoucherData {
Alfamart(Box<AlfamartVoucherData>),
Indomaret(Box<IndomaretVoucherData>),
Oxxo,
SevenEleven(Box<JCSVoucherData>),
Lawson(Box<JCSVoucherData>),
MiniStop(Box<JCSVoucherData>),
FamilyMart(Box<JCSVoucherData>),
Seicomart(Box<JCSVoucherData>),
PayEasy(Box<JCSVoucherData>),
}
#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
@ -1525,6 +1547,8 @@ pub struct VoucherNextStepData {
pub reference: String,
/// Url to download the payment instruction
pub download_url: Option<Url>,
/// Url to payment instruction page
pub instructions_url: Option<Url>,
}
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]

View File

@ -975,6 +975,12 @@ pub enum PaymentMethodType {
Vipps,
Walley,
WeChatPay,
SevenEleven,
Lawson,
MiniStop,
FamilyMart,
Seicomart,
PayEasy,
}
#[derive(

View File

@ -1611,6 +1611,12 @@ impl From<PaymentMethodType> for PaymentMethod {
PaymentMethodType::Givex => Self::GiftCard,
PaymentMethodType::Oxxo => Self::Voucher,
PaymentMethodType::OpenBankingUk => Self::BankRedirect,
PaymentMethodType::SevenEleven => Self::Voucher,
PaymentMethodType::Lawson => Self::Voucher,
PaymentMethodType::MiniStop => Self::Voucher,
PaymentMethodType::FamilyMart => Self::Voucher,
PaymentMethodType::Seicomart => Self::Voucher,
PaymentMethodType::PayEasy => Self::Voucher,
}
}
}

View File

@ -1351,7 +1351,6 @@ impl api::IncomingWebhook for Adyen {
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?;
let base64_signature = notif_item.additional_data.hmac_signature;
Ok(base64_signature.as_bytes().to_vec())
}

View File

@ -471,6 +471,27 @@ pub enum AdyenPaymentMethod<'a> {
Benefit,
#[serde(rename = "knet")]
Knet,
#[serde(rename = "econtext_seven_eleven")]
SevenEleven(Box<JCSVoucherData>),
#[serde(rename = "econtext_stores")]
Lawson(Box<JCSVoucherData>),
#[serde(rename = "econtext_stores")]
MiniStop(Box<JCSVoucherData>),
#[serde(rename = "econtext_stores")]
FamilyMart(Box<JCSVoucherData>),
#[serde(rename = "econtext_stores")]
Seicomart(Box<JCSVoucherData>),
#[serde(rename = "econtext_stores")]
PayEasy(Box<JCSVoucherData>),
}
#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct JCSVoucherData {
first_name: Secret<String>,
last_name: Option<Secret<String>>,
shopper_email: Email,
telephone_number: String,
}
#[derive(Debug, Clone, Serialize)]
@ -594,6 +615,18 @@ pub enum OnlineBankingCzechRepublicBanks {
C,
}
impl TryFrom<&Box<payments::JCSVoucherData>> for JCSVoucherData {
type Error = Error;
fn try_from(jcs_data: &Box<payments::JCSVoucherData>) -> Result<Self, Self::Error> {
Ok(Self {
first_name: jcs_data.first_name.clone(),
last_name: jcs_data.last_name.clone(),
shopper_email: jcs_data.email.clone(),
telephone_number: jcs_data.phone_number.clone(),
})
}
}
impl TryFrom<&api_enums::BankNames> for OnlineBankingCzechRepublicBanks {
type Error = Error;
fn try_from(bank_name: &api_enums::BankNames) -> Result<Self, Self::Error> {
@ -1082,6 +1115,18 @@ pub enum PaymentType {
DanamonVa,
#[serde(rename = "doku_mandiri_va")]
MandiriVa,
#[serde(rename = "econtext_seven_eleven")]
SevenEleven,
#[serde(rename = "econtext_stores")]
Lawson,
#[serde(rename = "econtext_stores")]
MiniStop,
#[serde(rename = "econtext_stores")]
FamilyMart,
#[serde(rename = "econtext_stores")]
Seicomart,
#[serde(rename = "econtext_stores")]
PayEasy,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@ -1531,7 +1576,13 @@ fn get_social_security_number(
| payments::VoucherData::PagoEfectivo
| payments::VoucherData::RedCompra
| payments::VoucherData::Oxxo
| payments::VoucherData::RedPagos => None,
| payments::VoucherData::RedPagos
| payments::VoucherData::SevenEleven { .. }
| payments::VoucherData::Lawson { .. }
| payments::VoucherData::MiniStop { .. }
| payments::VoucherData::FamilyMart { .. }
| payments::VoucherData::Seicomart { .. }
| payments::VoucherData::PayEasy { .. } => None,
}
}
@ -1614,6 +1665,24 @@ impl<'a> TryFrom<&api_models::payments::VoucherData> for AdyenPaymentMethod<'a>
})))
}
payments::VoucherData::Oxxo => Ok(AdyenPaymentMethod::Oxxo),
payments::VoucherData::SevenEleven(jcs_data) => Ok(AdyenPaymentMethod::SevenEleven(
Box::new(JCSVoucherData::try_from(jcs_data)?),
)),
payments::VoucherData::Lawson(jcs_data) => Ok(AdyenPaymentMethod::Lawson(Box::new(
JCSVoucherData::try_from(jcs_data)?,
))),
payments::VoucherData::MiniStop(jcs_data) => Ok(AdyenPaymentMethod::MiniStop(
Box::new(JCSVoucherData::try_from(jcs_data)?),
)),
payments::VoucherData::FamilyMart(jcs_data) => Ok(AdyenPaymentMethod::FamilyMart(
Box::new(JCSVoucherData::try_from(jcs_data)?),
)),
payments::VoucherData::Seicomart(jcs_data) => Ok(AdyenPaymentMethod::Seicomart(
Box::new(JCSVoucherData::try_from(jcs_data)?),
)),
payments::VoucherData::PayEasy(jcs_data) => Ok(AdyenPaymentMethod::PayEasy(Box::new(
JCSVoucherData::try_from(jcs_data)?,
))),
payments::VoucherData::Efecty
| payments::VoucherData::PagoEfectivo
| payments::VoucherData::RedCompra
@ -3045,7 +3114,13 @@ pub fn get_wait_screen_metadata(
| PaymentType::DanamonVa
| PaymentType::Giftcard
| PaymentType::MandiriVa
| PaymentType::PaySafeCard => Ok(None),
| PaymentType::PaySafeCard
| PaymentType::SevenEleven
| PaymentType::Lawson
| PaymentType::MiniStop
| PaymentType::FamilyMart
| PaymentType::Seicomart
| PaymentType::PayEasy => Ok(None),
}
}
@ -3058,11 +3133,17 @@ pub fn get_present_to_shopper_metadata(
PaymentType::Alfamart
| PaymentType::Indomaret
| PaymentType::BoletoBancario
| PaymentType::Oxxo => {
| PaymentType::Oxxo
| PaymentType::Lawson
| PaymentType::MiniStop
| PaymentType::FamilyMart
| PaymentType::Seicomart
| PaymentType::PayEasy => {
let voucher_data = payments::VoucherNextStepData {
expires_at: response.action.expires_at.clone(),
reference,
download_url: response.action.download_url.clone(),
instructions_url: response.action.instructions_url.clone(),
};
Some(common_utils::ext_traits::Encode::<
@ -3141,7 +3222,8 @@ pub fn get_present_to_shopper_metadata(
| PaymentType::Twint
| PaymentType::Vipps
| PaymentType::Swish
| PaymentType::PaySafeCard => Ok(None),
| PaymentType::PaySafeCard
| PaymentType::SevenEleven => Ok(None),
}
}

View File

@ -616,6 +616,12 @@ impl TryFrom<enums::PaymentMethodType> for StripePaymentMethodType {
| enums::PaymentMethodType::Oxxo
| enums::PaymentMethodType::Benefit
| enums::PaymentMethodType::Knet
| enums::PaymentMethodType::SevenEleven
| enums::PaymentMethodType::Lawson
| enums::PaymentMethodType::MiniStop
| enums::PaymentMethodType::FamilyMart
| enums::PaymentMethodType::Seicomart
| enums::PaymentMethodType::PayEasy
| enums::PaymentMethodType::Walley => Err(errors::ConnectorError::NotImplemented(
connector_util::get_unimplemented_payment_method_error_message("stripe"),
)
@ -919,6 +925,12 @@ fn infer_stripe_pay_later_type(
| enums::PaymentMethodType::PaySafeCard
| enums::PaymentMethodType::Givex
| enums::PaymentMethodType::Oxxo
| enums::PaymentMethodType::SevenEleven
| enums::PaymentMethodType::Lawson
| enums::PaymentMethodType::MiniStop
| enums::PaymentMethodType::FamilyMart
| enums::PaymentMethodType::Seicomart
| enums::PaymentMethodType::PayEasy
| enums::PaymentMethodType::WeChatPay => Err(errors::ConnectorError::NotImplemented(
connector_util::get_unimplemented_payment_method_error_message("stripe"),
)),

View File

@ -245,9 +245,15 @@ impl
ZenPaymentChannels::PclBoacompraRedcompra
}
api_models::payments::VoucherData::RedPagos => ZenPaymentChannels::PclBoacompraRedpagos,
api_models::payments::VoucherData::Alfamart { .. }
api_models::payments::VoucherData::Oxxo { .. }
| api_models::payments::VoucherData::Alfamart { .. }
| api_models::payments::VoucherData::Indomaret { .. }
| api_models::payments::VoucherData::Oxxo { .. } => Err(
| api_models::payments::VoucherData::SevenEleven { .. }
| api_models::payments::VoucherData::Lawson { .. }
| api_models::payments::VoucherData::MiniStop { .. }
| api_models::payments::VoucherData::FamilyMart { .. }
| api_models::payments::VoucherData::Seicomart { .. }
| api_models::payments::VoucherData::PayEasy { .. } => Err(
errors::ConnectorError::NotImplemented("payment method".to_string()),
)?,
};

View File

@ -1574,6 +1574,12 @@ pub fn validate_payment_method_type_against_payment_method(
| api_enums::PaymentMethodType::Indomaret
| api_enums::PaymentMethodType::Alfamart
| api_enums::PaymentMethodType::Oxxo
| api_enums::PaymentMethodType::SevenEleven
| api_enums::PaymentMethodType::Lawson
| api_enums::PaymentMethodType::MiniStop
| api_enums::PaymentMethodType::FamilyMart
| api_enums::PaymentMethodType::Seicomart
| api_enums::PaymentMethodType::PayEasy
),
api_enums::PaymentMethod::GiftCard => {
matches!(

View File

@ -200,6 +200,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::payments::IndomaretVoucherData,
api_models::payments::Address,
api_models::payments::VoucherData,
api_models::payments::JCSVoucherData,
api_models::payments::AlfamartVoucherData,
api_models::payments::IndomaretVoucherData,
api_models::payments::BankRedirectData,

View File

@ -266,6 +266,12 @@ impl ForeignFrom<api_enums::PaymentMethodType> for api_enums::PaymentMethod {
| api_enums::PaymentMethodType::Alfamart
| api_enums::PaymentMethodType::Indomaret
| api_enums::PaymentMethodType::Oxxo
| api_enums::PaymentMethodType::SevenEleven
| api_enums::PaymentMethodType::Lawson
| api_enums::PaymentMethodType::MiniStop
| api_enums::PaymentMethodType::FamilyMart
| api_enums::PaymentMethodType::Seicomart
| api_enums::PaymentMethodType::PayEasy
| api_enums::PaymentMethodType::RedPagos => Self::Voucher,
api_enums::PaymentMethodType::Pse
| api_enums::PaymentMethodType::Multibanco

View File

@ -5533,6 +5533,37 @@
"partially_captured"
]
},
"JCSVoucherData": {
"type": "object",
"required": [
"first_name",
"last_name",
"email",
"phone_number"
],
"properties": {
"first_name": {
"type": "string",
"description": "The billing first name for Japanese convenience stores",
"example": "Jane"
},
"last_name": {
"type": "string",
"description": "The billing second name Japanese convenience stores",
"example": "Doe"
},
"email": {
"type": "string",
"description": "The Email ID for Japanese convenience stores",
"example": "example@me.com"
},
"phone_number": {
"type": "string",
"description": "The telephone number for Japanese convenience stores",
"example": "9999999999"
}
}
},
"KakaoPayRedirection": {
"type": "object"
},
@ -8002,7 +8033,13 @@
"upi_collect",
"vipps",
"walley",
"we_chat_pay"
"we_chat_pay",
"seven_eleven",
"lawson",
"mini_stop",
"family_mart",
"seicomart",
"pay_easy"
]
},
"PaymentMethodUpdate": {
@ -10635,6 +10672,72 @@
"enum": [
"oxxo"
]
},
{
"type": "object",
"required": [
"seven_eleven"
],
"properties": {
"seven_eleven": {
"$ref": "#/components/schemas/JCSVoucherData"
}
}
},
{
"type": "object",
"required": [
"lawson"
],
"properties": {
"lawson": {
"$ref": "#/components/schemas/JCSVoucherData"
}
}
},
{
"type": "object",
"required": [
"mini_stop"
],
"properties": {
"mini_stop": {
"$ref": "#/components/schemas/JCSVoucherData"
}
}
},
{
"type": "object",
"required": [
"family_mart"
],
"properties": {
"family_mart": {
"$ref": "#/components/schemas/JCSVoucherData"
}
}
},
{
"type": "object",
"required": [
"seicomart"
],
"properties": {
"seicomart": {
"$ref": "#/components/schemas/JCSVoucherData"
}
}
},
{
"type": "object",
"required": [
"pay_easy"
],
"properties": {
"pay_easy": {
"$ref": "#/components/schemas/JCSVoucherData"
}
}
}
]
},