@@ -873,13 +873,15 @@ pub struct WebhookEvent {
873
873
pub enum WebhookResourceType {
874
874
Payments ,
875
875
Refunds ,
876
+ Mandates ,
876
877
}
877
878
878
879
#[ derive( Debug , Serialize , Deserialize ) ]
879
880
#[ serde( untagged) ]
880
881
pub enum WebhookAction {
881
882
PaymentsAction ( PaymentsAction ) ,
882
883
RefundsAction ( RefundsAction ) ,
884
+ MandatesAction ( MandatesAction ) ,
883
885
}
884
886
885
887
#[ derive( Debug , Serialize , Deserialize ) ]
@@ -909,11 +911,31 @@ pub enum RefundsAction {
909
911
FundsReturned ,
910
912
}
911
913
914
+ #[ derive( Debug , Serialize , Deserialize ) ]
915
+ #[ serde( rename_all = "snake_case" ) ]
916
+ pub enum MandatesAction {
917
+ Created ,
918
+ CustomerApprovalGranted ,
919
+ CustomerApprovalSkipped ,
920
+ Active ,
921
+ Cancelled ,
922
+ Failed ,
923
+ Transferred ,
924
+ Expired ,
925
+ Submitted ,
926
+ ResubmissionRequested ,
927
+ Reinstated ,
928
+ Replaced ,
929
+ Consumed ,
930
+ Blocked ,
931
+ }
932
+
912
933
#[ derive( Debug , Serialize , Deserialize ) ]
913
934
#[ serde( untagged) ]
914
935
pub enum WebhooksLink {
915
936
PaymentWebhooksLink ( PaymentWebhooksLink ) ,
916
937
RefundWebhookLink ( RefundWebhookLink ) ,
938
+ MandateWebhookLink ( MandateWebhookLink ) ,
917
939
}
918
940
919
941
#[ derive( Debug , Serialize , Deserialize ) ]
@@ -926,12 +948,17 @@ pub struct PaymentWebhooksLink {
926
948
pub payment : String ,
927
949
}
928
950
951
+ #[ derive( Debug , Serialize , Deserialize ) ]
952
+ pub struct MandateWebhookLink {
953
+ pub mandate : String ,
954
+ }
955
+
929
956
impl TryFrom < & WebhookEvent > for GocardlessPaymentsResponse {
930
957
type Error = error_stack:: Report < errors:: ConnectorError > ;
931
958
fn try_from ( item : & WebhookEvent ) -> Result < Self , Self :: Error > {
932
959
let id = match & item. links {
933
960
WebhooksLink :: PaymentWebhooksLink ( link) => link. payment . to_owned ( ) ,
934
- WebhooksLink :: RefundWebhookLink ( _) => {
961
+ WebhooksLink :: RefundWebhookLink ( _) | WebhooksLink :: MandateWebhookLink ( _ ) => {
935
962
Err ( errors:: ConnectorError :: WebhookEventTypeNotFound ) ?
936
963
}
937
964
} ;
@@ -962,7 +989,7 @@ impl TryFrom<&WebhookAction> for GocardlessPaymentStatus {
962
989
| PaymentsAction :: ResubmissionRequired
963
990
| PaymentsAction :: Created => Err ( errors:: ConnectorError :: WebhookEventTypeNotFound ) ?,
964
991
} ,
965
- WebhookAction :: RefundsAction ( _) => {
992
+ WebhookAction :: RefundsAction ( _) | WebhookAction :: MandatesAction ( _ ) => {
966
993
Err ( errors:: ConnectorError :: WebhookEventTypeNotFound ) ?
967
994
}
968
995
}
0 commit comments