private function readmeExamples()
 {
     // SHOW
     $wallet = PromisePay::WalletAccounts()->show('WALLET_ID');
     // SHOW ACCOUNT USER
     $walletUser = PromisePay::WalletAccounts()->getUser('WALLET_ID');
     // DEPOSIT
     // Authorize bank account to be used as a funding source
     $authority = PromisePay::DirectDebitAuthority()->create(array('account_id' => 'SOURCE_BANK_ID', 'amount' => 100));
     $deposit = PromisePay::WalletAccounts()->deposit('TARGET_WALLET_ID', array('account_id' => 'SOURCE_BANK_ID', 'amount' => 100));
     // WITHDRAW
     // Withdraw to PayPal
     // Authorize bank account to be used as a funding source
     $authority = PromisePay::DirectDebitAuthority()->create(array('account_id' => 'SOURCE_BANK_ID', 'amount' => 100));
     $withdrawal = PromisePay::WalletAccounts()->withdraw('SOURCE_BANK_ID', array('account_id' => 'PAYPAY_ACCOUNT_ID', 'amount' => 100));
     // Withdraw to Bank Account
     // Authorize bank account to be used as a funding source
     $authority = PromisePay::DirectDebitAuthority()->create(array('account_id' => 'SOURCE_BANK_ID', 'amount' => 100));
     $withdrawal = PromisePay::WalletAccounts()->withdraw('SOURCE_BANK_ID', array('account_id' => 'TARGET_BANK_ID', 'amount' => 100));
 }
Exemplo n.º 2
0
 /**
  * @param $fundingMethod string card or bank
  */
 public function makePayment($fundingMethod = 'card')
 {
     $this->createRandomIds();
     $seller = $this->createSeller();
     $buyer = $this->createBuyer();
     if ($fundingMethod == 'card') {
         $fundingSource = $buyerCard = $this->createBuyerCardAccount();
     } elseif ($fundingMethod == 'bank') {
         $fundingSource = $buyerBankAccount = $this->createBuyerBankAccount();
         $directDebitAuthority = PromisePay::DirectDebitAuthority()->create(array('account_id' => $buyerBankAccount['id'], 'amount' => $this->itemData['amount']));
     } else {
         assert(false);
         throw new \InvalidArgumentException('Invalid funding method in ' . __METHOD__);
     }
     $fee = $this->createFee();
     $this->itemData['fee_ids'] = $fee['id'];
     $item = $this->createItem();
     $payment = $this->payForItem($item['id'], $fundingSource['id']);
     return array('payment' => $payment, 'item' => $item, 'buyer' => $buyer, 'buyerCard' => isset($buyerCard) ? $buyerCard : null, 'buyerBankAccount' => isset($buyerBankAccount) ? $buyerBankAccount : null, 'directDebitAuthority' => isset($directDebitAuthority) ? $directDebitAuthority : null, 'fundingSource' => $fundingSource, 'fee' => $fee, 'seller' => $seller);
 }
 protected function examples()
 {
     // CREATE
     $directDebitAuthority = PromisePay::DirectDebitAuthority()->create(array('account_id' => 'ACCOUNT_ID', 'amount' => 100));
     // GET LIST
     $getList = PromisePay::DirectDebitAuthority()->getList(array('account_id' => 'BANK_ACCOUNT_ID'));
     // SHOW
     $directDebitAuthority = PromisePay::DirectDebitAuthority()->show('DIRECT_DEBIT_AUTHORITY_ID');
     // DELETE
     $deleteDirectDebitAuthority = PromisePay::DirectDebitAuthority()->delete('DIRECT_DEBIT_AUTHORITY_ID');
 }
Exemplo n.º 4
0
 protected function createAuthority($accountId, $amount)
 {
     return PromisePay::DirectDebitAuthority()->create(array('account_id' => $accountId, 'amount' => $amount));
 }