File tree 2 files changed +10
-0
lines changed
src/VirtoCommerce.XOrder.Core/Validators
2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -38,5 +38,10 @@ public static string PaymentMethodUnavailable(string code)
38
38
{
39
39
return $ "The payment method code:{ code } unavailable";
40
40
}
41
+
42
+ public static string PaymentMethodInactive ( string gatewayCode )
43
+ {
44
+ return $ "Payment method { gatewayCode } is inactive";
45
+ }
41
46
}
42
47
}
Original file line number Diff line number Diff line change @@ -25,6 +25,11 @@ public PaymentRequestValidator()
25
25
. WithMessage ( x => OrderErrorDescriber . PaymentMethodNotFound ( x . Payment . GatewayCode ) )
26
26
. When ( x => x . Payment != null ) ;
27
27
28
+ RuleFor ( x => x . Payment . PaymentMethod . IsActive )
29
+ . Equal ( true )
30
+ . WithMessage ( x => OrderErrorDescriber . PaymentMethodInactive ( x . Payment . GatewayCode ) )
31
+ . When ( x => x . Payment ? . PaymentMethod != null ) ;
32
+
28
33
RuleFor ( x => x . Store )
29
34
. NotNull ( )
30
35
. WithMessage ( OrderErrorDescriber . StoreNotFound ( ) ) ;
You can’t perform that action at this time.
0 commit comments