public function testDeletePayPalAccount()
 {
     // Create a PayPal Account
     $createPayPalAccount = PromisePay::PayPalAccount()->create($this->payPalData);
     // Then, delete it
     $deletePayPalAccount = PromisePay::PayPalAccount()->delete($createPayPalAccount['id']);
     $this->assertEquals($deletePayPalAccount, 'Successfully redacted');
 }
 public function testWithdrawalToPayPal()
 {
     extract($this->testDeposit());
     // in testDeposit(), money was being sent to receiving bank.
     // now, we're going to withdraw that money to a PayPal account
     $bankWithdrawingFrom = $bankReceiving;
     $withdrawalAmount = 100;
     $payPalAccount = PromisePay::PayPalAccount()->create(array('user_id' => $user['id'], 'paypal_email' => $user['email']));
     $bankWithdrawingFromAuthority = PromisePay::DirectDebitAuthority()->create(array('account_id' => $bankWithdrawingFrom['id'], 'amount' => $withdrawalAmount));
     $withdrawal = PromisePay::WalletAccounts()->withdraw($bankWithdrawingFrom['id'], array('account_id' => $payPalAccount['id'], 'amount' => $withdrawalAmount));
     $this->assertNotNull($withdrawal);
     $this->assertEquals($withdrawal['amount'], $withdrawalAmount);
     $this->assertEquals(trim($withdrawal['to']), 'PayPal Disbursement');
     $this->assertEquals($withdrawal['paypal_email'], $user['email']);
     return array('paypalAccount' => $payPalAccount, 'paypalWithdrawal' => $withdrawal);
 }
Exemplo n.º 3
0
 public function testSetDisbursementAccount()
 {
     // First, create the user
     $createUser = PromisePay::User()->create($this->userData);
     // Alias newly created user id for the sake of clarity
     $UID = $createUser['id'];
     // setDisbursementAccount requires Bank or PayPal account param.
     // We're gonna go for PayPal.
     // Update PayPal account data with the id of just created user
     $this->payPalData['user_id'] = $UID;
     // Create a PayPal Account
     $createPayPalAccount = PromisePay::PayPalAccount()->create($this->payPalData);
     $setDisbursementAccount = PromisePay::User()->setDisbursementAccountV2($UID, array('account_id' => $createPayPalAccount['id']));
     $this->assertEquals($createPayPalAccount['id'], $setDisbursementAccount['related']['payout_account']);
 }