mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-04 05:59:48 +08:00
feat(compatibility): add refund retrieve endpoint which accepts gateway creds (#958)
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -3846,7 +3846,7 @@ checksum = "bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.11",
|
"syn 2.0.15",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@ -40,6 +40,7 @@ impl Refunds {
|
|||||||
.service(refund_create)
|
.service(refund_create)
|
||||||
.service(refund_retrieve)
|
.service(refund_retrieve)
|
||||||
.service(refund_update)
|
.service(refund_update)
|
||||||
|
.service(refund_retrieve_with_gateway_creds)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -49,6 +49,47 @@ pub async fn refund_create(
|
|||||||
.await
|
.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)]
|
#[instrument(skip_all)]
|
||||||
#[get("/{refund_id}")]
|
#[get("/{refund_id}")]
|
||||||
pub async fn refund_retrieve(
|
pub async fn refund_retrieve(
|
||||||
|
|||||||
Reference in New Issue
Block a user