mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 12:06:56 +08:00
feat(connector): [Coinbase] [Opennode] Add support for crypto payments via PG redirection (#834)
Co-authored-by: arvindpatel24 <arvind.patel@juspay.in> Co-authored-by: Jagan Elavarasan <jaganelavarasan@gmail.com>
This commit is contained in:
@ -51,6 +51,7 @@ pub enum AttemptStatus {
|
||||
VoidFailed,
|
||||
AutoRefunded,
|
||||
PartialCharged,
|
||||
Unresolved,
|
||||
#[default]
|
||||
Pending,
|
||||
Failure,
|
||||
@ -317,6 +318,8 @@ pub enum EventObjectType {
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
pub enum EventType {
|
||||
PaymentSucceeded,
|
||||
PaymentProcessing,
|
||||
ActionRequired,
|
||||
RefundSucceeded,
|
||||
RefundFailed,
|
||||
DisputeOpened,
|
||||
@ -350,6 +353,7 @@ pub enum IntentStatus {
|
||||
Cancelled,
|
||||
Processing,
|
||||
RequiresCustomerAction,
|
||||
RequiresMerchantAction,
|
||||
RequiresPaymentMethod,
|
||||
#[default]
|
||||
RequiresConfirmation,
|
||||
@ -450,6 +454,7 @@ pub enum PaymentMethod {
|
||||
PayLater,
|
||||
Wallet,
|
||||
BankRedirect,
|
||||
Crypto,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
@ -618,6 +623,7 @@ pub enum PaymentMethodType {
|
||||
GooglePay,
|
||||
ApplePay,
|
||||
Paypal,
|
||||
CryptoCurrency,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
|
||||
@ -135,6 +135,16 @@ pub enum PaymentAttemptUpdate {
|
||||
payment_method_id: Option<Option<String>>,
|
||||
mandate_id: Option<String>,
|
||||
connector_metadata: Option<serde_json::Value>,
|
||||
error_code: Option<Option<String>>,
|
||||
error_message: Option<Option<String>>,
|
||||
},
|
||||
UnresolvedResponseUpdate {
|
||||
status: storage_enums::AttemptStatus,
|
||||
connector: Option<serde_json::Value>,
|
||||
connector_transaction_id: Option<String>,
|
||||
payment_method_id: Option<Option<String>>,
|
||||
error_code: Option<Option<String>>,
|
||||
error_message: Option<Option<String>>,
|
||||
},
|
||||
StatusUpdate {
|
||||
status: storage_enums::AttemptStatus,
|
||||
@ -142,8 +152,8 @@ pub enum PaymentAttemptUpdate {
|
||||
ErrorUpdate {
|
||||
connector: Option<serde_json::Value>,
|
||||
status: storage_enums::AttemptStatus,
|
||||
error_code: Option<String>,
|
||||
error_message: Option<String>,
|
||||
error_code: Option<Option<String>>,
|
||||
error_message: Option<Option<String>>,
|
||||
},
|
||||
}
|
||||
|
||||
@ -157,14 +167,14 @@ pub struct PaymentAttemptUpdateInternal {
|
||||
connector: Option<serde_json::Value>,
|
||||
authentication_type: Option<storage_enums::AuthenticationType>,
|
||||
payment_method: Option<storage_enums::PaymentMethod>,
|
||||
error_message: Option<String>,
|
||||
error_message: Option<Option<String>>,
|
||||
payment_method_id: Option<Option<String>>,
|
||||
cancellation_reason: Option<String>,
|
||||
modified_at: Option<PrimitiveDateTime>,
|
||||
mandate_id: Option<String>,
|
||||
browser_info: Option<serde_json::Value>,
|
||||
payment_token: Option<String>,
|
||||
error_code: Option<String>,
|
||||
error_code: Option<Option<String>>,
|
||||
connector_metadata: Option<serde_json::Value>,
|
||||
payment_method_data: Option<serde_json::Value>,
|
||||
payment_method_type: Option<storage_enums::PaymentMethodType>,
|
||||
@ -184,7 +194,7 @@ impl PaymentAttemptUpdate {
|
||||
.or(pa_update.connector_transaction_id),
|
||||
authentication_type: pa_update.authentication_type.or(source.authentication_type),
|
||||
payment_method: pa_update.payment_method.or(source.payment_method),
|
||||
error_message: pa_update.error_message.or(source.error_message),
|
||||
error_message: pa_update.error_message.unwrap_or(source.error_message),
|
||||
payment_method_id: pa_update
|
||||
.payment_method_id
|
||||
.unwrap_or(source.payment_method_id),
|
||||
@ -274,6 +284,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
|
||||
payment_method_id,
|
||||
mandate_id,
|
||||
connector_metadata,
|
||||
error_code,
|
||||
error_message,
|
||||
} => Self {
|
||||
status: Some(status),
|
||||
connector,
|
||||
@ -283,6 +295,8 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
|
||||
modified_at: Some(common_utils::date_time::now()),
|
||||
mandate_id,
|
||||
connector_metadata,
|
||||
error_code,
|
||||
error_message,
|
||||
..Default::default()
|
||||
},
|
||||
PaymentAttemptUpdate::ErrorUpdate {
|
||||
@ -310,6 +324,23 @@ impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
|
||||
connector,
|
||||
..Default::default()
|
||||
},
|
||||
PaymentAttemptUpdate::UnresolvedResponseUpdate {
|
||||
status,
|
||||
connector,
|
||||
connector_transaction_id,
|
||||
payment_method_id,
|
||||
error_code,
|
||||
error_message,
|
||||
} => Self {
|
||||
status: Some(status),
|
||||
connector,
|
||||
connector_transaction_id,
|
||||
payment_method_id,
|
||||
modified_at: Some(common_utils::date_time::now()),
|
||||
error_code,
|
||||
error_message,
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -265,6 +265,7 @@ fn make_client_secret_null_based_on_status(
|
||||
| storage_enums::IntentStatus::Cancelled => Some(None),
|
||||
storage_enums::IntentStatus::Processing
|
||||
| storage_enums::IntentStatus::RequiresCustomerAction
|
||||
| storage_enums::IntentStatus::RequiresMerchantAction
|
||||
| storage_enums::IntentStatus::RequiresPaymentMethod
|
||||
| storage_enums::IntentStatus::RequiresConfirmation
|
||||
| storage_enums::IntentStatus::RequiresCapture => None,
|
||||
|
||||
Reference in New Issue
Block a user