示例#1
0
        public static PaymentBase GetPaymentService(PaymentServiceType serviceType)
        {
            switch (serviceType)
            {
            case PaymentServiceType.PayPal:
                return(new PayPalPayment("Andras", "Passw0rd"));

            case PaymentServiceType.WorldPay:
                return(new WorldPayPayment("Andras", "Passw0rd", "ABC"));

            default:
                throw new NotImplementedException("No such service.");
            }
        }
示例#2
0
        public bool Refund(PaymentServiceType paymentServiceType, decimal amount, string transactionId)
        {
            PaymentBase payment = PaymentFactory.GetPaymentService(paymentServiceType);

            return(payment.Refund(amount, transactionId));
        }