mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 17:19:15 +08:00
fix: TODO's and FIXME's in connectors (#183)
This commit is contained in:
@ -72,7 +72,7 @@ impl
|
|||||||
types::PaymentsResponseData,
|
types::PaymentsResponseData,
|
||||||
> for Aci
|
> for Aci
|
||||||
{
|
{
|
||||||
// TODO: Critical Implement
|
// Issue: #173
|
||||||
}
|
}
|
||||||
|
|
||||||
impl
|
impl
|
||||||
@ -345,7 +345,6 @@ impl
|
|||||||
Ok(Some(
|
Ok(Some(
|
||||||
services::RequestBuilder::new()
|
services::RequestBuilder::new()
|
||||||
.method(services::Method::Post)
|
.method(services::Method::Post)
|
||||||
// TODO: [ORCA-346] Requestbuilder needs &str migrate get_url to send &str instead of owned string
|
|
||||||
.url(&types::PaymentsVoidType::get_url(self, req, connectors)?)
|
.url(&types::PaymentsVoidType::get_url(self, req, connectors)?)
|
||||||
.headers(types::PaymentsVoidType::get_headers(self, req)?)
|
.headers(types::PaymentsVoidType::get_headers(self, req)?)
|
||||||
.body(types::PaymentsVoidType::get_request_body(self, req)?)
|
.body(types::PaymentsVoidType::get_request_body(self, req)?)
|
||||||
|
|||||||
@ -217,7 +217,6 @@ impl<F, T>
|
|||||||
resource_id: types::ResponseId::ConnectorTransactionId(item.response.id),
|
resource_id: types::ResponseId::ConnectorTransactionId(item.response.id),
|
||||||
redirection_data: None,
|
redirection_data: None,
|
||||||
redirect: false,
|
redirect: false,
|
||||||
// TODO: Implement mandate fetch for other connectors
|
|
||||||
mandate_reference: None,
|
mandate_reference: None,
|
||||||
}),
|
}),
|
||||||
..item.data
|
..item.data
|
||||||
|
|||||||
@ -40,7 +40,6 @@ impl api::ConnectorCommon for Adyen {
|
|||||||
Ok(vec![(headers::X_API_KEY.to_string(), auth.api_key)])
|
Ok(vec![(headers::X_API_KEY.to_string(), auth.api_key)])
|
||||||
}
|
}
|
||||||
|
|
||||||
//FIXME with enum
|
|
||||||
fn base_url(&self, connectors: settings::Connectors) -> String {
|
fn base_url(&self, connectors: settings::Connectors) -> String {
|
||||||
connectors.adyen.base_url
|
connectors.adyen.base_url
|
||||||
}
|
}
|
||||||
@ -60,7 +59,7 @@ impl
|
|||||||
types::PaymentsResponseData,
|
types::PaymentsResponseData,
|
||||||
> for Adyen
|
> for Adyen
|
||||||
{
|
{
|
||||||
// TODO: Critical implement
|
// Issue: #173
|
||||||
}
|
}
|
||||||
|
|
||||||
impl api::PaymentSession for Adyen {}
|
impl api::PaymentSession for Adyen {}
|
||||||
@ -362,7 +361,6 @@ impl
|
|||||||
Ok(Some(
|
Ok(Some(
|
||||||
services::RequestBuilder::new()
|
services::RequestBuilder::new()
|
||||||
.method(services::Method::Post)
|
.method(services::Method::Post)
|
||||||
// TODO: [ORCA-346] Requestbuilder needs &str migrate get_url to send &str instead of owned string
|
|
||||||
.url(&types::PaymentsVoidType::get_url(self, req, connectors)?)
|
.url(&types::PaymentsVoidType::get_url(self, req, connectors)?)
|
||||||
.headers(types::PaymentsVoidType::get_headers(self, req)?)
|
.headers(types::PaymentsVoidType::get_headers(self, req)?)
|
||||||
.header(headers::X_ROUTER, "test")
|
.header(headers::X_ROUTER, "test")
|
||||||
|
|||||||
@ -7,8 +7,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
use crate::{
|
use crate::{
|
||||||
consts,
|
consts,
|
||||||
core::errors,
|
core::errors,
|
||||||
pii::{self, PeekInterface},
|
pii, services,
|
||||||
services,
|
|
||||||
types::{
|
types::{
|
||||||
self,
|
self,
|
||||||
api::{self, enums as api_enums},
|
api::{self, enums as api_enums},
|
||||||
@ -153,10 +152,10 @@ pub enum AdyenPaymentMethod {
|
|||||||
pub struct AdyenCard {
|
pub struct AdyenCard {
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
payment_type: String,
|
payment_type: String,
|
||||||
number: Option<pii::Secret<String>>,
|
number: Option<pii::Secret<String, pii::CardNumber>>,
|
||||||
expiry_month: Option<pii::Secret<String>>,
|
expiry_month: Option<pii::Secret<String>>,
|
||||||
expiry_year: Option<pii::Secret<String>>,
|
expiry_year: Option<pii::Secret<String>>,
|
||||||
cvc: Option<String>,
|
cvc: Option<pii::Secret<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Debug, Serialize, Deserialize)]
|
#[derive(Default, Debug, Serialize, Deserialize)]
|
||||||
@ -301,12 +300,10 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for AdyenPaymentRequest {
|
|||||||
storage_enums::PaymentMethodType::Card => {
|
storage_enums::PaymentMethodType::Card => {
|
||||||
let card = AdyenCard {
|
let card = AdyenCard {
|
||||||
payment_type,
|
payment_type,
|
||||||
number: ccard.map(|x| x.card_number.peek().clone().into()), // FIXME: xxx: should also be secret?
|
number: ccard.map(|x| x.card_number.clone()),
|
||||||
expiry_month: ccard.map(|x| x.card_exp_month.peek().clone().into()),
|
expiry_month: ccard.map(|x| x.card_exp_month.clone()),
|
||||||
expiry_year: ccard.map(|x| x.card_exp_year.peek().clone().into()),
|
expiry_year: ccard.map(|x| x.card_exp_year.clone()),
|
||||||
// TODO: CVV/CVC shouldn't be saved in our db
|
cvc: ccard.map(|x| x.card_cvc.clone()),
|
||||||
// Will need to implement tokenization that allows us to make payments without cvv
|
|
||||||
cvc: ccard.map(|x| x.card_cvc.peek().into()),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(AdyenPaymentMethod::AdyenCard(card))
|
Ok(AdyenPaymentMethod::AdyenCard(card))
|
||||||
@ -413,7 +410,6 @@ impl TryFrom<types::PaymentsCancelResponseRouterData<AdyenCancelResponse>>
|
|||||||
resource_id: types::ResponseId::ConnectorTransactionId(item.response.psp_reference),
|
resource_id: types::ResponseId::ConnectorTransactionId(item.response.psp_reference),
|
||||||
redirection_data: None,
|
redirection_data: None,
|
||||||
redirect: false,
|
redirect: false,
|
||||||
// TODO: Implement mandate fetch for other connectors
|
|
||||||
mandate_reference: None,
|
mandate_reference: None,
|
||||||
}),
|
}),
|
||||||
..item.data
|
..item.data
|
||||||
@ -455,7 +451,6 @@ pub fn get_adyen_response(
|
|||||||
resource_id: types::ResponseId::ConnectorTransactionId(response.psp_reference),
|
resource_id: types::ResponseId::ConnectorTransactionId(response.psp_reference),
|
||||||
redirection_data: None,
|
redirection_data: None,
|
||||||
redirect: false,
|
redirect: false,
|
||||||
// TODO: Implement mandate fetch for other connectors
|
|
||||||
mandate_reference: None,
|
mandate_reference: None,
|
||||||
};
|
};
|
||||||
Ok((status, error, payments_response_data))
|
Ok((status, error, payments_response_data))
|
||||||
@ -521,7 +516,6 @@ pub fn get_redirection_response(
|
|||||||
resource_id: types::ResponseId::NoResponseId,
|
resource_id: types::ResponseId::NoResponseId,
|
||||||
redirection_data: Some(redirection_data),
|
redirection_data: Some(redirection_data),
|
||||||
redirect: true,
|
redirect: true,
|
||||||
// TODO: Implement mandate fetch for other connectors
|
|
||||||
mandate_reference: None,
|
mandate_reference: None,
|
||||||
};
|
};
|
||||||
Ok((status, error, payments_response_data))
|
Ok((status, error, payments_response_data))
|
||||||
|
|||||||
@ -128,7 +128,6 @@ impl
|
|||||||
) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
|
) -> CustomResult<Option<services::Request>, errors::ConnectorError> {
|
||||||
let request = services::RequestBuilder::new()
|
let request = services::RequestBuilder::new()
|
||||||
.method(services::Method::Post)
|
.method(services::Method::Post)
|
||||||
// TODO: [ORCA-346] Requestbuilder needs &str migrate get_url to send &str instead of owned string
|
|
||||||
.url(&types::PaymentsSessionType::get_url(self, req, connectors)?)
|
.url(&types::PaymentsSessionType::get_url(self, req, connectors)?)
|
||||||
.headers(types::PaymentsSessionType::get_headers(self, req)?)
|
.headers(types::PaymentsSessionType::get_headers(self, req)?)
|
||||||
.body(types::PaymentsSessionType::get_request_body(self, req)?)
|
.body(types::PaymentsSessionType::get_request_body(self, req)?)
|
||||||
|
|||||||
@ -77,7 +77,6 @@ impl<F, T>
|
|||||||
item: types::ResponseRouterData<F, ApplepaySessionResponse, T, types::PaymentsResponseData>,
|
item: types::ResponseRouterData<F, ApplepaySessionResponse, T, types::PaymentsResponseData>,
|
||||||
) -> Result<Self, Self::Error> {
|
) -> Result<Self, Self::Error> {
|
||||||
Ok(types::RouterData {
|
Ok(types::RouterData {
|
||||||
//TODO : change in session response to fit apple pay session object
|
|
||||||
response: Ok(types::PaymentsResponseData::SessionResponse {
|
response: Ok(types::PaymentsResponseData::SessionResponse {
|
||||||
session_token: {
|
session_token: {
|
||||||
api_models::payments::SessionToken::Applepay {
|
api_models::payments::SessionToken::Applepay {
|
||||||
|
|||||||
@ -63,7 +63,7 @@ impl
|
|||||||
types::PaymentsResponseData,
|
types::PaymentsResponseData,
|
||||||
> for Authorizedotnet
|
> for Authorizedotnet
|
||||||
{
|
{
|
||||||
// TODO: Critical Implement
|
// Issue: #173
|
||||||
}
|
}
|
||||||
|
|
||||||
impl
|
impl
|
||||||
|
|||||||
@ -588,7 +588,6 @@ impl<F, Req>
|
|||||||
),
|
),
|
||||||
redirection_data: None,
|
redirection_data: None,
|
||||||
redirect: false,
|
redirect: false,
|
||||||
// TODO: Implement mandate fetch for other connectors
|
|
||||||
mandate_reference: None,
|
mandate_reference: None,
|
||||||
}),
|
}),
|
||||||
status: payment_status,
|
status: payment_status,
|
||||||
|
|||||||
@ -209,7 +209,6 @@ impl<F, T>
|
|||||||
),
|
),
|
||||||
redirection_data: None,
|
redirection_data: None,
|
||||||
redirect: false,
|
redirect: false,
|
||||||
// TODO: Implement mandate fetch for other connectors
|
|
||||||
mandate_reference: None,
|
mandate_reference: None,
|
||||||
}),
|
}),
|
||||||
..item.data
|
..item.data
|
||||||
|
|||||||
@ -77,7 +77,7 @@ impl
|
|||||||
types::PaymentsResponseData,
|
types::PaymentsResponseData,
|
||||||
> for Checkout
|
> for Checkout
|
||||||
{
|
{
|
||||||
// TODO: Critical Implement
|
// Issue: #173
|
||||||
}
|
}
|
||||||
|
|
||||||
impl
|
impl
|
||||||
@ -251,7 +251,6 @@ impl
|
|||||||
data: &types::PaymentsAuthorizeRouterData,
|
data: &types::PaymentsAuthorizeRouterData,
|
||||||
res: types::Response,
|
res: types::Response,
|
||||||
) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {
|
) -> CustomResult<types::PaymentsAuthorizeRouterData, errors::ConnectorError> {
|
||||||
//TODO: [ORCA-618] If 3ds fails, the response should be a redirect response, to redirect client to success/failed page
|
|
||||||
let response: checkout::PaymentsResponse = res
|
let response: checkout::PaymentsResponse = res
|
||||||
.response
|
.response
|
||||||
.parse_struct("PaymentIntentResponse")
|
.parse_struct("PaymentIntentResponse")
|
||||||
@ -276,14 +275,12 @@ impl
|
|||||||
code: response
|
code: response
|
||||||
.error_codes
|
.error_codes
|
||||||
.unwrap_or_else(|| vec![consts::NO_ERROR_CODE.to_string()])
|
.unwrap_or_else(|| vec![consts::NO_ERROR_CODE.to_string()])
|
||||||
//Considered all the codes here but have to look into the exact no.of codes
|
|
||||||
.join(" & "),
|
.join(" & "),
|
||||||
message: response
|
message: response
|
||||||
.error_type
|
.error_type
|
||||||
.unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()),
|
.unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()),
|
||||||
reason: None,
|
reason: None,
|
||||||
})
|
})
|
||||||
//TODO : No sufficient information of error codes (no.of error codes to consider)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,7 +372,6 @@ impl
|
|||||||
code: response
|
code: response
|
||||||
.error_codes
|
.error_codes
|
||||||
.unwrap_or_else(|| vec![consts::NO_ERROR_CODE.to_string()])
|
.unwrap_or_else(|| vec![consts::NO_ERROR_CODE.to_string()])
|
||||||
//Considered all the codes here but have to look into the exact no.of codes
|
|
||||||
.join(" & "),
|
.join(" & "),
|
||||||
message: response
|
message: response
|
||||||
.error_type
|
.error_type
|
||||||
@ -482,14 +478,12 @@ impl services::ConnectorIntegration<api::Execute, types::RefundsData, types::Ref
|
|||||||
code: response
|
code: response
|
||||||
.error_codes
|
.error_codes
|
||||||
.unwrap_or_else(|| vec![consts::NO_ERROR_CODE.to_string()])
|
.unwrap_or_else(|| vec![consts::NO_ERROR_CODE.to_string()])
|
||||||
//Considered all the codes here but have to look into the exact no.of codes
|
|
||||||
.join(" & "),
|
.join(" & "),
|
||||||
message: response
|
message: response
|
||||||
.error_type
|
.error_type
|
||||||
.unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()),
|
.unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()),
|
||||||
reason: None,
|
reason: None,
|
||||||
})
|
})
|
||||||
//TODO : No sufficient information of error codes (no.of error codes to consider)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -582,14 +576,12 @@ impl services::ConnectorIntegration<api::RSync, types::RefundsData, types::Refun
|
|||||||
code: response
|
code: response
|
||||||
.error_codes
|
.error_codes
|
||||||
.unwrap_or_else(|| vec![consts::NO_ERROR_CODE.to_string()])
|
.unwrap_or_else(|| vec![consts::NO_ERROR_CODE.to_string()])
|
||||||
//Considered all the codes here but have to look into the exact no.of codes
|
|
||||||
.join(" & "),
|
.join(" & "),
|
||||||
message: response
|
message: response
|
||||||
.error_type
|
.error_type
|
||||||
.unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()),
|
.unwrap_or_else(|| consts::NO_ERROR_MESSAGE.to_string()),
|
||||||
reason: None,
|
reason: None,
|
||||||
})
|
})
|
||||||
//TODO : No sufficient information of error codes (no.of error codes to consider)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,6 @@ pub struct CardSource {
|
|||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum Source {
|
pub enum Source {
|
||||||
Card(CardSource),
|
Card(CardSource),
|
||||||
// TODO: Add other sources here.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct CheckoutAuthType {
|
pub struct CheckoutAuthType {
|
||||||
@ -220,7 +219,6 @@ impl TryFrom<types::PaymentsResponseRouterData<PaymentsResponse>>
|
|||||||
resource_id: types::ResponseId::ConnectorTransactionId(item.response.id),
|
resource_id: types::ResponseId::ConnectorTransactionId(item.response.id),
|
||||||
redirect: redirection_data.is_some(),
|
redirect: redirection_data.is_some(),
|
||||||
redirection_data,
|
redirection_data,
|
||||||
// TODO: Implement mandate fetch for other connectors
|
|
||||||
mandate_reference: None,
|
mandate_reference: None,
|
||||||
}),
|
}),
|
||||||
..item.data
|
..item.data
|
||||||
@ -235,14 +233,31 @@ impl TryFrom<types::PaymentsSyncResponseRouterData<PaymentsResponse>>
|
|||||||
fn try_from(
|
fn try_from(
|
||||||
item: types::PaymentsSyncResponseRouterData<PaymentsResponse>,
|
item: types::PaymentsSyncResponseRouterData<PaymentsResponse>,
|
||||||
) -> Result<Self, Self::Error> {
|
) -> Result<Self, Self::Error> {
|
||||||
|
let redirection_url = item
|
||||||
|
.response
|
||||||
|
.links
|
||||||
|
.redirect
|
||||||
|
.map(|data| Url::parse(&data.href))
|
||||||
|
.transpose()
|
||||||
|
.into_report()
|
||||||
|
.change_context(errors::ParsingError)
|
||||||
|
.attach_printable("Could not parse the redirection data")?;
|
||||||
|
|
||||||
|
let redirection_data = redirection_url.map(|url| services::RedirectForm {
|
||||||
|
url: url.to_string(),
|
||||||
|
method: services::Method::Get,
|
||||||
|
form_fields: std::collections::HashMap::from_iter(
|
||||||
|
url.query_pairs()
|
||||||
|
.map(|(k, v)| (k.to_string(), v.to_string())),
|
||||||
|
),
|
||||||
|
});
|
||||||
|
|
||||||
Ok(types::RouterData {
|
Ok(types::RouterData {
|
||||||
status: enums::AttemptStatus::foreign_from((item.response.status, None)),
|
status: enums::AttemptStatus::foreign_from((item.response.status, None)),
|
||||||
response: Ok(types::PaymentsResponseData::TransactionResponse {
|
response: Ok(types::PaymentsResponseData::TransactionResponse {
|
||||||
resource_id: types::ResponseId::ConnectorTransactionId(item.response.id),
|
resource_id: types::ResponseId::ConnectorTransactionId(item.response.id),
|
||||||
//TODO: Add redirection details here
|
redirect: redirection_data.is_some(),
|
||||||
redirection_data: None,
|
redirection_data,
|
||||||
redirect: false,
|
|
||||||
// TODO: Implement mandate fetch for other connectors
|
|
||||||
mandate_reference: None,
|
mandate_reference: None,
|
||||||
}),
|
}),
|
||||||
..item.data
|
..item.data
|
||||||
@ -284,7 +299,6 @@ impl TryFrom<types::PaymentsCancelResponseRouterData<PaymentVoidResponse>>
|
|||||||
resource_id: types::ResponseId::ConnectorTransactionId(response.action_id.clone()),
|
resource_id: types::ResponseId::ConnectorTransactionId(response.action_id.clone()),
|
||||||
redirect: false,
|
redirect: false,
|
||||||
redirection_data: None,
|
redirection_data: None,
|
||||||
// TODO: Implement mandate fetch for other connectors
|
|
||||||
mandate_reference: None,
|
mandate_reference: None,
|
||||||
}),
|
}),
|
||||||
status: response.into(),
|
status: response.into(),
|
||||||
|
|||||||
@ -160,7 +160,7 @@ impl
|
|||||||
types::PaymentsResponseData,
|
types::PaymentsResponseData,
|
||||||
> for Klarna
|
> for Klarna
|
||||||
{
|
{
|
||||||
// TODO: Critical Implement
|
// Not Implemented(R)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl
|
impl
|
||||||
|
|||||||
@ -10,7 +10,10 @@ use self::transformers as stripe;
|
|||||||
use crate::{
|
use crate::{
|
||||||
configs::settings,
|
configs::settings,
|
||||||
consts,
|
consts,
|
||||||
core::errors::{self, CustomResult},
|
core::{
|
||||||
|
errors::{self, CustomResult},
|
||||||
|
payments,
|
||||||
|
},
|
||||||
db::StorageInterface,
|
db::StorageInterface,
|
||||||
headers, logger, services,
|
headers, logger, services,
|
||||||
types::{
|
types::{
|
||||||
@ -606,7 +609,6 @@ impl
|
|||||||
reason: None,
|
reason: None,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// TODO CRITICAL: Implement for POC
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl api::Refund for Stripe {}
|
impl api::Refund for Stripe {}
|
||||||
@ -755,7 +757,6 @@ impl services::ConnectorIntegration<api::RSync, types::RefundsData, types::Refun
|
|||||||
Ok(Some(
|
Ok(Some(
|
||||||
services::RequestBuilder::new()
|
services::RequestBuilder::new()
|
||||||
.method(services::Method::Post)
|
.method(services::Method::Post)
|
||||||
// TODO: [ORCA-346] Requestbuilder needs &str migrate get_url to send &str instead of owned string
|
|
||||||
.url(&types::RefundSyncType::get_url(self, req, connectors)?)
|
.url(&types::RefundSyncType::get_url(self, req, connectors)?)
|
||||||
.headers(types::RefundSyncType::get_headers(self, req)?)
|
.headers(types::RefundSyncType::get_headers(self, req)?)
|
||||||
.header(headers::X_ROUTER, "test")
|
.header(headers::X_ROUTER, "test")
|
||||||
@ -946,13 +947,10 @@ impl services::ConnectorRedirectResponse for Stripe {
|
|||||||
.into_report()
|
.into_report()
|
||||||
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
|
.change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
|
||||||
|
|
||||||
if query.redirect_status.is_some() {
|
Ok(query
|
||||||
//TODO: Map the redirect status of StripeRedirectResponse to AttemptStatus
|
.redirect_status
|
||||||
Ok(crate::core::payments::CallConnectorAction::StatusUpdate(
|
.map_or(payments::CallConnectorAction::Trigger, |status| {
|
||||||
types::storage::enums::AttemptStatus::Pending,
|
payments::CallConnectorAction::StatusUpdate(status.into())
|
||||||
))
|
}))
|
||||||
} else {
|
|
||||||
Ok(crate::core::payments::CallConnectorAction::Trigger)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -348,7 +348,6 @@ impl<F, T>
|
|||||||
fn try_from(
|
fn try_from(
|
||||||
item: types::ResponseRouterData<F, PaymentIntentResponse, T, types::PaymentsResponseData>,
|
item: types::ResponseRouterData<F, PaymentIntentResponse, T, types::PaymentsResponseData>,
|
||||||
) -> Result<Self, Self::Error> {
|
) -> Result<Self, Self::Error> {
|
||||||
// Redirect form not used https://juspay.atlassian.net/browse/ORCA-301
|
|
||||||
let redirection_data = item.response.next_action.as_ref().map(
|
let redirection_data = item.response.next_action.as_ref().map(
|
||||||
|StripeNextActionResponse::RedirectToUrl(response)| {
|
|StripeNextActionResponse::RedirectToUrl(response)| {
|
||||||
let mut base_url = response.url.clone();
|
let mut base_url = response.url.clone();
|
||||||
@ -507,28 +506,23 @@ impl<F> TryFrom<&types::RefundsRouterData<F>> for RefundRequest {
|
|||||||
|
|
||||||
// Type definition for Stripe Refund Response
|
// Type definition for Stripe Refund Response
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Default, Debug, Serialize, Deserialize, Clone)]
|
||||||
#[serde(rename_all = "lowercase")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum RefundStatus {
|
pub enum RefundStatus {
|
||||||
Succeeded,
|
Succeeded,
|
||||||
Failed,
|
Failed,
|
||||||
Processing,
|
#[default]
|
||||||
}
|
Pending,
|
||||||
|
RequiresAction,
|
||||||
// Default should be Processing
|
|
||||||
impl Default for RefundStatus {
|
|
||||||
fn default() -> Self {
|
|
||||||
RefundStatus::Processing
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<self::RefundStatus> for enums::RefundStatus {
|
impl From<self::RefundStatus> for enums::RefundStatus {
|
||||||
fn from(item: self::RefundStatus) -> Self {
|
fn from(item: self::RefundStatus) -> Self {
|
||||||
match item {
|
match item {
|
||||||
self::RefundStatus::Succeeded => enums::RefundStatus::Success,
|
self::RefundStatus::Succeeded => Self::Success,
|
||||||
self::RefundStatus::Failed => enums::RefundStatus::Failure,
|
self::RefundStatus::Failed => Self::Failure,
|
||||||
self::RefundStatus::Processing => enums::RefundStatus::Pending,
|
self::RefundStatus::Pending => Self::Pending,
|
||||||
//TODO: Review mapping
|
self::RefundStatus::RequiresAction => Self::ManualReview,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -617,7 +611,7 @@ pub struct StripeRedirectResponse {
|
|||||||
pub payment_intent: String,
|
pub payment_intent: String,
|
||||||
pub payment_intent_client_secret: String,
|
pub payment_intent_client_secret: String,
|
||||||
pub source_redirect_slug: Option<String>,
|
pub source_redirect_slug: Option<String>,
|
||||||
pub redirect_status: Option<String>,
|
pub redirect_status: Option<StripePaymentStatus>,
|
||||||
pub source_type: Option<String>,
|
pub source_type: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user