mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-01 11:06:50 +08:00
feat(compatibility): add refund retrieve endpoint which accepts gateway creds (#958)
This commit is contained in:
@ -40,6 +40,7 @@ impl Refunds {
|
||||
.service(refund_create)
|
||||
.service(refund_retrieve)
|
||||
.service(refund_update)
|
||||
.service(refund_retrieve_with_gateway_creds)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -49,6 +49,47 @@ pub async fn refund_create(
|
||||
.await
|
||||
}
|
||||
|
||||
#[instrument(skip_all)]
|
||||
#[post("/sync")]
|
||||
pub async fn refund_retrieve_with_gateway_creds(
|
||||
state: web::Data<routes::AppState>,
|
||||
qs_config: web::Data<serde_qs::Config>,
|
||||
req: HttpRequest,
|
||||
form_payload: web::Bytes,
|
||||
) -> HttpResponse {
|
||||
let refund_request = match qs_config
|
||||
.deserialize_bytes(&form_payload)
|
||||
.map_err(|err| report!(errors::StripeErrorCode::from(err)))
|
||||
{
|
||||
Ok(payload) => payload,
|
||||
Err(err) => return api::log_and_return_error_response(err),
|
||||
};
|
||||
wrap::compatibility_api_wrap::<
|
||||
_,
|
||||
_,
|
||||
_,
|
||||
_,
|
||||
_,
|
||||
_,
|
||||
types::StripeRefundResponse,
|
||||
errors::StripeErrorCode,
|
||||
>(
|
||||
state.get_ref(),
|
||||
&req,
|
||||
refund_request,
|
||||
|state, merchant_account, refund_request| {
|
||||
refunds::refund_response_wrapper(
|
||||
state,
|
||||
merchant_account,
|
||||
refund_request,
|
||||
refunds::refund_retrieve_core,
|
||||
)
|
||||
},
|
||||
&auth::ApiKeyAuth,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
#[instrument(skip_all)]
|
||||
#[get("/{refund_id}")]
|
||||
pub async fn refund_retrieve(
|
||||
|
||||
Reference in New Issue
Block a user