Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

fix(core): introduce new attempt and intent status to handle multiple partial captures (#2802)

Hrithikeshcb88be01f227
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rs
index 48b0664c16..8b1437fa89 100644
--- a/crates/common_enums/src/enums.rs
+++ b/crates/common_enums/src/enums.rs
@@ -50,6 +50,7 @@ pub enum AttemptStatus {
VoidFailed,
AutoRefunded,
PartialCharged,
+ PartialChargedAndChargeable,
Unresolved,
#[default]
Pending,
@@ -68,7 +69,8 @@ impl AttemptStatus {
| Self::Voided
| Self::VoidFailed
| Self::CaptureFailed
- | Self::Failure => true,
+ | Self::Failure
+ | Self::PartialCharged => true,
Self::Started
| Self::AuthenticationFailed
| Self::AuthenticationPending
@@ -79,7 +81,7 @@ impl AttemptStatus {
| Self::CodInitiated
| Self::VoidInitiated
| Self::CaptureInitiated
- | Self::PartialCharged
+ | Self::PartialChargedAndChargeable
| Self::Unresolved
| Self::Pending
| Self::PaymentMethodAwaited
@@ -861,6 +863,7 @@ pub enum IntentStatus {
RequiresConfirmation,
RequiresCapture,
PartiallyCaptured,
+ PartiallyCapturedAndCapturable,
}
#[derive(
diff --git a/crates/router/src/compatibility/stripe/payment_intents/types.rs b/crates/router/src/compatibility/stripe/payment_intents/types.rs
index c713011b80..3c7d5f2918 100644
--- a/crates/router/src/compatibility/stripe/payment_intents/types.rs
+++ b/crates/router/src/compatibility/stripe/payment_intents/types.rs
@@ -405,7 +405,9 @@ pub enum StripePaymentStatus {
impl From<api_enums::IntentStatus> for StripePaymentStatus {
fn from(item: api_enums::IntentStatus) -> Self {
match item {
- api_enums::IntentStatus::Succeeded => Self::Succeeded,
+ api_enums::IntentStatus::Succeeded | api_enums::IntentStatus::PartiallyCaptured => {
+ Self::Succeeded
+ }
api_enums::IntentStatus::Failed => Self::Canceled,
api_enums::IntentStatus::Processing => Self::Processing,
api_enums::IntentStatus::RequiresCustomerAction
@@ -413,7 +415,7 @@ impl From<api_enums::IntentStatus> for StripePaymentStatus {
api_enums::IntentStatus::RequiresPaymentMethod => Self::RequiresPaymentMethod,
api_enums::IntentStatus::RequiresConfirmation => Self::RequiresConfirmation,
api_enums::IntentStatus::RequiresCapture
- | api_enums::IntentStatus::PartiallyCaptured => Self::RequiresCapture,
+ | api_enums::IntentStatus::PartiallyCapturedAndCapturable => Self::RequiresCapture,
api_enums::IntentStatus::Cancelled => Self::Canceled,
}
}
diff --git a/crates/router/src/compatibility/stripe/setup_intents/types.rs b/crates/router/src/compatibility/stripe/setup_intents/types.rs
index dde378e559..9d3f74af8c 100644
--- a/crates/router/src/compatibility/stripe/setup_intents/types.rs
+++ b/crates/router/src/compatibility/stripe/setup_intents/types.rs
@@ -313,7 +313,9 @@ pub enum StripeSetupStatus {
impl From<api_enums::IntentStatus> for StripeSetupStatus {
fn from(item: api_enums::IntentStatus) -> Self {
match item {
- api_enums::IntentStatus::Succeeded => Self::Succeeded,
+ api_enums::IntentStatus::Succeeded | api_enums::IntentStatus::PartiallyCaptured => {
+ Self::Succeeded
+ }
api_enums::IntentStatus::Failed => Self::Canceled,
api_enums::IntentStatus::Processing => Self::Processing,
api_enums::IntentStatus::RequiresCustomerAction => Self::RequiresAction,
@@ -321,7 +323,7 @@ impl From<api_enums::IntentStatus> for StripeSetupStatus {
api_enums::IntentStatus::RequiresPaymentMethod => Self::RequiresPaymentMethod,
api_enums::IntentStatus::RequiresConfirmation => Self::RequiresConfirmation,
api_enums::IntentStatus::RequiresCapture
- | api_enums::IntentStatus::PartiallyCaptured => {
+ | api_enums::IntentStatus::PartiallyCapturedAndCapturable => {
logger::error!("Invalid status change");
Self::Canceled
}
diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs
index efabbf87ae..9c19d4eed8 100644
--- a/crates/router/src/connector/utils.rs
+++ b/crates/router/src/connector/utils.rs
@@ -19,7 +19,10 @@ use serde::Serializer;
use crate::{
consts,
- core::errors::{self, CustomResult},
+ core::{
+ errors::{self, CustomResult},
+ payments::PaymentData,
+ },
pii::PeekInterface,
types::{self, api, transformers::ForeignTryFrom, PaymentsCancelData, ResponseId},
utils::{OptionExt, ValueExt},
@@ -74,6 +77,49 @@ pub trait RouterData {
#[cfg(feature = "payouts")]
fn get_quote_id(&self) -> Result<String, Error>;
}
+
+pub trait PaymentResponseRouterData {
+ fn get_attempt_status_for_db_update<F>(
+ &self,
+ payment_data: &PaymentData<F>,
+ ) -> enums::AttemptStatus
+ where
+ F: Clone;
+}
+
+impl<Flow, Request, Response> PaymentResponseRouterData
+ for types::RouterData<Flow, Request, Response>
+where
+ Request: types::Capturable,
+{
+ fn get_attempt_status_for_db_update<F>(
+ &self,
+ payment_data: &PaymentData<F>,
+ ) -> enums::AttemptStatus
+ where
+ F: Clone,
+ {
+ match self.status {
+ enums::AttemptStatus::Voided => {
+ if payment_data.payment_intent.amount_captured > Some(0) {
+ enums::AttemptStatus::PartialCharged
+ } else {
+ self.status
+ }
+ }
+ enums::AttemptStatus::Charged => {
+ let captured_amount = types::Capturable::get_capture_amount(&self.request);
+ if Some(payment_data.payment_intent.amount) == captured_amount {
+ enums::AttemptStatus::Charged
+ } else {
+ enums::AttemptStatus::PartialCharged
+ }
+ }
+ _ => self.status,
+ }
+ }
+}
+
pub const SELECTED_PAYMENT_METHOD: &str = "Selected payment method";
pub fn get_unimplemented_payment_method_error_message(connector: &str) -> String {
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 7e19b0b605..000cadec00 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -1736,19 +1736,19 @@ pub fn should_call_connector<Op: Debug, F: Clone>(
| storage_enums::IntentStatus::RequiresCustomerAction
| storage_enums::IntentStatus::RequiresMerchantAction
| storage_enums::IntentStatus::RequiresCapture
- | storage_enums::IntentStatus::PartiallyCaptured
+ | storage_enums::IntentStatus::PartiallyCapturedAndCapturable
) && payment_data.force_sync.unwrap_or(false)
}
"PaymentCancel" => matches!(
payment_data.payment_intent.status,
storage_enums::IntentStatus::RequiresCapture
- | storage_enums::IntentStatus::PartiallyCaptured
+ | storage_enums::IntentStatus::PartiallyCapturedAndCapturable
),
"PaymentCapture" => {
matches!(
payment_data.payment_intent.status,
storage_enums::IntentStatus::RequiresCapture
- | storage_enums::IntentStatus::PartiallyCaptured
+ | storage_enums::IntentStatus::PartiallyCapturedAndCapturable
) || (matches!(
payment_data.payment_intent.status,
storage_enums::IntentStatus::Processing
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index b9e96ec36e..cd056f81eb 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -1579,7 +1579,7 @@ pub(crate) fn validate_status_with_capture_method(
}
utils::when(
status != storage_enums::IntentStatus::RequiresCapture
- && status != storage_enums::IntentStatus::PartiallyCaptured
+ && status != storage_enums::IntentStatus::PartiallyCapturedAndCapturable
&& status != storage_enums::IntentStatus::Processing,
|| {
Err(report!(errors::ApiErrorResponse::PaymentUnexpectedState {
@@ -2784,6 +2784,7 @@ pub fn get_attempt_type(
| enums::AttemptStatus::Pending
| enums::AttemptStatus::ConfirmationAwaited
| enums::AttemptStatus::PartialCharged
+ | enums::AttemptStatus::PartialChargedAndChargeable
| enums::AttemptStatus::Voided
| enums::AttemptStatus::AutoRefunded
| enums::AttemptStatus::PaymentMethodAwaited
@@ -2844,6 +2845,7 @@ pub fn get_attempt_type(
enums::IntentStatus::Cancelled
| enums::IntentStatus::RequiresCapture
| enums::IntentStatus::PartiallyCaptured
+ | enums::IntentStatus::PartiallyCapturedAndCapturable
| enums::IntentStatus::Processing
| enums::IntentStatus::Succeeded => {
Err(report!(errors::ApiErrorResponse::PreconditionFailed {
@@ -3023,6 +3025,7 @@ pub fn is_manual_retry_allowed(
| enums::AttemptStatus::Pending
| enums::AttemptStatus::ConfirmationAwaited
| enums::AttemptStatus::PartialCharged
+ | enums::AttemptStatus::PartialChargedAndChargeable
| enums::AttemptStatus::Voided
| enums::AttemptStatus::AutoRefunded
| enums::AttemptStatus::PaymentMethodAwaited
@@ -3042,6 +3045,7 @@ pub fn is_manual_retry_allowed(
enums::IntentStatus::Cancelled
| enums::IntentStatus::RequiresCapture
| enums::IntentStatus::PartiallyCaptured
+ | enums::IntentStatus::PartiallyCapturedAndCapturable
| enums::IntentStatus::Processing
| enums::IntentStatus::Succeeded => Some(false),
diff --git a/crates/router/src/core/payments/operations/payment_response.rs b/crates/router/src/core/payments/operations/payment_response.rs
index b55b0c46f6..1cfc37efa4 100644
--- a/crates/router/src/core/payments/operations/payment_response.rs
+++ b/crates/router/src/core/payments/operations/payment_response.rs
@@ -11,6 +11,7 @@ use tracing_futures::Instrument;
use super::{Operation, PostUpdateTracker};
use crate::{
+ connector::utils::PaymentResponseRouterData,
core::{
errors::{self, RouterResult, StorageErrorExt},
mandate,
@@ -26,7 +27,7 @@ use crate::{
self, enums,
payment_attempt::{AttemptStatusExt, PaymentAttemptExt},
},
- transformers::ForeignTryFrom,
+ transformers::{ForeignFrom, ForeignTryFrom},
CaptureSyncResponse,
},
utils,
@@ -389,7 +390,7 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
types::PreprocessingResponseId::ConnectorTransactionId(_) => None,
};
let payment_attempt_update = storage::PaymentAttemptUpdate::PreprocessingUpdate {
- status: router_data.status,
+ status: router_data.get_attempt_status_for_db_update(&payment_data),
payment_method_id: Some(router_data.payment_method_id),
connector_metadata,
preprocessing_step_id,
@@ -434,7 +435,7 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
utils::add_apple_pay_payment_status_metrics(
router_data.status,
- router_data.apple_pay_flow,
+ router_data.apple_pay_flow.clone(),
payment_data.payment_attempt.connector.clone(),
payment_data.payment_attempt.merchant_id.clone(),
);
@@ -456,7 +457,7 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
None => (
None,
Some(storage::PaymentAttemptUpdate::ResponseUpdate {
- status: router_data.status,
+ status: router_data.get_attempt_status_for_db_update(&payment_data),
connector: None,
connector_transaction_id: connector_transaction_id.clone(),
authentication_type: None,
@@ -504,7 +505,7 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
(
None,
Some(storage::PaymentAttemptUpdate::UnresolvedResponseUpdate {
- status: router_data.status,
+ status: router_data.get_attempt_status_for_db_update(&payment_data),
connector: None,
connector_transaction_id,
payment_method_id: Some(router_data.payment_method_id),
@@ -610,15 +611,15 @@ async fn payment_response_update_tracker<F: Clone, T: types::Capturable>(
let payment_intent_update = match &router_data.response {
Err(_) => storage::PaymentIntentUpdate::PGStatusUpdate {
- status: payment_data
- .payment_attempt
- .get_intent_status(payment_data.payment_intent.amount_captured),
+ status: api_models::enums::IntentStatus::foreign_from(
+ payment_data.payment_attempt.status,
+ ),
updated_by: storage_scheme.to_string(),
},
Ok(_) => storage::PaymentIntentUpdate::ResponseUpdate {
- status: payment_data
- .payment_attempt
- .get_intent_status(payment_data.payment_intent.amount_captured),
+ status: api_models::enums::IntentStatus::foreign_from(
+ payment_data.payment_attempt.status,
+ ),
return_url: router_data.return_url.clone(),
amount_captured,
updated_by: storage_scheme.to_string(),
diff --git a/crates/router/src/core/payments/retry.rs b/crates/router/src/core/payments/retry.rs
index 376b9048c8..788e83b05e 100644
--- a/crates/router/src/core/payments/retry.rs
+++ b/crates/router/src/core/payments/retry.rs
@@ -566,6 +566,7 @@ impl<F: Send + Clone + Sync, FData: Send + Sync>
| storage_enums::AttemptStatus::AutoRefunded
| storage_enums::AttemptStatus::CaptureFailed
| storage_enums::AttemptStatus::PartialCharged
+ | storage_enums::AttemptStatus::PartialChargedAndChargeable
| storage_enums::AttemptStatus::Pending
| storage_enums::AttemptStatus::PaymentMethodAwaited
| storage_enums::AttemptStatus::ConfirmationAwaited
diff --git a/crates/router/src/core/payments/types.rs b/crates/router/src/core/payments/types.rs
index f420a4b87a..5e150a33d5 100644
--- a/crates/router/src/core/payments/types.rs
+++ b/crates/router/src/core/payments/types.rs
@@ -116,7 +116,7 @@ impl MultipleCaptureData {
}
let status_count_map = self.get_status_count();
if status_count_map.get(&storage_enums::CaptureStatus::Charged) > Some(&0) {
- storage_enums::AttemptStatus::PartialCharged
+ storage_enums::AttemptStatus::PartialChargedAndChargeable
} else {
storage_enums::AttemptStatus::CaptureInitiated
}
diff --git a/crates/router/src/types/storage/payment_attempt.rs b/crates/router/src/types/storage/payment_attempt.rs
index 0b415e7165..a4fbcb0220 100644
--- a/crates/router/src/types/storage/payment_attempt.rs
+++ b/crates/router/src/types/storage/payment_attempt.rs
@@ -16,7 +16,6 @@ pub trait PaymentAttemptExt {
) -> RouterResult<CaptureNew>;
fn get_next_capture_id(&self) -> String;
- fn get_intent_status(&self, amount_captured: Option<i64>) -> enums::IntentStatus;
fn get_total_amount(&self) -> i64;
}
@@ -60,15 +59,6 @@ impl PaymentAttemptExt for PaymentAttempt {
format!("{}_{}", self.attempt_id.clone(), next_sequence_number)
}
- fn get_intent_status(&self, amount_captured: Option<i64>) -> enums::IntentStatus {
- let intent_status = enums::IntentStatus::foreign_from(self.status);
- if intent_status == enums::IntentStatus::Cancelled && amount_captured > Some(0) {
- enums::IntentStatus::Succeeded
- } else {
- intent_status
- }
- }
-
fn get_total_amount(&self) -> i64 {
self.amount + self.surcharge_amount.unwrap_or(0) + self.tax_amount.unwrap_or(0)
}
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index f43abdf73e..3ffba5aff5 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -86,6 +86,9 @@ impl ForeignFrom<storage_enums::AttemptStatus> for storage_enums::IntentStatus {
storage_enums::AttemptStatus::Unresolved => Self::RequiresMerchantAction,
storage_enums::AttemptStatus::PartialCharged => Self::PartiallyCaptured,
+ storage_enums::AttemptStatus::PartialChargedAndChargeable => {
+ Self::PartiallyCapturedAndCapturable
+ }
storage_enums::AttemptStatus::Started
| storage_enums::AttemptStatus::AuthenticationSuccessful
| storage_enums::AttemptStatus::Authorizing
@@ -135,7 +138,8 @@ impl ForeignTryFrom<storage_enums::AttemptStatus> for storage_enums::CaptureStat
| storage_enums::AttemptStatus::Unresolved
| storage_enums::AttemptStatus::PaymentMethodAwaited
| storage_enums::AttemptStatus::ConfirmationAwaited
- | storage_enums::AttemptStatus::DeviceDataCollectionPending => {
+ | storage_enums::AttemptStatus::DeviceDataCollectionPending
+ | storage_enums::AttemptStatus::PartialChargedAndChargeable=> {
Err(errors::ApiErrorResponse::PreconditionFailed {
message: "AttemptStatus must be one of these for multiple partial captures [Charged, PartialCharged, Pending, CaptureInitiated, Failure, CaptureFailed]".into(),
}.into())
@@ -414,7 +418,8 @@ impl ForeignFrom<api_enums::IntentStatus> for Option<storage_enums::EventType> {
api_enums::IntentStatus::RequiresPaymentMethod
| api_enums::IntentStatus::RequiresConfirmation
| api_enums::IntentStatus::RequiresCapture
- | api_enums::IntentStatus::PartiallyCaptured => None,
+ | api_enums::IntentStatus::PartiallyCaptured
+ | api_enums::IntentStatus::PartiallyCapturedAndCapturable => None,
}
}
}
diff --git a/migrations/2023-11-06-153840_introduce_new_attempt_and_intent_status/down.sql b/migrations/2023-11-06-153840_introduce_new_attempt_and_intent_status/down.sql
new file mode 100644
index 0000000000..c7c9cbeb40
--- /dev/null
+++ b/migrations/2023-11-06-153840_introduce_new_attempt_and_intent_status/down.sql
@@ -0,0 +1,2 @@
+-- This file should undo anything in `up.sql`
+SELECT 1;
\ No newline at end of file
diff --git a/migrations/2023-11-06-153840_introduce_new_attempt_and_intent_status/up.sql b/migrations/2023-11-06-153840_introduce_new_attempt_and_intent_status/up.sql
new file mode 100644
index 0000000000..5b9acbaca4
--- /dev/null
+++ b/migrations/2023-11-06-153840_introduce_new_attempt_and_intent_status/up.sql
@@ -0,0 +1,3 @@
+-- Your SQL goes here
+ALTER TYPE "IntentStatus" ADD VALUE IF NOT EXISTS 'partially_captured_and_capturable';
+ALTER TYPE "AttemptStatus" ADD VALUE IF NOT EXISTS 'partial_charged_and_chargeable';
\ No newline at end of file
diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json
index 9fddde01b4..55ff36c26f 100644
--- a/openapi/openapi_spec.json
+++ b/openapi/openapi_spec.json
@@ -2619,6 +2619,7 @@
"void_failed",
"auto_refunded",
"partial_charged",
+ "partial_charged_and_chargeable",
"unresolved",
"pending",
"failure",
@@ -6145,7 +6146,8 @@
"requires_payment_method",
"requires_confirmation",
"requires_capture",
- "partially_captured"
+ "partially_captured",
+ "partially_captured_and_capturable"
]
},
"JCSVoucherData": {
diff --git a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Cancel After Partial Capture/Payments - Cancel/event.test.js b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Cancel After Partial Capture/Payments - Cancel/event.test.js
index edeeb5a7b2..f5b74b41f5 100644
--- a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Cancel After Partial Capture/Payments - Cancel/event.test.js
+++ b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Cancel After Partial Capture/Payments - Cancel/event.test.js
@@ -53,9 +53,9 @@ if (jsonData?.client_secret) {
// Response body should have value "cancellation succeeded" for "payment status"
if (jsonData?.status) {
pm.test(
- "[POST]::/payments/:id/cancel - Content check if value for 'jsonData.status' matches 'succeeded'",
+ "[POST]::/payments/:id/cancel - Content check if value for 'jsonData.status' matches 'partially_captured'",
function () {
- pm.expect(jsonData.status).to.eql("succeeded");
+ pm.expect(jsonData.status).to.eql("partially_captured");
},
);
}
diff --git a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Cancel After Partial Capture/Payments - Capture/event.test.js b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Cancel After Partial Capture/Payments - Capture/event.test.js
index e6f49ae735..ea5c5df589 100644
--- a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Cancel After Partial Capture/Payments - Capture/event.test.js
+++ b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Cancel After Partial Capture/Payments - Capture/event.test.js
@@ -58,6 +58,16 @@ if (jsonData?.client_secret) {
);
}
+// Response body should have value "cancellation succeeded" for "payment status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id/cancel - Content check if value for 'jsonData.status' matches 'partially_captured_and_capturable'",
+ function () {
+ pm.expect(jsonData.status).to.eql("partially_captured_and_capturable");
+ },
+ );
+}
+
// Response body should have value "connector error" for "error type"
if (jsonData?.error?.type) {
pm.test(
diff --git a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Retrieve After Partial Capture/Payments - Capture/event.test.js b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Retrieve After Partial Capture/Payments - Capture/event.test.js
index e6f49ae735..af4bbc6187 100644
--- a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Retrieve After Partial Capture/Payments - Capture/event.test.js
+++ b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Retrieve After Partial Capture/Payments - Capture/event.test.js
@@ -67,3 +67,13 @@ if (jsonData?.error?.type) {
},
);
}
+
+// Response body should have value "cancellation succeeded" for "payment status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id/cancel - Content check if value for 'jsonData.status' matches 'partially_captured_and_capturable'",
+ function () {
+ pm.expect(jsonData.status).to.eql("partially_captured_and_capturable");
+ },
+ );
+}
\ No newline at end of file
diff --git a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Retrieve After Partial Capture/Payments - Retrieve-copy/event.test.js b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Retrieve After Partial Capture/Payments - Retrieve-copy/event.test.js
index 5e5839fa29..103f31cbb8 100644
--- a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Retrieve After Partial Capture/Payments - Retrieve-copy/event.test.js
+++ b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Retrieve After Partial Capture/Payments - Retrieve-copy/event.test.js
@@ -33,3 +33,13 @@ if (jsonData?.payment_id) {
"INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.",
);
}
+
+// Response body should have value "cancellation succeeded" for "payment status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id/cancel - Content check if value for 'jsonData.status' matches 'partially_captured_and_capturable'",
+ function () {
+ pm.expect(jsonData.status).to.eql("partially_captured_and_capturable");
+ },
+ );
+}
diff --git a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Retrieve After Partial Capture/Payments - Retrieve/event.test.js b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Retrieve After Partial Capture/Payments - Retrieve/event.test.js
index d0a02af743..6939cfa39d 100644
--- a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Retrieve After Partial Capture/Payments - Retrieve/event.test.js
+++ b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Retrieve After Partial Capture/Payments - Retrieve/event.test.js
@@ -59,3 +59,13 @@ if (jsonData?.client_secret) {
"INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
);
}
+
+// Response body should have value "cancellation succeeded" for "payment status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id/cancel - Content check if value for 'jsonData.status' matches 'requires_capture'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_capture");
+ },
+ );
+}
diff --git a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Successful Partial Capture and Refund/Payments - Capture - 1/event.test.js b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Successful Partial Capture and Refund/Payments - Capture - 1/event.test.js
index e6f49ae735..2c29f2cd35 100644
--- a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Successful Partial Capture and Refund/Payments - Capture - 1/event.test.js
+++ b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Successful Partial Capture and Refund/Payments - Capture - 1/event.test.js
@@ -67,3 +67,13 @@ if (jsonData?.error?.type) {
},
);
}
+
+// Response body should have value "cancellation succeeded" for "payment status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id/cancel - Content check if value for 'jsonData.status' matches 'partially_captured_and_capturable'",
+ function () {
+ pm.expect(jsonData.status).to.eql("partially_captured_and_capturable");
+ },
+ );
+}
diff --git a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Successful Partial Capture and Refund/Payments - Capture - 2/event.test.js b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Successful Partial Capture and Refund/Payments - Capture - 2/event.test.js
index e6f49ae735..2c29f2cd35 100644
--- a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Successful Partial Capture and Refund/Payments - Capture - 2/event.test.js
+++ b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Successful Partial Capture and Refund/Payments - Capture - 2/event.test.js
@@ -67,3 +67,13 @@ if (jsonData?.error?.type) {
},
);
}
+
+// Response body should have value "cancellation succeeded" for "payment status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id/cancel - Content check if value for 'jsonData.status' matches 'partially_captured_and_capturable'",
+ function () {
+ pm.expect(jsonData.status).to.eql("partially_captured_and_capturable");
+ },
+ );
+}
diff --git a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Successful Partial Capture and Refund/Payments - Capture - 3/event.test.js b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Successful Partial Capture and Refund/Payments - Capture - 3/event.test.js
index e6f49ae735..2d200c507f 100644
--- a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Successful Partial Capture and Refund/Payments - Capture - 3/event.test.js
+++ b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario10-Multiple Captures/Successful Partial Capture and Refund/Payments - Capture - 3/event.test.js
@@ -67,3 +67,13 @@ if (jsonData?.error?.type) {
},
);
}
+
+// Response body should have value "cancellation succeeded" for "payment status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments/:id/cancel - Content check if value for 'jsonData.status' matches 'succeeded'",
+ function () {
+ pm.expect(jsonData.status).to.eql("succeeded");
+ },
+ );
+}
diff --git a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario14-Save card payment with manual capture/Payments - Capture/event.test.js b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario14-Save card payment with manual capture/Payments - Capture/event.test.js
index 791a3bfbc3..d9ade9825b 100644
--- a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario14-Save card payment with manual capture/Payments - Capture/event.test.js
+++ b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario14-Save card payment with manual capture/Payments - Capture/event.test.js
@@ -66,9 +66,9 @@ if (jsonData?.client_secret) {
// Response body should have value "succeeded" for "status"
if (jsonData?.status) {
pm.test(
- "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'succeeded'",
+ "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'partially_captured'",
function () {
- pm.expect(jsonData.status).to.eql("succeeded");
+ pm.expect(jsonData.status).to.eql("partially_captured");
},
);
}
@@ -103,7 +103,7 @@ if (jsonData?.amount_capturable) {
pm.test(
"[post]:://payments/:id/capture - Content check if value for 'amount_capturable' matches 'amount - 540'",
function () {
- pm.expect(jsonData.amount_capturable).to.eql(6540);
+ pm.expect(jsonData.amount_capturable).to.eql(540);
},
);
}
diff --git a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario14-Save card payment with manual capture/Payments - Retrieve-copy/event.test.js b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario14-Save card payment with manual capture/Payments - Retrieve-copy/event.test.js
index 22f7c74b5d..ae68f8b793 100644
--- a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario14-Save card payment with manual capture/Payments - Retrieve-copy/event.test.js
+++ b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario14-Save card payment with manual capture/Payments - Retrieve-copy/event.test.js
@@ -63,9 +63,9 @@ if (jsonData?.client_secret) {
// Response body should have value "Succeeded" for "status"
if (jsonData?.status) {
pm.test(
- "[POST]::/payments/:id - Content check if value for 'status' matches 'succeeded'",
+ "[POST]::/payments/:id - Content check if value for 'status' matches 'partially_captured'",
function () {
- pm.expect(jsonData.status).to.eql("succeeded");
+ pm.expect(jsonData.status).to.eql("partially_captured");
},
);
}
diff --git a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture with confirm false/Payments - Capture/event.test.js b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture with confirm false/Payments - Capture/event.test.js
index fc1ed092f8..d9ade9825b 100644
--- a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture with confirm false/Payments - Capture/event.test.js
+++ b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture with confirm false/Payments - Capture/event.test.js
@@ -66,9 +66,9 @@ if (jsonData?.client_secret) {
// Response body should have value "succeeded" for "status"
if (jsonData?.status) {
pm.test(
- "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'succeeded'",
+ "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'partially_captured'",
function () {
- pm.expect(jsonData.status).to.eql("succeeded");
+ pm.expect(jsonData.status).to.eql("partially_captured");
},
);
}
diff --git a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture with confirm false/Payments - Retrieve/event.test.js b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture with confirm false/Payments - Retrieve/event.test.js
index cea10167eb..c22795a2d4 100644
--- a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture with confirm false/Payments - Retrieve/event.test.js
+++ b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture with confirm false/Payments - Retrieve/event.test.js
@@ -63,9 +63,9 @@ if (jsonData?.client_secret) {
// Response body should have value "succeeded" for "status"
if (jsonData?.status) {
pm.test(
- "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ "[POST]::/payments - Content check if value for 'status' matches 'partially_captured'",
function () {
- pm.expect(jsonData.status).to.eql("succeeded");
+ pm.expect(jsonData.status).to.eql("partially_captured");
},
);
}
diff --git a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario6-Create Partial Capture payment/Payments - Capture/event.test.js b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario6-Create Partial Capture payment/Payments - Capture/event.test.js
index fc1ed092f8..d9ade9825b 100644
--- a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario6-Create Partial Capture payment/Payments - Capture/event.test.js
+++ b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario6-Create Partial Capture payment/Payments - Capture/event.test.js
@@ -66,9 +66,9 @@ if (jsonData?.client_secret) {
// Response body should have value "succeeded" for "status"
if (jsonData?.status) {
pm.test(
- "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'succeeded'",
+ "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'partially_captured'",
function () {
- pm.expect(jsonData.status).to.eql("succeeded");
+ pm.expect(jsonData.status).to.eql("partially_captured");
},
);
}
diff --git a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario6-Create Partial Capture payment/Payments - Retrieve/event.test.js b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario6-Create Partial Capture payment/Payments - Retrieve/event.test.js
index cea10167eb..c22795a2d4 100644
--- a/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario6-Create Partial Capture payment/Payments - Retrieve/event.test.js
+++ b/postman/collection-dir/checkout/Flow Testcases/Happy Cases/Scenario6-Create Partial Capture payment/Payments - Retrieve/event.test.js
@@ -63,9 +63,9 @@ if (jsonData?.client_secret) {
// Response body should have value "succeeded" for "status"
if (jsonData?.status) {
pm.test(
- "[POST]::/payments - Content check if value for 'status' matches 'succeeded'",
+ "[POST]::/payments - Content check if value for 'status' matches 'partially_captured'",
function () {
- pm.expect(jsonData.status).to.eql("succeeded");
+ pm.expect(jsonData.status).to.eql("partially_captured");
},
);
}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Payments - Capture/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Payments - Capture/event.test.js
index 8fd96aaddc..ee01079cab 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Payments - Capture/event.test.js
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Payments - Capture/event.test.js
@@ -91,9 +91,9 @@ if (jsonData?.amount) {
// Response body should have value "6000" 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 '6540'",
function () {
- pm.expect(jsonData.amount_received).to.eql(6000);
+ pm.expect(jsonData.amount_received).to.eql(6540);
},
);
}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Payments - Capture/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Payments - Capture/request.json
index 8975575ca4..8efb99d3c9 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Payments - Capture/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Payments - Capture/request.json
@@ -18,7 +18,7 @@
}
},
"raw_json_formatted": {
- "amount_to_capture": 6000,
+ "amount_to_capture": 6540,
"statement_descriptor_name": "Joseph",
"statement_descriptor_suffix": "JS"
}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Payments - Retrieve-copy/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Payments - Retrieve-copy/event.test.js
index a3c023cb7e..0095c8cf19 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Payments - Retrieve-copy/event.test.js
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario26-Save card payment with manual capture/Payments - Retrieve-copy/event.test.js
@@ -88,9 +88,9 @@ if (jsonData?.amount) {
// Response body should have value "6000" 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 '6540'",
function () {
- pm.expect(jsonData.amount_received).to.eql(6000);
+ pm.expect(jsonData.amount_received).to.eql(6540);
},
);
}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/event.test.js
index 2d7dbc507f..b9d5ecb464 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/event.test.js
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/event.test.js
@@ -86,9 +86,9 @@ if (jsonData?.amount) {
// Response body should have value "6000" 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 '6540'",
function () {
- pm.expect(jsonData.amount_received).to.eql(6000);
+ pm.expect(jsonData.amount_received).to.eql(6540);
},
);
}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/request.json
index 9fe257ed85..cceb2b55f0 100644
--- a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/request.json
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with Manual capture/Payments - Capture/request.json
@@ -18,7 +18,7 @@
}
},
"raw_json_formatted": {
- "amount_to_capture": 6000,
+ "amount_to_capture": 6540,
"statement_descriptor_name": "Joseph",
"statement_descriptor_suffix": "JS"
}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/.meta.json
new file mode 100644
index 0000000000..e4ef30e39e
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/.meta.json
@@ -0,0 +1,7 @@
+{
+ "childrenOrder": [
+ "Payments - Create",
+ "Payments - Capture",
+ "Payments - Retrieve"
+ ]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Capture/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Capture/.event.meta.json
new file mode 100644
index 0000000000..0731450e6b
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Capture/.event.meta.json
@@ -0,0 +1,3 @@
+{
+ "eventOrder": ["event.test.js"]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Capture/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Capture/event.test.js
new file mode 100644
index 0000000000..f560d84ea7
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Capture/event.test.js
@@ -0,0 +1,94 @@
+// Validate status 2xx
+pm.test("[POST]::/payments/:id/capture - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test(
+ "[POST]::/payments/:id/capture - Content-Type is application/json",
+ function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+ },
+);
+
+// Validate if response has JSON Body
+pm.test("[POST]::/payments/:id/capture - Response has JSON Body", function () {
+ pm.response.to.have.jsonBody();
+});
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) {}
+
+// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
+if (jsonData?.payment_id) {
+ pm.collectionVariables.set("payment_id", jsonData.payment_id);
+ console.log(
+ "- use {{payment_id}} as collection variable for value",
+ jsonData.payment_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]:://payments/:id/capture - Content check if value for 'status' matches 'partially_captured'",
+ function () {
+ pm.expect(jsonData.status).to.eql("partially_captured");
+ },
+ );
+}
+
+// Response body should have value "6540" for "amount"
+if (jsonData?.amount) {
+ pm.test(
+ "[post]:://payments/:id/capture - Content check if value for 'amount' matches '6540'",
+ function () {
+ pm.expect(jsonData.amount).to.eql(6540);
+ },
+ );
+}
+
+// Response body should have value "6000" for "amount_received"
+if (jsonData?.amount_received) {
+ pm.test(
+ "[POST]::/payments:id/capture - Content check if value for 'amount_received' matches '6000'",
+ function () {
+ pm.expect(jsonData.amount_received).to.eql(6000);
+ },
+ );
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Capture/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Capture/request.json
new file mode 100644
index 0000000000..9fe257ed85
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Capture/request.json
@@ -0,0 +1,39 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "amount_to_capture": 6000,
+ "statement_descriptor_name": "Joseph",
+ "statement_descriptor_suffix": "JS"
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id/capture",
+ "host": ["{{baseUrl}}"],
+ "path": ["payments", ":id", "capture"],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To capture the funds for an uncaptured payment"
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Capture/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Capture/response.json
new file mode 100644
index 0000000000..fe51488c70
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Capture/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Create/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Create/.event.meta.json
new file mode 100644
index 0000000000..0731450e6b
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Create/.event.meta.json
@@ -0,0 +1,3 @@
+{
+ "eventOrder": ["event.test.js"]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Create/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Create/event.test.js
new file mode 100644
index 0000000000..d683186aa0
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Create/event.test.js
@@ -0,0 +1,71 @@
+// Validate status 2xx
+pm.test("[POST]::/payments - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[POST]::/payments - Content-Type is application/json", function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+});
+
+// Validate if response has JSON Body
+pm.test("[POST]::/payments - Response has JSON Body", function () {
+ pm.response.to.have.jsonBody();
+});
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) {}
+
+// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
+if (jsonData?.payment_id) {
+ pm.collectionVariables.set("payment_id", jsonData.payment_id);
+ console.log(
+ "- use {{payment_id}} as collection variable for value",
+ jsonData.payment_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "requires_capture" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'requires_capture'",
+ function () {
+ pm.expect(jsonData.status).to.eql("requires_capture");
+ },
+ );
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Create/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Create/request.json
new file mode 100644
index 0000000000..0619498e38
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Create/request.json
@@ -0,0 +1,88 @@
+{
+ "method": "POST",
+ "header": [
+ {
+ "key": "Content-Type",
+ "value": "application/json"
+ },
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "body": {
+ "mode": "raw",
+ "options": {
+ "raw": {
+ "language": "json"
+ }
+ },
+ "raw_json_formatted": {
+ "amount": 6540,
+ "currency": "USD",
+ "confirm": true,
+ "capture_method": "manual",
+ "capture_on": "2022-09-10T10:11:12Z",
+ "amount_to_capture": 6540,
+ "customer_id": "StripeCustomer",
+ "email": "[email protected]",
+ "name": "John Doe",
+ "phone": "999999999",
+ "phone_country_code": "+65",
+ "description": "Its my first payment request",
+ "authentication_type": "no_three_ds",
+ "return_url": "https://duck.com",
+ "payment_method": "card",
+ "payment_method_data": {
+ "card": {
+ "card_number": "4242424242424242",
+ "card_exp_month": "10",
+ "card_exp_year": "25",
+ "card_holder_name": "joseph Doe",
+ "card_cvc": "123"
+ }
+ },
+ "billing": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "sundari"
+ }
+ },
+ "shipping": {
+ "address": {
+ "line1": "1467",
+ "line2": "Harrison Street",
+ "line3": "Harrison Street",
+ "city": "San Fransico",
+ "state": "California",
+ "zip": "94122",
+ "country": "US",
+ "first_name": "sundari"
+ }
+ },
+ "statement_descriptor_name": "joseph",
+ "statement_descriptor_suffix": "JS",
+ "metadata": {
+ "udf1": "value1",
+ "new_customer": "true",
+ "login_date": "2019-09-10T10:11:12Z"
+ },
+ "routing": {
+ "type": "single",
+ "data": "stripe"
+ }
+ }
+ },
+ "url": {
+ "raw": "{{baseUrl}}/payments",
+ "host": ["{{baseUrl}}"],
+ "path": ["payments"]
+ },
+ "description": "To process a payment you will have to create a payment, attach a payment method and confirm. Depending on the user journey you wish to achieve, you may opt to all the steps in a single request or in a sequence of API request using following APIs: (i) Payments - Update, (ii) Payments - Confirm, and (iii) Payments - Capture"
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Create/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Create/response.json
new file mode 100644
index 0000000000..fe51488c70
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Create/response.json
@@ -0,0 +1 @@
+[]
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Retrieve/.event.meta.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Retrieve/.event.meta.json
new file mode 100644
index 0000000000..0731450e6b
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Retrieve/.event.meta.json
@@ -0,0 +1,3 @@
+{
+ "eventOrder": ["event.test.js"]
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Retrieve/event.test.js b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Retrieve/event.test.js
new file mode 100644
index 0000000000..ca68dd7045
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Retrieve/event.test.js
@@ -0,0 +1,71 @@
+// Validate status 2xx
+pm.test("[GET]::/payments/:id - Status code is 2xx", function () {
+ pm.response.to.be.success;
+});
+
+// Validate if response header has matching content-type
+pm.test("[GET]::/payments/:id - Content-Type is application/json", function () {
+ pm.expect(pm.response.headers.get("Content-Type")).to.include(
+ "application/json",
+ );
+});
+
+// Validate if response has JSON Body
+pm.test("[GET]::/payments/:id - Response has JSON Body", function () {
+ pm.response.to.have.jsonBody();
+});
+
+// Set response object as internal variable
+let jsonData = {};
+try {
+ jsonData = pm.response.json();
+} catch (e) {}
+
+// pm.collectionVariables - Set payment_id as variable for jsonData.payment_id
+if (jsonData?.payment_id) {
+ pm.collectionVariables.set("payment_id", jsonData.payment_id);
+ console.log(
+ "- use {{payment_id}} as collection variable for value",
+ jsonData.payment_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{payment_id}}, as jsonData.payment_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set mandate_id as variable for jsonData.mandate_id
+if (jsonData?.mandate_id) {
+ pm.collectionVariables.set("mandate_id", jsonData.mandate_id);
+ console.log(
+ "- use {{mandate_id}} as collection variable for value",
+ jsonData.mandate_id,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{mandate_id}}, as jsonData.mandate_id is undefined.",
+ );
+}
+
+// pm.collectionVariables - Set client_secret as variable for jsonData.client_secret
+if (jsonData?.client_secret) {
+ pm.collectionVariables.set("client_secret", jsonData.client_secret);
+ console.log(
+ "- use {{client_secret}} as collection variable for value",
+ jsonData.client_secret,
+ );
+} else {
+ console.log(
+ "INFO - Unable to assign variable {{client_secret}}, as jsonData.client_secret is undefined.",
+ );
+}
+
+// Response body should have value "succeeded" for "status"
+if (jsonData?.status) {
+ pm.test(
+ "[POST]::/payments - Content check if value for 'status' matches 'partially_captured'",
+ function () {
+ pm.expect(jsonData.status).to.eql("partially_captured");
+ },
+ );
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Retrieve/request.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Retrieve/request.json
new file mode 100644
index 0000000000..6cd4b7d96c
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Retrieve/request.json
@@ -0,0 +1,28 @@
+{
+ "method": "GET",
+ "header": [
+ {
+ "key": "Accept",
+ "value": "application/json"
+ }
+ ],
+ "url": {
+ "raw": "{{baseUrl}}/payments/:id?force_sync=true",
+ "host": ["{{baseUrl}}"],
+ "path": ["payments", ":id"],
+ "query": [
+ {
+ "key": "force_sync",
+ "value": "true"
+ }
+ ],
+ "variable": [
+ {
+ "key": "id",
+ "value": "{{payment_id}}",
+ "description": "(Required) unique payment id"
+ }
+ ]
+ },
+ "description": "To retrieve the properties of a Payment. This may be used to get the status of a previously initiated payment or next action for an ongoing payment"
+}
diff --git a/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Retrieve/response.json b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Retrieve/response.json
new file mode 100644
index 0000000000..fe51488c70
--- /dev/null
+++ b/postman/collection-dir/stripe/Flow Testcases/Happy Cases/Scenario4-Create payment with manual_multiple capture/Payments - Retrieve/response.json
@@ -0,0 +1 @@
+[]