mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 17:19:15 +08:00
enhance(stripe): send statement descriptor to stripe (#707)
This commit is contained in:
@ -181,7 +181,7 @@ impl TryFrom<StripePaymentIntentRequest> for payments::PaymentsRequest {
|
||||
.billing_details
|
||||
.as_ref()
|
||||
.map(|b| payments::Address::from(b.to_owned())),
|
||||
statement_descriptor_name: item.statement_descriptor,
|
||||
statement_descriptor: item.statement_descriptor,
|
||||
statement_descriptor_suffix: item.statement_descriptor_suffix,
|
||||
metadata: item.metadata,
|
||||
client_secret: item.client_secret.map(|s| s.peek().clone()),
|
||||
@ -336,7 +336,7 @@ impl From<payments::PaymentsResponse> for StripePaymentIntentResponse {
|
||||
name: resp.name,
|
||||
phone: resp.phone,
|
||||
authentication_type: resp.authentication_type,
|
||||
statement_descriptor_name: resp.statement_descriptor_name,
|
||||
statement_descriptor_name: resp.statement_descriptor,
|
||||
statement_descriptor_suffix: resp.statement_descriptor_suffix,
|
||||
next_action: into_stripe_next_action(resp.next_action, resp.return_url),
|
||||
cancellation_reason: resp.cancellation_reason,
|
||||
|
||||
@ -159,7 +159,7 @@ impl From<StripeSetupIntentRequest> for payments::PaymentsRequest {
|
||||
.billing_details
|
||||
.as_ref()
|
||||
.map(|b| payments::Address::from(b.to_owned())),
|
||||
statement_descriptor_name: item.statement_descriptor,
|
||||
statement_descriptor: item.statement_descriptor,
|
||||
statement_descriptor_suffix: item.statement_descriptor_suffix,
|
||||
metadata: item.metadata,
|
||||
client_secret: item.client_secret.map(|s| s.peek().clone()),
|
||||
|
||||
@ -33,10 +33,6 @@ impl TryFrom<&types::ConnectorAuthType> for StripeAuthType {
|
||||
}
|
||||
}
|
||||
|
||||
// Stripe Types Definition
|
||||
// PAYMENT
|
||||
// PaymentIntentRequest
|
||||
|
||||
#[derive(Debug, Default, Eq, PartialEq, Serialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum StripeCaptureMethod {
|
||||
@ -72,6 +68,7 @@ pub struct PaymentIntentRequest {
|
||||
pub amount: i64, //amount in cents, hence passed as integer
|
||||
pub currency: String,
|
||||
pub statement_descriptor_suffix: Option<String>,
|
||||
pub statement_descriptor: Option<String>,
|
||||
#[serde(rename = "metadata[order_id]")]
|
||||
pub metadata_order_id: String,
|
||||
#[serde(rename = "metadata[txn_id]")]
|
||||
@ -626,6 +623,7 @@ impl TryFrom<&types::PaymentsAuthorizeRouterData> for PaymentIntentRequest {
|
||||
amount: item.request.amount, //hopefully we don't loose some cents here
|
||||
currency: item.request.currency.to_string(), //we need to copy the value and not transfer ownership
|
||||
statement_descriptor_suffix: item.request.statement_descriptor_suffix.clone(),
|
||||
statement_descriptor: item.request.statement_descriptor.clone(),
|
||||
metadata_order_id,
|
||||
metadata_txn_id,
|
||||
metadata_txn_uuid,
|
||||
@ -672,8 +670,6 @@ impl TryFrom<&types::VerifyRouterData> for SetupIntentRequest {
|
||||
}
|
||||
}
|
||||
|
||||
// PaymentIntentResponse
|
||||
|
||||
#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
|
||||
pub struct StripeMetadata {
|
||||
pub order_id: String,
|
||||
|
||||
@ -83,7 +83,7 @@ pub fn mk_add_card_request(
|
||||
card_exp_year: card.card_exp_year.clone(),
|
||||
merchant_id: locker_id,
|
||||
email_address: Some("dummy@gmail.com".to_string().into()), //
|
||||
name_on_card: Some("juspay".to_string().into()), // [#256]
|
||||
name_on_card: Some("John Doe".to_string().into()), // [#256]
|
||||
nickname: Some("router".to_string()), //
|
||||
};
|
||||
let body = utils::Encode::<AddCardRequest<'_>>::encode(&add_card_req)
|
||||
|
||||
@ -500,7 +500,7 @@ impl PaymentCreate {
|
||||
return_url: request.return_url.as_ref().map(|a| a.to_string()),
|
||||
shipping_address_id,
|
||||
billing_address_id,
|
||||
statement_descriptor_name: request.statement_descriptor_name.clone(),
|
||||
statement_descriptor_name: request.statement_descriptor.clone(),
|
||||
statement_descriptor_suffix: request.statement_descriptor_suffix.clone(),
|
||||
metadata,
|
||||
..storage::PaymentIntentNew::default()
|
||||
|
||||
@ -324,7 +324,7 @@ where
|
||||
.authentication_type
|
||||
.map(ForeignInto::foreign_into),
|
||||
)
|
||||
.set_statement_descriptor_name(payment_intent.statement_descriptor_name)
|
||||
.set_statement_descriptor(payment_intent.statement_descriptor_name)
|
||||
.set_statement_descriptor_suffix(payment_intent.statement_descriptor_suffix)
|
||||
.set_setup_future_usage(
|
||||
payment_intent
|
||||
@ -432,6 +432,7 @@ impl<F: Clone> TryFrom<PaymentData<F>> for types::PaymentsAuthorizeData {
|
||||
setup_mandate_details: payment_data.setup_mandate.clone(),
|
||||
confirm: payment_data.payment_attempt.confirm,
|
||||
statement_descriptor_suffix: payment_data.payment_intent.statement_descriptor_suffix,
|
||||
statement_descriptor: payment_data.payment_intent.statement_descriptor_name,
|
||||
capture_method: payment_data.payment_attempt.capture_method,
|
||||
amount: payment_data.amount.into(),
|
||||
currency: payment_data.currency,
|
||||
|
||||
@ -116,6 +116,7 @@ pub struct PaymentsAuthorizeData {
|
||||
pub currency: storage_enums::Currency,
|
||||
pub confirm: bool,
|
||||
pub statement_descriptor_suffix: Option<String>,
|
||||
pub statement_descriptor: Option<String>,
|
||||
pub capture_method: Option<storage_enums::CaptureMethod>,
|
||||
// Mandates
|
||||
pub setup_future_usage: Option<storage_enums::FutureUsage>,
|
||||
|
||||
Reference in New Issue
Block a user