Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6987b9e
feat: create payout webhook flow
Sakilmostak May 17, 2024
cc3acce
feat: add payout webhooks to adyen
Sakilmostak May 19, 2024
83b317c
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] May 19, 2024
5707288
refactor: resolve ci checks
Sakilmostak May 19, 2024
a500203
refactor: resolve msrv check
Sakilmostak May 19, 2024
8457acb
refactor: use payout_attempt_id as connector_request_reference_id
Sakilmostak May 20, 2024
2c8d279
refactor: add necessary feature flags
Sakilmostak May 27, 2024
730f7cd
Merge branch 'main' into payouts_webhook
Sakilmostak May 27, 2024
e06c78a
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] May 27, 2024
3d062e4
refactor: resolve ci checks
Sakilmostak May 27, 2024
db57662
refactor: comments
Sakilmostak May 27, 2024
834a394
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] May 27, 2024
7c8a896
refactor: add feature flags to enums
Sakilmostak May 29, 2024
0f1f62f
refactor: merge main
Sakilmostak May 30, 2024
d68e801
refactor: resolve conflict with main
Sakilmostak May 30, 2024
a6e46bf
feat: add reference id in the response
Sakilmostak May 31, 2024
834787e
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] May 31, 2024
94f8ea2
refactor: convert created to intiated
Sakilmostak May 31, 2024
db98a7b
chore: run formatter
hyperswitch-bot[bot] May 31, 2024
322e980
docs(openapi): re-generate OpenAPI specification
hyperswitch-bot[bot] May 31, 2024
a7c466f
refactor: spell check
Sakilmostak Jun 4, 2024
e4bfb1d
refactor: resolve clippy
Sakilmostak Jun 4, 2024
feb8653
refactor: feature flag for AppState
Sakilmostak Jun 4, 2024
22733ca
Merge branch 'main' into payouts_webhook
Sakilmostak Jun 4, 2024
407f17c
refactor: resolve conflict with main
Sakilmostak Jun 4, 2024
aeeb8e5
Merge branch 'payouts_webhook' into add_reference_to_payout
Sakilmostak Jun 4, 2024
c4ac186
Merge branch 'main' into add_reference_to_payout
Sakilmostak Jun 5, 2024
4ed3f0f
refactor: resolve conflict with main
Sakilmostak Jun 5, 2024
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
4 changes: 4 additions & 0 deletions crates/api_models/src/payouts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,10 @@ pub struct PayoutCreateResponse {
#[schema(value_type = Option<Vec<PayoutAttemptResponse>>)]
#[serde(skip_serializing_if = "Option::is_none")]
pub attempts: Option<Vec<PayoutAttemptResponse>>,

/// The reference id to check payout in the connector's dashboard
#[schema(value_type = String, example = "50c90b09-11d2-4c97-ab5c-42e336e7506c")]
pub reference_id: Option<String>,
}

#[derive(
Expand Down
7 changes: 5 additions & 2 deletions crates/router/src/core/payments/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ impl ForeignFrom<(storage::Payouts, storage::PayoutAttempt, domain::Customer)>
fn foreign_from(item: (storage::Payouts, storage::PayoutAttempt, domain::Customer)) -> Self {
let (payout, payout_attempt, customer) = item;
let attempt = PayoutAttemptResponse {
attempt_id: payout_attempt.payout_attempt_id,
attempt_id: payout_attempt.payout_attempt_id.clone(),
status: payout_attempt.status,
amount: payout.amount,
currency: Some(payout.destination_currency),
Expand All @@ -985,7 +985,7 @@ impl ForeignFrom<(storage::Payouts, storage::PayoutAttempt, domain::Customer)>
error_message: payout_attempt.error_message.clone(),
payment_method: Some(payout.payout_type),
payout_method_type: None,
connector_transaction_id: payout_attempt.connector_payout_id,
connector_transaction_id: payout_attempt.connector_payout_id.clone(),
cancellation_reason: None,
unified_code: None,
unified_message: None,
Expand Down Expand Up @@ -1019,6 +1019,9 @@ impl ForeignFrom<(storage::Payouts, storage::PayoutAttempt, domain::Customer)>
attempts: Some(attempts),
billing: None,
client_secret: None,
reference_id: payout_attempt
.connector_payout_id
.or(Some(payout_attempt.payout_attempt_id)),
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions crates/router/src/core/payouts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1869,6 +1869,11 @@ pub async fn response_handler(
}
});

let reference_id = payout_attempt
.connector_payout_id
.clone()
.or(Some(payout_attempt.payout_attempt_id));

let response = api::PayoutCreateResponse {
payout_id: payouts.payout_id.to_owned(),
merchant_id: merchant_account.merchant_id.to_owned(),
Expand Down Expand Up @@ -1897,6 +1902,7 @@ pub async fn response_handler(
profile_id: payout_attempt.profile_id,
created: Some(payouts.created_at),
attempts: None,
reference_id,
};
Ok(services::ApplicationResponse::Json(response))
}
Expand Down
8 changes: 7 additions & 1 deletion openapi/openapi_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -16524,7 +16524,8 @@
"status",
"error_message",
"error_code",
"profile_id"
"profile_id",
"reference_id"
],
"properties": {
"payout_id": {
Expand Down Expand Up @@ -16672,6 +16673,11 @@
},
"description": "List of attempts",
"nullable": true
},
"reference_id": {
"type": "string",
"description": "The reference id to check payout in the connector's dashboard",
"example": "50c90b09-11d2-4c97-ab5c-42e336e7506c"
}
},
"additionalProperties": false
Expand Down