Ejemplo n.º 1
0
        public async Task When_I_process_an_eft_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.CreatSampleEftBankAccount(profile, address);

            account = await vaultService.CreateAsync(account);

            var response = await _eftDirectDebitService.SubmitAsync(StandaloneCredits.Builder()
                                                                    .MerchantRefNum(account.MerchantRefNum())
                                                                    .Amount(10038)
                                                                    .Eft()
                                                                    .PaymentToken(account.PaymentToken())
                                                                    .Done()
                                                                    .Build());

            Assert.That(response.Status(), Is.EqualTo("COMPLETED"));
        }
Ejemplo n.º 2
0
        public async Task When_I_process_an_ach_purchase_using_a_token_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.CreatSampleEftBankAccount(profile, address);

            account = await vaultService.CreateAsync(account);

            Purchases response = await _achDirectDebitService.SubmitAsync(Purchases.Builder()
                                                                          .MerchantRefNum(System.Guid.NewGuid().ToString())
                                                                          .Amount(10038)
                                                                          .Ach()
                                                                          .PaymentToken(account.PaymentToken())
                                                                          .Done()
                                                                          .Build());

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

            var address = SampleFactory.CreateSampleAddress(_profile);

            address = await _service.CreateAsync(address);

            EftBankAccounts account = SampleFactory.CreatSampleEftBankAccount(_profile, address);

            account = await _service.CreateAsync(account);

            var newAccountHolderName = "Foo";

            account.AccountHolderName(newAccountHolderName);

            await _service.UpdateAsync(account);

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

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

            await _service.DeleteAsync(account);
        }
        public void When_I_create_an_EFT_bank_account_Then_it_should_return_a_valid_response_sync()
        {
            _profile = _service.Create(_profile);
            var address = SampleFactory.CreateSampleAddress(_profile);

            address = _service.Create(address);
            EftBankAccounts account = SampleFactory.CreatSampleEftBankAccount(_profile, address);

            account = _service.Create(account);

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

            _service.Delete(account);
        }
        public void When_I_delete_an_EFT_bank_account_Then_it_should_be_deleted_sync()
        {
            _profile = _service.Create(_profile);
            var address = SampleFactory.CreateSampleAddress(_profile);

            address = _service.Create(address);
            EftBankAccounts account = SampleFactory.CreatSampleEftBankAccount(_profile, address);

            account = _service.Create(account);

            var response = _service.Delete(account);

            Assert.That(response, Is.True);
            Assert.Throws <Paysafe.Common.EntityNotFoundException>(() => _service.Get(EftBankAccounts.Builder()
                                                                                      .Id(account.Id())
                                                                                      .ProfileId(_profile.Id())
                                                                                      .BillingAddressId(address.Id())
                                                                                      .Build()));
        }
        public void When_I_lookup_an_EFT_bank_account_Then_it_should_return_a_valid_EFT_bank_account_sync()
        {
            _profile = _service.Create(_profile);
            var address = SampleFactory.CreateSampleAddress(_profile);

            address = _service.Create(address);
            EftBankAccounts account = SampleFactory.CreatSampleEftBankAccount(_profile, address);

            account = _service.Create(account);

            var returnedAccount = _service.Get(EftBankAccounts.Builder()
                                               .Id(account.Id())
                                               .ProfileId(_profile.Id())
                                               .BillingAddressId(address.Id())
                                               .Build());

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

            _service.Delete(account);
        }