Skip to content

Commit bb86cc2

Browse files
fix(refunds): Add profile_id in refunds response (#2652)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 6428d07 commit bb86cc2

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

crates/api_models/src/refunds.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ pub struct RefundResponse {
124124
/// The connector used for the refund and the corresponding payment
125125
#[schema(example = "stripe")]
126126
pub connector: String,
127+
pub profile_id: Option<String>,
127128
}
128129

129130
#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize, ToSchema)]

crates/router/src/core/refunds.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,7 @@ pub async fn validate_and_create_refund(
602602
.set_description(req.reason.clone())
603603
.set_attempt_id(payment_attempt.attempt_id.clone())
604604
.set_refund_reason(req.reason)
605+
.set_profile_id(payment_intent.profile_id.clone())
605606
.to_owned();
606607

607608
refund = db
@@ -704,6 +705,7 @@ impl ForeignFrom<storage::Refund> for api::RefundResponse {
704705
currency: refund.currency.to_string(),
705706
reason: refund.refund_reason,
706707
status: refund.refund_status.foreign_into(),
708+
profile_id: refund.profile_id,
707709
metadata: refund.metadata,
708710
error_message: refund.refund_error_message,
709711
error_code: refund.refund_error_code,

openapi/openapi_spec.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10680,6 +10680,10 @@
1068010680
"type": "string",
1068110681
"description": "The connector used for the refund and the corresponding payment",
1068210682
"example": "stripe"
10683+
},
10684+
"profile_id": {
10685+
"type": "string",
10686+
"nullable": true
1068310687
}
1068410688
}
1068510689
},

postman/collection-dir/stripe/QuickStart/Refunds - Create/event.test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,13 @@ if (jsonData?.refund_id) {
2828
"INFO - Unable to assign variable {{refund_id}}, as jsonData.refund_id is undefined.",
2929
);
3030
}
31+
32+
33+
// Response body should have "profile_id" and not "null"
34+
pm.test(
35+
"[POST]::/payments - Content check if 'profile_id' exists and is not 'null'",
36+
function () {
37+
pm.expect(typeof jsonData.profile_id !== "undefined").to.be.true;
38+
pm.expect(jsonData.profile_id).is.not.null;
39+
},
40+
);

0 commit comments

Comments
 (0)