mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 01:27:31 +08:00
feat: delete customer data in compliance with GDPR regulations (#64)
This commit is contained in:
@ -111,9 +111,7 @@ pub async fn customer_delete(
|
||||
&state,
|
||||
&req,
|
||||
payload,
|
||||
|state, merchant_account, req| {
|
||||
customers::delete_customer(&*state.store, merchant_account, req)
|
||||
},
|
||||
customers::delete_customer,
|
||||
api::MerchantAuthentication::ApiKey,
|
||||
)
|
||||
.await
|
||||
|
||||
@ -104,7 +104,7 @@ impl From<api::CustomerDeleteResponse> for CustomerDeleteResponse {
|
||||
fn from(cust: api::CustomerDeleteResponse) -> Self {
|
||||
Self {
|
||||
id: cust.customer_id,
|
||||
deleted: cust.deleted,
|
||||
deleted: cust.customer_deleted,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,6 +55,12 @@ pub(crate) enum ErrorCode {
|
||||
#[error(error_type = StripeErrorType::ApiError, code = "internal_server_error", message = "Server is down")]
|
||||
DuplicateRefundRequest,
|
||||
|
||||
#[error(error_type = StripeErrorType::InvalidRequestError, code = "active_mandate", message = "Customer has active mandate")]
|
||||
MandateActive,
|
||||
|
||||
#[error(error_type = StripeErrorType::InvalidRequestError, code = "customer_redacted", message = "Customer has redacted")]
|
||||
CustomerRedacted,
|
||||
|
||||
#[error(error_type = StripeErrorType::InvalidRequestError, code = "resource_missing", message = "No such refund")]
|
||||
RefundNotFound,
|
||||
|
||||
@ -340,6 +346,8 @@ impl From<ApiErrorResponse> for ErrorCode {
|
||||
ApiErrorResponse::RefundFailed { data } => ErrorCode::RefundFailed, // Nothing at stripe to map
|
||||
|
||||
ApiErrorResponse::InternalServerError => ErrorCode::InternalServerError, // not a stripe code
|
||||
ApiErrorResponse::MandateActive => ErrorCode::MandateActive, //not a stripe code
|
||||
ApiErrorResponse::CustomerRedacted => ErrorCode::CustomerRedacted, //not a stripe code
|
||||
ApiErrorResponse::DuplicateRefundRequest => ErrorCode::DuplicateRefundRequest,
|
||||
ApiErrorResponse::RefundNotFound => ErrorCode::RefundNotFound,
|
||||
ApiErrorResponse::CustomerNotFound => ErrorCode::CustomerNotFound,
|
||||
@ -433,9 +441,10 @@ impl actix_web::ResponseError for ErrorCode {
|
||||
| ErrorCode::ResourceIdNotFound
|
||||
| ErrorCode::PaymentIntentMandateInvalid { .. }
|
||||
| ErrorCode::PaymentIntentUnexpectedState { .. } => StatusCode::BAD_REQUEST,
|
||||
ErrorCode::RefundFailed | ErrorCode::InternalServerError => {
|
||||
StatusCode::INTERNAL_SERVER_ERROR
|
||||
}
|
||||
ErrorCode::RefundFailed
|
||||
| ErrorCode::InternalServerError
|
||||
| ErrorCode::MandateActive
|
||||
| ErrorCode::CustomerRedacted => StatusCode::INTERNAL_SERVER_ERROR,
|
||||
ErrorCode::ReturnUrlUnavailable => StatusCode::SERVICE_UNAVAILABLE,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user