Пример #1
1
 protected function setUp()
 {
     $this->chargeData = array('account_id' => null, 'amount' => 100, 'email' => null, 'zip' => 90210, 'country' => 'AUS', 'device_id' => GUID(), 'ip_address' => '49.229.186.182');
     $this->createBankTestInstance();
     $createBankAccount = $this->bankTest->testCreateBankAccount();
     $this->chargeData['account_id'] = $createBankAccount['id'];
     $this->userData = PromisePay::User()->show($this->bankTest->getBankAccountUserId());
     $this->chargeData['email'] = $this->userData['email'];
 }
Пример #2
0
 public function testListCardAccountsForUser()
 {
     // First, create the user
     $createUser = PromisePay::User()->create($this->userData);
     // Update the cardAccountData
     $this->cardAccountData['user_id'] = $createUser['id'];
     // Create the Card Account
     $createAccount = PromisePay::CardAccount()->create($this->cardAccountData);
     $user = PromisePay::CardAccount()->getUser($createAccount['id']);
     $this->assertEquals($this->cardAccountData['full_name'], $user['full_name']);
 }
Пример #3
0
 protected function createSeller()
 {
     $this->userData['id'] = $this->sellerId;
     $this->userData['email'] = $this->sellerId . '@google.com';
     $this->userData['mobile'] = $this->sellerId . '12345';
     $this->userData['first_name'] = 'Jane';
     $this->userData['last_name'] = 'Jonesy';
     $createSeller = PromisePay::User()->create($this->userData);
     // add KYC (Know Your Customer) properties
     $seller = PromisePay::User()->update($this->sellerId, $createSeller['id'], array('government_number' => 123456782, 'phone' => '+1234567889', 'dob' => '30/01/1990', 'drivers_license_number' => '123456789', 'drivers_license_state' => 'NSW'));
     return $seller;
 }
 public function testDeposit()
 {
     // USING 1 USER, 2 BANK ACCOUNTS AND DIRECT DEBIT AUTHORITY
     $user = $this->createUser();
     // add KYC (Know Your Customer) properties
     $user = PromisePay::User()->update($user['id'], array('government_number' => 123456782, 'phone' => '+1234567889', 'dob' => '30/01/1990', 'drivers_license_number' => '123456789', 'drivers_license_state' => 'NSW'));
     $this->assertNotNull($user);
     $bankReceiving = $this->createBankAccount($user['id']);
     $bankSending = $this->createBankAccount($user['id']);
     $this->assertNotNull($bankReceiving);
     $this->assertNotNull($bankSending);
     $depositAmount = 1000;
     $bankSendingAuthority = PromisePay::DirectDebitAuthority()->create(array('account_id' => $bankSending['id'], 'amount' => $depositAmount));
     $this->assertNotNull($bankSendingAuthority);
     $deposit = PromisePay::WalletAccounts()->deposit($bankReceiving['id'], array('account_id' => $bankSending['id'], 'amount' => $depositAmount));
     $this->assertNotNull($deposit);
     $this->assertEquals($deposit['amount'], $depositAmount);
     $this->assertEquals($deposit['currency'], $bankReceiving['currency']);
     $this->assertEquals($deposit['to'], 'Bank Account');
     $this->assertEquals($deposit['bank_name'], $bankReceiving['bank']['bank_name']);
     $this->assertEquals($deposit['bank_account_number'], $bankReceiving['bank']['account_number']);
     return array('user' => $user, 'bankReceiving' => $bankReceiving, 'bankSending' => $bankSending, 'bankSendingDirectDebitAuthority' => $bankSendingAuthority, 'deposit' => $deposit);
 }
Пример #5
0
 public function makePayment()
 {
     $this->buyerId = GUID();
     $this->sellerId = GUID();
     $this->GUID = GUID();
     $itemData = $this->itemData;
     $itemData['id'] = $this->GUID;
     $itemData['buyer_id'] = $this->buyerId;
     $itemData['seller_id'] = $this->sellerId;
     $userData = $this->userData;
     $userData['id'] = $this->buyerId;
     $userData['email'] = $this->buyerId . '@google.com';
     $userData['mobile'] = $this->buyerId . '123456';
     $buyerUserData = $userData;
     $cardAccountData = $this->cardAccountData;
     $cardAccountData['user_id'] = $this->buyerId;
     // Create Buyer
     $createBuyer = PromisePay::User()->create($userData);
     // Create Buyer Card Account
     $createBuyerCardAccount = PromisePay::CardAccount()->create($cardAccountData);
     // Create Seller
     $userData['id'] = $this->sellerId;
     $userData['email'] = $this->sellerId . '@google.com';
     $userData['mobile'] = $this->sellerId . '12345';
     $userData['first_name'] = 'Jane';
     $userData['last_name'] = 'Jonesy';
     $sellerUserData = $userData;
     $createSeller = PromisePay::User()->create($userData);
     // Create the item
     $createItem = PromisePay::Item()->create($itemData);
     $makePayment = PromisePay::Item()->makePayment($createItem['id'], array('account_id' => $createBuyerCardAccount['id']));
     /*
         item, buyer and seller keys contain data arrays that are not returned from API, but are generated in this test suite, and
         are passed along with the API data in order to compare what we sent to API, and what it gave back.
     */
     return array('payment' => $makePayment, 'item' => $createItem, 'buyer' => $buyerUserData, 'seller' => $sellerUserData);
 }
Пример #6
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']);
 }