Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/router/src/connector/adyen/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3950,7 +3950,7 @@ impl TryFrom<types::PaymentsCaptureResponseRouterData<AdyenCaptureResponse>>
connector_response_reference_id: Some(item.response.reference),
incremental_authorization_allowed: None,
}),
amount_captured: Some(item.response.amount.value),
amount_captured: Some(0),
..item.data
})
}
Expand Down
29 changes: 28 additions & 1 deletion crates/router/src/connector/paypal/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1544,8 +1544,35 @@ impl TryFrom<types::PaymentsCaptureResponseRouterData<PaypalCaptureResponse>>
fn try_from(
item: types::PaymentsCaptureResponseRouterData<PaypalCaptureResponse>,
) -> Result<Self, Self::Error> {
let amount_captured = item.data.request.amount_to_capture;
let status = storage_enums::AttemptStatus::from(item.response.status);
let amount_captured = match status {
storage_enums::AttemptStatus::Pending
| storage_enums::AttemptStatus::Authorized
| storage_enums::AttemptStatus::Failure
| storage_enums::AttemptStatus::RouterDeclined
| storage_enums::AttemptStatus::AuthenticationFailed
| storage_enums::AttemptStatus::CaptureFailed
| storage_enums::AttemptStatus::Started
| storage_enums::AttemptStatus::AuthenticationPending
| storage_enums::AttemptStatus::AuthenticationSuccessful
| storage_enums::AttemptStatus::AuthorizationFailed
| storage_enums::AttemptStatus::Authorizing
| storage_enums::AttemptStatus::VoidInitiated
| storage_enums::AttemptStatus::CodInitiated
| storage_enums::AttemptStatus::CaptureInitiated
| storage_enums::AttemptStatus::VoidFailed
| storage_enums::AttemptStatus::AutoRefunded
| storage_enums::AttemptStatus::Unresolved
| storage_enums::AttemptStatus::PaymentMethodAwaited
| storage_enums::AttemptStatus::ConfirmationAwaited
| storage_enums::AttemptStatus::DeviceDataCollectionPending
| storage_enums::AttemptStatus::Voided => 0,
storage_enums::AttemptStatus::Charged
| storage_enums::AttemptStatus::PartialCharged
| storage_enums::AttemptStatus::PartialChargedAndChargeable => {
item.data.request.amount_to_capture
}
};
let connector_payment_id: PaypalMeta =
to_connector_meta(item.data.request.connector_meta.clone())?;
Ok(Self {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ if (jsonData?.amount) {
);
}

// Response body should have value "6000" for "amount_received"
// Response body should have value "0" for "amount_received"
if (jsonData?.amount_received) {
pm.test(
"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6000'",
"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '0'",
function () {
pm.expect(jsonData.amount_received).to.eql(6000);
pm.expect(jsonData.amount_received).to.eql(0);
},
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,13 @@ if (jsonData?.amount_capturable) {
},
);
}

// Response body should have value "0" for "amount_received"
if (jsonData?.amount_received) {
pm.test(
"[post]:://payments/:id/capture - Content check if value for 'amount_received' matches 0",
function () {
pm.expect(jsonData.amount_received).to.eql(0);
},
);
}
6 changes: 3 additions & 3 deletions postman/collection-json/adyen_uk.postman_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -2688,12 +2688,12 @@
" );",
"}",
"",
"// Response body should have value \"6000\" for \"amount_received\"",
"// Response body should have value \"0\" for \"amount_received\"",
"if (jsonData?.amount_received) {",
" pm.test(",
" \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6000'\",",
" \"[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '0'\",",
" function () {",
" pm.expect(jsonData.amount_received).to.eql(6000);",
" pm.expect(jsonData.amount_received).to.eql(0);",
" },",
" );",
"}",
Expand Down
10 changes: 10 additions & 0 deletions postman/collection-json/paypal.postman_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -3506,6 +3506,16 @@
" },",
" );",
"}",
"",
"// Response body should have value \"0\" for \"amount_received\"",
"if (jsonData?.amount_received) {",
" pm.test(",
" \"[post]:://payments/:id/capture - Content check if value for 'amount_received' matches 0\",",
" function () {",
" pm.expect(jsonData.amount_received).to.eql(0);",
" },",
" );",
"}",
""
],
"type": "text/javascript"
Expand Down