feat(connector): [Payme] add Authorize, Sync, Capture, Refund, Refund Sync, Mandate & web hooks support for cards (#1594)

This commit is contained in:
Arjun Karthik
2023-07-07 12:40:02 +05:30
committed by GitHub
parent fc9057ef2c
commit 093cc6a71c
9 changed files with 816 additions and 277 deletions

View File

@ -205,6 +205,7 @@ pub trait PaymentsAuthorizeRequestData {
fn get_router_return_url(&self) -> Result<String, Error>;
fn is_wallet(&self) -> bool;
fn get_payment_method_type(&self) -> Result<storage_models::enums::PaymentMethodType, Error>;
fn get_connector_mandate_id(&self) -> Result<String, Error>;
}
impl PaymentsAuthorizeRequestData for types::PaymentsAuthorizeData {
@ -277,6 +278,11 @@ impl PaymentsAuthorizeRequestData for types::PaymentsAuthorizeData {
.to_owned()
.ok_or_else(missing_field_err("payment_method_type"))
}
fn get_connector_mandate_id(&self) -> Result<String, Error> {
self.connector_mandate_id()
.ok_or_else(missing_field_err("connector_mandate_id"))
}
}
pub trait BrowserInformationData {
@ -643,6 +649,7 @@ impl PhoneDetailsData for api::PhoneDetails {
pub trait AddressDetailsData {
fn get_first_name(&self) -> Result<&Secret<String>, Error>;
fn get_last_name(&self) -> Result<&Secret<String>, Error>;
fn get_full_name(&self) -> Result<Secret<String>, Error>;
fn get_line1(&self) -> Result<&Secret<String>, Error>;
fn get_city(&self) -> Result<&String, Error>;
fn get_line2(&self) -> Result<&Secret<String>, Error>;
@ -666,6 +673,13 @@ impl AddressDetailsData for api::AddressDetails {
.ok_or_else(missing_field_err("address.last_name"))
}
fn get_full_name(&self) -> Result<Secret<String>, Error> {
let first_name = self.get_first_name()?.peek().to_owned();
let last_name = self.get_last_name()?.peek().to_owned();
let full_name = format!("{} {}", first_name, last_name).trim().to_string();
Ok(Secret::new(full_name))
}
fn get_line1(&self) -> Result<&Secret<String>, Error> {
self.line1
.as_ref()