@@ -3,6 +3,8 @@ use serde::{Deserialize, Serialize};
3
3
use time:: PrimitiveDateTime ;
4
4
use utoipa:: ToSchema ;
5
5
6
+ #[ cfg( feature = "payouts" ) ]
7
+ use crate :: payouts;
6
8
use crate :: { disputes, enums as api_enums, mandates, payments, refunds} ;
7
9
8
10
#[ derive( Clone , Debug , PartialEq , Eq , Hash , Serialize , Deserialize , Copy ) ]
@@ -41,10 +43,26 @@ pub enum IncomingWebhookEvent {
41
43
ExternalAuthenticationARes ,
42
44
FrmApproved ,
43
45
FrmRejected ,
46
+ #[ cfg( feature = "payouts" ) ]
47
+ PayoutSuccess ,
48
+ #[ cfg( feature = "payouts" ) ]
49
+ PayoutFailure ,
50
+ #[ cfg( feature = "payouts" ) ]
51
+ PayoutProcessing ,
52
+ #[ cfg( feature = "payouts" ) ]
53
+ PayoutCancelled ,
54
+ #[ cfg( feature = "payouts" ) ]
55
+ PayoutCreated ,
56
+ #[ cfg( feature = "payouts" ) ]
57
+ PayoutExpired ,
58
+ #[ cfg( feature = "payouts" ) ]
59
+ PayoutReversed ,
44
60
}
45
61
46
62
pub enum WebhookFlow {
47
63
Payment ,
64
+ #[ cfg( feature = "payouts" ) ]
65
+ Payout ,
48
66
Refund ,
49
67
Dispute ,
50
68
Subscription ,
@@ -62,6 +80,11 @@ pub enum WebhookResponseTracker {
62
80
payment_id : String ,
63
81
status : common_enums:: IntentStatus ,
64
82
} ,
83
+ #[ cfg( feature = "payouts" ) ]
84
+ Payout {
85
+ payout_id : String ,
86
+ status : common_enums:: PayoutStatus ,
87
+ } ,
65
88
Refund {
66
89
payment_id : String ,
67
90
refund_id : String ,
@@ -86,6 +109,8 @@ impl WebhookResponseTracker {
86
109
| Self :: Refund { payment_id, .. }
87
110
| Self :: Dispute { payment_id, .. } => Some ( payment_id. to_string ( ) ) ,
88
111
Self :: NoEffect | Self :: Mandate { .. } => None ,
112
+ #[ cfg( feature = "payouts" ) ]
113
+ Self :: Payout { .. } => None ,
89
114
}
90
115
}
91
116
}
@@ -125,6 +150,14 @@ impl From<IncomingWebhookEvent> for WebhookFlow {
125
150
IncomingWebhookEvent :: FrmApproved | IncomingWebhookEvent :: FrmRejected => {
126
151
Self :: FraudCheck
127
152
}
153
+ #[ cfg( feature = "payouts" ) ]
154
+ IncomingWebhookEvent :: PayoutSuccess
155
+ | IncomingWebhookEvent :: PayoutFailure
156
+ | IncomingWebhookEvent :: PayoutProcessing
157
+ | IncomingWebhookEvent :: PayoutCancelled
158
+ | IncomingWebhookEvent :: PayoutCreated
159
+ | IncomingWebhookEvent :: PayoutExpired
160
+ | IncomingWebhookEvent :: PayoutReversed => Self :: Payout ,
128
161
}
129
162
}
130
163
}
@@ -149,12 +182,21 @@ pub enum AuthenticationIdType {
149
182
ConnectorAuthenticationId ( String ) ,
150
183
}
151
184
185
+ #[ cfg( feature = "payouts" ) ]
186
+ #[ derive( Clone ) ]
187
+ pub enum PayoutIdType {
188
+ PayoutAttemptId ( String ) ,
189
+ ConnectorPayoutId ( String ) ,
190
+ }
191
+
152
192
#[ derive( Clone ) ]
153
193
pub enum ObjectReferenceId {
154
194
PaymentId ( payments:: PaymentIdType ) ,
155
195
RefundId ( RefundIdType ) ,
156
196
MandateId ( MandateIdType ) ,
157
197
ExternalAuthenticationID ( AuthenticationIdType ) ,
198
+ #[ cfg( feature = "payouts" ) ]
199
+ PayoutId ( PayoutIdType ) ,
158
200
}
159
201
160
202
pub struct IncomingWebhookDetails {
@@ -193,6 +235,9 @@ pub enum OutgoingWebhookContent {
193
235
DisputeDetails ( Box < disputes:: DisputeResponse > ) ,
194
236
#[ schema( value_type = MandateResponse , title = "MandateResponse" ) ]
195
237
MandateDetails ( Box < mandates:: MandateResponse > ) ,
238
+ #[ cfg( feature = "payouts" ) ]
239
+ #[ schema( value_type = PayoutCreateResponse , title = "PayoutCreateResponse" ) ]
240
+ PayoutDetails ( payouts:: PayoutCreateResponse ) ,
196
241
}
197
242
198
243
#[ derive( Debug , Clone , Serialize ) ]
0 commit comments