mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 00:49:42 +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:
@ -34,6 +34,7 @@ pub enum AttemptStatus {
|
||||
VoidFailed,
|
||||
AutoRefunded,
|
||||
PartialCharged,
|
||||
Unresolved,
|
||||
#[default]
|
||||
Pending,
|
||||
Failure,
|
||||
@ -266,6 +267,8 @@ pub enum Currency {
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
pub enum EventType {
|
||||
PaymentSucceeded,
|
||||
PaymentProcessing,
|
||||
ActionRequired,
|
||||
RefundSucceeded,
|
||||
RefundFailed,
|
||||
DisputeOpened,
|
||||
@ -299,6 +302,7 @@ pub enum IntentStatus {
|
||||
Cancelled,
|
||||
Processing,
|
||||
RequiresCustomerAction,
|
||||
RequiresMerchantAction,
|
||||
RequiresPaymentMethod,
|
||||
#[default]
|
||||
RequiresConfirmation,
|
||||
@ -416,6 +420,7 @@ pub enum PaymentMethodType {
|
||||
GooglePay,
|
||||
ApplePay,
|
||||
Paypal,
|
||||
CryptoCurrency,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
@ -441,6 +446,7 @@ pub enum PaymentMethod {
|
||||
PayLater,
|
||||
Wallet,
|
||||
BankRedirect,
|
||||
Crypto,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
@ -561,9 +567,11 @@ pub enum Connector {
|
||||
Bluesnap,
|
||||
Braintree,
|
||||
Checkout,
|
||||
Coinbase,
|
||||
Cybersource,
|
||||
#[default]
|
||||
Dummy,
|
||||
Opennode,
|
||||
Bambora,
|
||||
Dlocal,
|
||||
Fiserv,
|
||||
@ -618,6 +626,7 @@ pub enum RoutableConnectors {
|
||||
Bluesnap,
|
||||
Braintree,
|
||||
Checkout,
|
||||
Coinbase,
|
||||
Cybersource,
|
||||
Dlocal,
|
||||
Fiserv,
|
||||
@ -626,6 +635,7 @@ pub enum RoutableConnectors {
|
||||
Mollie,
|
||||
Multisafepay,
|
||||
Nuvei,
|
||||
Opennode,
|
||||
Paypal,
|
||||
Payu,
|
||||
Rapyd,
|
||||
@ -758,6 +768,7 @@ impl From<AttemptStatus> for IntentStatus {
|
||||
|
||||
AttemptStatus::Authorized => Self::RequiresCapture,
|
||||
AttemptStatus::AuthenticationPending => Self::RequiresCustomerAction,
|
||||
AttemptStatus::Unresolved => Self::RequiresMerchantAction,
|
||||
|
||||
AttemptStatus::PartialCharged
|
||||
| AttemptStatus::Started
|
||||
@ -826,3 +837,10 @@ pub enum DisputeStatus {
|
||||
// dispute has been unsuccessfully challenged
|
||||
DisputeLost,
|
||||
}
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct UnresolvedResponseReason {
|
||||
pub code: String,
|
||||
/// A message to merchant to give hint on next action he/she should do to resolve
|
||||
pub message: String,
|
||||
}
|
||||
|
||||
@ -441,6 +441,7 @@ pub enum PaymentMethodData {
|
||||
Wallet(WalletData),
|
||||
PayLater(PayLaterData),
|
||||
BankRedirect(BankRedirectData),
|
||||
Crypto(CryptoData),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
|
||||
@ -455,6 +456,7 @@ pub enum AdditionalPaymentData {
|
||||
},
|
||||
Wallet {},
|
||||
PayLater {},
|
||||
Crypto {},
|
||||
}
|
||||
|
||||
impl From<&PaymentMethodData> for AdditionalPaymentData {
|
||||
@ -478,6 +480,7 @@ impl From<&PaymentMethodData> for AdditionalPaymentData {
|
||||
},
|
||||
PaymentMethodData::Wallet(_) => Self::Wallet {},
|
||||
PaymentMethodData::PayLater(_) => Self::PayLater {},
|
||||
PaymentMethodData::Crypto(_) => Self::Crypto {},
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -516,6 +519,10 @@ pub enum BankRedirectData {
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub struct CryptoData {}
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq, serde::Deserialize, serde::Serialize, ToSchema)]
|
||||
pub struct SofortBilling {
|
||||
/// The country associated with the billing
|
||||
@ -620,6 +627,7 @@ pub enum PaymentMethodDataResponse {
|
||||
PayLater(PayLaterData),
|
||||
Paypal,
|
||||
BankRedirect(BankRedirectData),
|
||||
Crypto(CryptoData),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize, ToSchema)]
|
||||
@ -1125,6 +1133,7 @@ impl From<PaymentMethodData> for PaymentMethodDataResponse {
|
||||
PaymentMethodData::BankRedirect(bank_redirect_data) => {
|
||||
Self::BankRedirect(bank_redirect_data)
|
||||
}
|
||||
PaymentMethodData::Crypto(crpto_data) => Self::Crypto(crpto_data),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,6 +9,9 @@ use crate::{disputes, enums as api_enums, payments, refunds};
|
||||
pub enum IncomingWebhookEvent {
|
||||
PaymentIntentFailure,
|
||||
PaymentIntentSuccess,
|
||||
PaymentIntentProcessing,
|
||||
PaymentActionRequired,
|
||||
EventNotSupported,
|
||||
RefundFailure,
|
||||
RefundSuccess,
|
||||
DisputeOpened,
|
||||
@ -36,6 +39,9 @@ impl From<IncomingWebhookEvent> for WebhookFlow {
|
||||
match evt {
|
||||
IncomingWebhookEvent::PaymentIntentFailure => Self::Payment,
|
||||
IncomingWebhookEvent::PaymentIntentSuccess => Self::Payment,
|
||||
IncomingWebhookEvent::PaymentIntentProcessing => Self::Payment,
|
||||
IncomingWebhookEvent::PaymentActionRequired => Self::Payment,
|
||||
IncomingWebhookEvent::EventNotSupported => Self::Payment,
|
||||
IncomingWebhookEvent::RefundSuccess => Self::Refund,
|
||||
IncomingWebhookEvent::RefundFailure => Self::Refund,
|
||||
IncomingWebhookEvent::DisputeOpened => Self::Dispute,
|
||||
|
||||
Reference in New Issue
Block a user