Ejemplo n.º 1
0
        public async Task CreateNewAccountPaymentAsync_Account_Is_CreditCard_Verify_AccountService_CreateAccountAsync()
        {
            // Arrange
            var customerPaymentPlan = new NewCustomerPaymentPlan <Ach>
            {
                Customer    = new Customer(),
                Account     = new Ach(),
                PaymentPlan = new PaymentPlan()
            };

            accountService.Setup(m => m.CreateAccountAsync <Ach>(It.IsAny <Ach>())).ReturnsAsync(new Ach {
                Id = 1
            });
            webServiceRequest.Setup(m => m.PostDeserializedAsync <PaymentPlan, Result <PaymentPlan> >(It.IsAny <Uri>(), It.IsAny <PaymentPlan>())).ReturnsAsync(new Result <PaymentPlan> {
                Response = new PaymentPlan {
                    Id = 1
                }
            });

            // Act
            await service.CreateNewAccountPaymentPlanAsync(customerPaymentPlan);

            // Assert
            accountService.Verify(m => m.CreateAccountAsync(It.IsAny <Ach>()));
        }
Ejemplo n.º 2
0
        public async Task CreateNewCustomerPaymentPlanAsync_Result_Has_Ids_Populated()
        {
            // Arrange
            var customerPaymentPlan = new NewCustomerPaymentPlan <Ach>
            {
                Customer    = new Customer(),
                Account     = new Ach(),
                PaymentPlan = new PaymentPlan()
            };

            accountService.Setup(m => m.CreateAccountAsync <Ach>(It.IsAny <Ach>())).ReturnsAsync(new Ach {
                Id = 1
            });
            webServiceRequest.Setup(m => m.PostDeserializedAsync <PaymentPlan, Result <PaymentPlan> >(It.IsAny <Uri>(), It.IsAny <PaymentPlan>())).ReturnsAsync(new Result <PaymentPlan> {
                Response = new PaymentPlan {
                    Id = 1
                }
            });

            // Act
            var result = await service.CreateNewCustomerPaymentPlanAsync(customerPaymentPlan);

            // Assert
            Assert.Equal(1, result.Customer.Id);
            Assert.Equal(1, result.Account.Id);
            Assert.Equal(1, result.PaymentPlan.Id);
        }
Ejemplo n.º 3
0
        public async Task <NewCustomerPaymentPlan <T> > CreateNewCustomerPaymentPlanAsync <T>(NewCustomerPaymentPlan <T> customerPaymentPlan)
            where T : Account, new()
        {
            try
            {
                var result = await paymentScheduleService.CreateNewCustomerPaymentPlanAsync <T>(customerPaymentPlan);

                if (result != null)
                {
                    DumpObject("CreateNewCustomerPaymentPlanAsync", result);
                }

                return(result);
            }
            catch (PaySimpleException ex)
            {
                DumpObject("PaySimpleException", ex.ValidationErrors);
            }
            catch (PaySimpleEndpointException ex)
            {
                DumpObject("PaySimpleEndpointException", ex.EndpointErrors);
            }

            return(null);
        }