Exemple #1
0
        public async Task <StatusCodeResult> ProcessPaymentAsync(PaymentDTM paymentDTM)
        {
            var result = new OperationResult <Payment>();

            switch (paymentDTM.Amount)
            {
            case > 500:
                result = await _premiumPaymentService.PremiumPaymentAsync(paymentDTM);

                break;

            case > 21:
                result = await _expensivePaymentGateway.ExpensivePaymentAsync(paymentDTM);

                break;

            default:
                result = await _cheapPaymentGateway.CheapPaymentAsync(paymentDTM);

                break;
            }

            return(new StatusCodeResult((int)result.StatusCode));
        }