mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +08:00
refactor(core): populate shipping_cost in payment response (#6351)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -14085,6 +14085,13 @@
|
||||
"description": "The payment net amount. net_amount = amount + surcharge_details.surcharge_amount + surcharge_details.tax_amount + shipping_cost + order_tax_amount,\nIf no surcharge_details, shipping_cost, order_tax_amount, net_amount = amount",
|
||||
"example": 6540
|
||||
},
|
||||
"shipping_cost": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "The shipping cost for the payment.",
|
||||
"example": 6540,
|
||||
"nullable": true
|
||||
},
|
||||
"amount_capturable": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
@ -15224,6 +15231,13 @@
|
||||
"description": "The payment net amount. net_amount = amount + surcharge_details.surcharge_amount + surcharge_details.tax_amount + shipping_cost + order_tax_amount,\nIf no surcharge_details, shipping_cost, order_tax_amount, net_amount = amount",
|
||||
"example": 6540
|
||||
},
|
||||
"shipping_cost": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "The shipping cost for the payment.",
|
||||
"example": 6540,
|
||||
"nullable": true
|
||||
},
|
||||
"amount_capturable": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
|
||||
@ -17347,6 +17347,13 @@
|
||||
"description": "The payment net amount. net_amount = amount + surcharge_details.surcharge_amount + surcharge_details.tax_amount + shipping_cost + order_tax_amount,\nIf no surcharge_details, shipping_cost, order_tax_amount, net_amount = amount",
|
||||
"example": 6540
|
||||
},
|
||||
"shipping_cost": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "The shipping cost for the payment.",
|
||||
"example": 6540,
|
||||
"nullable": true
|
||||
},
|
||||
"amount_capturable": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
@ -18535,6 +18542,13 @@
|
||||
"description": "The payment net amount. net_amount = amount + surcharge_details.surcharge_amount + surcharge_details.tax_amount + shipping_cost + order_tax_amount,\nIf no surcharge_details, shipping_cost, order_tax_amount, net_amount = amount",
|
||||
"example": 6540
|
||||
},
|
||||
"shipping_cost": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "The shipping cost for the payment.",
|
||||
"example": 6540,
|
||||
"nullable": true
|
||||
},
|
||||
"amount_capturable": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
|
||||
@ -4093,6 +4093,10 @@ pub struct PaymentsResponse {
|
||||
#[schema(value_type = i64, example = 6540)]
|
||||
pub net_amount: MinorUnit,
|
||||
|
||||
/// The shipping cost for the payment.
|
||||
#[schema(value_type = Option<i64>, example = 6540)]
|
||||
pub shipping_cost: Option<MinorUnit>,
|
||||
|
||||
/// The maximum amount that could be captured from the payment
|
||||
#[schema(value_type = i64, minimum = 100, example = 6540)]
|
||||
pub amount_capturable: MinorUnit,
|
||||
|
||||
@ -1342,6 +1342,7 @@ where
|
||||
merchant_order_reference_id: payment_intent.merchant_order_reference_id,
|
||||
order_tax_amount,
|
||||
connector_mandate_id,
|
||||
shipping_cost: payment_intent.shipping_cost,
|
||||
};
|
||||
|
||||
services::ApplicationResponse::JsonWithHeaders((payments_response, headers))
|
||||
@ -1598,6 +1599,7 @@ impl ForeignFrom<(storage::PaymentIntent, storage::PaymentAttempt)> for api::Pay
|
||||
frm_metadata: None,
|
||||
order_tax_amount: None,
|
||||
connector_mandate_id:None,
|
||||
shipping_cost: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -446,6 +446,7 @@ async fn payments_create_core() {
|
||||
merchant_order_reference_id: None,
|
||||
order_tax_amount: None,
|
||||
connector_mandate_id: None,
|
||||
shipping_cost: None,
|
||||
};
|
||||
let expected_response =
|
||||
services::ApplicationResponse::JsonWithHeaders((expected_response, vec![]));
|
||||
@ -704,6 +705,7 @@ async fn payments_create_core_adyen_no_redirect() {
|
||||
merchant_order_reference_id: None,
|
||||
order_tax_amount: None,
|
||||
connector_mandate_id: None,
|
||||
shipping_cost: None,
|
||||
},
|
||||
vec![],
|
||||
));
|
||||
|
||||
@ -207,6 +207,7 @@ async fn payments_create_core() {
|
||||
merchant_order_reference_id: None,
|
||||
order_tax_amount: None,
|
||||
connector_mandate_id: None,
|
||||
shipping_cost: None,
|
||||
};
|
||||
|
||||
let expected_response =
|
||||
@ -474,6 +475,7 @@ async fn payments_create_core_adyen_no_redirect() {
|
||||
merchant_order_reference_id: None,
|
||||
order_tax_amount: None,
|
||||
connector_mandate_id: None,
|
||||
shipping_cost: None,
|
||||
},
|
||||
vec![],
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user