@@ -39,11 +39,17 @@ use hyperswitch_interfaces::{
39
39
types:: { self , Response } ,
40
40
webhooks,
41
41
} ;
42
+ use std:: sync:: LazyLock ;
43
+
44
+ use common_enums:: enums;
45
+ use hyperswitch_interfaces:: api:: ConnectorSpecifications ;
46
+ use hyperswitch_domain_models:: router_response_types:: { ConnectorInfo , SupportedPaymentMethods } ;
42
47
use crate :: {
43
48
constants:: headers,
44
49
types:: ResponseRouterData ,
45
50
utils,
46
51
} ;
52
+ use hyperswitch_domain_models:: payment_method_data:: PaymentMethodData ;
47
53
48
54
use transformers as { { project -name | downcase} } ;
49
55
@@ -147,13 +153,39 @@ impl ConnectorCommon for {{project-name | downcase | pascal_case}} {
147
153
reason : response. reason ,
148
154
attempt_status : None ,
149
155
connector_transaction_id : None ,
156
+ network_advice_code : None ,
157
+ network_decline_code : None ,
158
+ network_error_message : None ,
150
159
} )
151
160
}
152
161
}
153
162
163
+
154
164
impl ConnectorValidation for { { project -name | downcase | pascal_case} }
155
165
{
156
- //TODO: implement functions when support enabled
166
+ fn validate_mandate_payment (
167
+ & self ,
168
+ _pm_type : Option < enums:: PaymentMethodType > ,
169
+ pm_data : PaymentMethodData ,
170
+ ) -> CustomResult < ( ) , errors:: ConnectorError > {
171
+ match pm_data {
172
+ PaymentMethodData :: Card ( _) => Err ( errors:: ConnectorError :: NotImplemented (
173
+ "validate_mandate_payment does not support cards" . to_string ( ) ,
174
+ )
175
+ . into ( ) ) ,
176
+ _ => Ok ( ( ) ) ,
177
+ }
178
+ }
179
+
180
+ fn validate_psync_reference_id (
181
+ & self ,
182
+ _data : & PaymentsSyncData ,
183
+ _is_three_ds : bool ,
184
+ _status : enums:: AttemptStatus ,
185
+ _connector_meta_data : Option < common_utils:: pii:: SecretSerdeValue > ,
186
+ ) -> CustomResult < ( ) , errors:: ConnectorError > {
187
+ Ok ( ( ) )
188
+ }
157
189
}
158
190
159
191
impl
@@ -194,7 +226,10 @@ impl
194
226
self . common_get_content_type ( )
195
227
}
196
228
197
- fn get_url ( & self , _req : & PaymentsAuthorizeRouterData , _connectors : & Connectors , ) -> CustomResult < String , errors:: ConnectorError > {
229
+ fn get_url (
230
+ & self ,
231
+ _req : & PaymentsAuthorizeRouterData ,
232
+ _connectors : & Connectors , ) -> CustomResult < String , errors:: ConnectorError > {
198
233
Err ( errors:: ConnectorError :: NotImplemented ( "get_url method" . to_string ( ) ) . into ( ) )
199
234
}
200
235
@@ -425,7 +460,10 @@ impl
425
460
self . common_get_content_type ( )
426
461
}
427
462
428
- fn get_url ( & self , _req : & RefundsRouterData < Execute > , _connectors : & Connectors , ) -> CustomResult < String , errors:: ConnectorError > {
463
+ fn get_url (
464
+ & self ,
465
+ _req : & RefundsRouterData < Execute > ,
466
+ _connectors : & Connectors , ) -> CustomResult < String , errors:: ConnectorError > {
429
467
Err ( errors:: ConnectorError :: NotImplemented ( "get_url method" . to_string ( ) ) . into ( ) )
430
468
}
431
469
487
525
self . common_get_content_type ( )
488
526
}
489
527
490
- fn get_url ( & self , _req : & RefundSyncRouterData , _connectors : & Connectors , ) -> CustomResult < String , errors:: ConnectorError > {
528
+ fn get_url (
529
+ & self ,
530
+ _req : & RefundSyncRouterData , _connectors : & Connectors , ) -> CustomResult < String , errors:: ConnectorError > {
491
531
Err ( errors:: ConnectorError :: NotImplemented ( "get_url method" . to_string ( ) ) . into ( ) )
492
532
}
493
533
@@ -552,5 +592,29 @@ impl webhooks::IncomingWebhook for {{project-name | downcase | pascal_case}} {
552
592
}
553
593
}
554
594
555
- impl ConnectorSpecifications for { { project -name | downcase | pascal_case} } { }
556
-
595
+ static { { project-name | upcase} } _SUPPORTED_PAYMENT_METHODS: LazyLock <SupportedPaymentMethods > =
596
+ LazyLock :: new ( || {
597
+ SupportedPaymentMethods :: new ( )
598
+ } ) ;
599
+
600
+ static { { project-name | upcase} } _CONNECTOR_INFO: ConnectorInfo = ConnectorInfo {
601
+ display_name : "{{project-name | downcase | pascal_case}}" ,
602
+ description : "{{project-name | downcase | pascal_case}} connector" ,
603
+ connector_type : enums:: PaymentConnectorCategory :: PaymentGateway ,
604
+ } ;
605
+
606
+ static { { project-name | upcase} } _SUPPORTED_WEBHOOK_FLOWS: [ enums:: EventClass ; 0 ] = [ ] ;
607
+
608
+ impl ConnectorSpecifications for { { project -name | downcase | pascal_case} } {
609
+ fn get_connector_about ( & self ) -> Option < & ' static ConnectorInfo > {
610
+ Some ( & { { project-name | upcase} } _CONNECTOR_INFO)
611
+ }
612
+
613
+ fn get_supported_payment_methods ( & self ) -> Option < & ' static SupportedPaymentMethods > {
614
+ Some ( & * { { project-name | upcase} } _SUPPORTED_PAYMENT_METHODS)
615
+ }
616
+
617
+ fn get_supported_webhook_flows ( & self ) -> Option < & ' static [ enums:: EventClass ] > {
618
+ Some ( & { { project-name | upcase} } _SUPPORTED_WEBHOOK_FLOWS)
619
+ }
620
+ }
0 commit comments