Esempio n. 1
0
 public function setToAccountId($accountId)
 {
     $this->to = Account::reference($accountId);
 }
 /**
  * Withdraws some amount of funds.
  *
  * Supported parameters include:
  *
  *  * commit (Boolean)
  */
 public function createAccountWithdrawal(Account $account, Withdrawal $withdrawal, array $params = [])
 {
     $data = $this->mapper->fromWithdrawal($withdrawal);
     $this->postAndMap($account->getResourcePath() . '/withdrawals', $data + $params, 'toWithdrawal', $withdrawal);
 }
 private function createAccount()
 {
     $this->accounts[] = $account = new Account();
     $account->setName('test' . time());
     $this->client->createAccount($account);
     return $account;
 }
 public function testCommitWithdrawal()
 {
     $withdrawal = new Withdrawal();
     $this->client->expects($this->once())->method('commitWithdrawal')->with($withdrawal, []);
     $this->account->commitWithdrawal($withdrawal);
 }
Esempio n. 5
0
 public function testSetName()
 {
     $account = new Account();
     $account->setName('NAME');
     $this->assertEquals('NAME', $account->getName());
 }
Esempio n. 6
0
 public function testCreateWithdrawal()
 {
     $account = Account::reference('ACCOUNT_ID');
     $withdrawal = new Withdrawal();
     $response = $this->getMock(ResponseInterface::class);
     $this->mapper->expects($this->any())->method('fromWithdrawal')->with($withdrawal)->willReturn(['key' => 'value']);
     $this->http->expects($this->once())->method('post')->with('/v2/accounts/ACCOUNT_ID/withdrawals', ['key' => 'value', 'foo' => 'bar'])->willReturn($response);
     $this->mapper->expects($this->once())->method('toWithdrawal')->with($response, $withdrawal);
     $this->client->createAccountWithdrawal($account, $withdrawal, ['foo' => 'bar']);
 }