コード例 #1
0
        public void TestPayoutAsCustomer_CreateWithNewBankAccount()
        {
            OpenpayAPI openpayAPI = new OpenpayAPI(Constants.API_KEY, Constants.MERCHANT_ID);
            BankAccount bankAccount = new BankAccount();
            bankAccount.CLABE = "012298026516924616";
            bankAccount.HolderName = "Testing";

            bankAccount = openpayAPI.BankAccountService.Create(customer_id, bankAccount);

            PayoutRequest request = new PayoutRequest();
            request.Method = "bank_account";
            request.DestinationId = bankAccount.Id;
            request.Amount = 8.5m;
            request.Description = "Payout test";
            Payout payout = openpayAPI.PayoutService.Create(customer_id, request);
            Assert.IsNotNull(payout.Id);
            Assert.IsNotNull(payout.CreationDate);
            Assert.IsNotNull(payout.BankAccount);

            Payout payoutGet = openpayAPI.PayoutService.Get(customer_id, payout.Id);
            Assert.AreEqual(payout.Amount, payoutGet.Amount);
            Assert.AreEqual(payout.BankAccount.CLABE, payoutGet.BankAccount.CLABE);

            openpayAPI.BankAccountService.Delete(customer_id, bankAccount.Id);
        }
コード例 #2
0
        public void TestAsCustomer_CreateGetDelete()
        {
            OpenpayAPI openpayAPI = new OpenpayAPI(Constants.API_KEY, Constants.MERCHANT_ID);
            BankAccount bankAccount = new BankAccount();
            bankAccount.CLABE = "012298026516924616";
            bankAccount.HolderName = "Testing";
            BankAccount bankAccountCreated = openpayAPI.BankAccountService.Create(customer_id, bankAccount);
            Assert.IsNotNull(bankAccountCreated.Id);
            Assert.IsNull(bankAccountCreated.Alias);
            Assert.AreEqual("012XXXXXXXXXX24616", bankAccountCreated.CLABE);

            BankAccount bankAccountGet = openpayAPI.BankAccountService.Get(customer_id, bankAccountCreated.Id);
            Assert.AreEqual("012XXXXXXXXXX24616", bankAccountGet.CLABE);

            List<BankAccount> accounts = openpayAPI.BankAccountService.List(customer_id);
            Assert.AreEqual(1, accounts.Count);

            openpayAPI.BankAccountService.Delete(customer_id, bankAccountGet.Id);
           
        }