示例#1
0
        public async Task CreateNewAccountRecurringPaymentAsync_Account_Is_Ach_Verify_AccountService_CreateAccountAsync()
        {
            // Arrange
            var accountRecurringPayment = new NewAccountRecurringPayment <Ach>
            {
                Account = new Ach()
                {
                    CustomerId = 1
                },
                RecurringPayment = new RecurringPayment()
            };

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

            // Act
            await service.CreateNewAccountRecurringPaymentAsync(accountRecurringPayment);

            // Assert
            accountService.Verify(m => m.CreateAccountAsync(It.IsAny <Ach>()));
        }
示例#2
0
        public async Task <NewAccountRecurringPayment <T> > CreateNewAccountRecurringPaymentAsync <T>(NewAccountRecurringPayment <T> accountRecurringPayment)
            where T : Account, new()
        {
            try
            {
                var result = await paymentScheduleService.CreateNewAccountRecurringPaymentAsync <T>(accountRecurringPayment);

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

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

            return(null);
        }