Пример #1
0
        public async Task When_I_process_an_ach_standalone_using_a_payment_token_credit_Then_it_should_return_a_valid_response_async()
        {
            var vaultService = SampleFactory.CreateSampleCustomerVaultService();

            var profile = SampleFactory.CreateSampleProfile();

            profile = await vaultService.CreateAsync(profile);

            var address = SampleFactory.CreateSampleAddress(profile);

            address = await vaultService.CreateAsync(address);

            var account = SampleFactory.CreatSampleAchBankAccount(profile, address);

            account = await vaultService.CreateAsync(account);

            var response = await _achDirectDebitService.SubmitAsync(StandaloneCredits.Builder()
                                                                    .MerchantRefNum(account.MerchantRefNum())
                                                                    .Amount(10038)
                                                                    .Ach()
                                                                    .PayMethod("WEB")
                                                                    .PaymentToken(account.PaymentToken())
                                                                    .Done()
                                                                    .Build());

            Assert.That(response.Status(), Is.EqualTo("COMPLETED"));
        }
        public async Task When_I_update_an_AHC_bank_account_Then_it_should_be_updated_async()
        {
            _profile = await _service.CreateAsync(_profile);

            var address = SampleFactory.CreateSampleAddress(_profile);

            address = await _service.CreateAsync(address);

            AchBankAccounts account = SampleFactory.CreatSampleAchBankAccount(_profile, address);

            account = await _service.CreateAsync(account);

            var newAccountHolderName = "Foo";

            account.AccountHolderName(newAccountHolderName);

            await _service.UpdateAsync(account);

            var returnedAccount = await _service.GetAsync(AchBankAccounts.Builder()
                                                          .Id(account.Id())
                                                          .ProfileId(_profile.Id())
                                                          .Build());

            Assert.That(returnedAccount.AccountHolderName(), Is.EqualTo(newAccountHolderName));

            await _service.DeleteAsync(account);
        }
        public async Task When_I_create_an_AHC_bank_account_Then_it_should_return_a_valid_response_async()
        {
            _profile = await _service.CreateAsync(_profile);

            var address = SampleFactory.CreateSampleAddress(_profile);

            address = await _service.CreateAsync(address);

            AchBankAccounts account = SampleFactory.CreatSampleAchBankAccount(_profile, address);

            account = await _service.CreateAsync(account);

            Assert.That(account.Status(), Is.EqualTo("ACTIVE"));

            await _service.DeleteAsync(account);
        }
        public async Task When_I_delete_an_AHC_bank_account_Then_it_should_be_deleted_async()
        {
            _profile = await _service.CreateAsync(_profile);

            var address = SampleFactory.CreateSampleAddress(_profile);

            address = await _service.CreateAsync(address);

            AchBankAccounts account = SampleFactory.CreatSampleAchBankAccount(_profile, address);

            account = await _service.CreateAsync(account);

            var response = await _service.DeleteAsync(account);

            Assert.That(response, Is.True);
            Assert.ThrowsAsync <Paysafe.Common.EntityNotFoundException>(async() => await _service.GetAsync(AchBankAccounts.Builder()
                                                                                                           .Id(account.Id())
                                                                                                           .ProfileId(_profile.Id())
                                                                                                           .Build()));
        }
        public async Task When_I_lookup_an_AHC_bank_account_Then_it_should_return_a_valid_AHC_bank_account_async()
        {
            _profile = await _service.CreateAsync(_profile);

            var address = SampleFactory.CreateSampleAddress(_profile);

            address = await _service.CreateAsync(address);

            AchBankAccounts account = SampleFactory.CreatSampleAchBankAccount(_profile, address);

            account = await _service.CreateAsync(account);

            var returnedAccount = await _service.GetAsync(AchBankAccounts.Builder()
                                                          .Id(account.Id())
                                                          .ProfileId(_profile.Id())
                                                          .Build());

            Assert.That(AchBankAccountsAreEquivalent(account, returnedAccount));

            await _service.DeleteAsync(account);
        }