public bool CanMakePayment(MakePaymentRequest request) { var validator = RequestValidatorFactory.GetValidator(request); return(IsAllowedPaymentScheme(request) && validator.IsValid(this, request)); }
private bool IsAllowedPaymentScheme(MakePaymentRequest request) { var paymentSchemeMapping = new Dictionary <PaymentScheme, AllowedPaymentSchemes> { { PaymentScheme.Bacs, AllowedPaymentSchemes.Bacs }, { PaymentScheme.Chaps, AllowedPaymentSchemes.Chaps }, { PaymentScheme.FasterPayments, AllowedPaymentSchemes.FasterPayments } }; return(AllowedPaymentSchemes.HasFlag(paymentSchemeMapping[request.PaymentScheme])); }
public void MakePayment(MakePaymentRequest request) { Balance -= request.Amount; }