Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function testGetBankAccount() {
- // create Item
- $itemData = array(
- "id" => GUID(),
- "name" => 'Item #12893489',
- "amount" => 1000,
- "payment_type" => 2,
- "buyer_id" => "fdf58725-96bd-4bf8-b5e6-9b61be20662e",
- "seller_id" => "ec9bf096-c505-4bef-87f6-18822b9dbf2c",
- "description" => "This is item's description."
- );
- $buyerBank = PromisePay::User()->getBankAccount(
- $itemData['buyer_id']
- );
- $sellerBank = PromisePay::User()->getBankAccount(
- $itemData['seller_id']
- );
- $item = PromisePay::Item()->create($itemData);
- // create authority
- $directDebitAUthority = PromisePay::DirectDebitAuthority()->create(
- array(
- 'account_id' => $buyerBank['id'],
- 'amount' => $itemData['amount']
- )
- );
- // request payment
- $requestPayment = PromisePay::Item()->requestPayment(
- $item['id']
- );
- // acknowledge wire
- $ackWire = PromisePay::Item()->acknowledgeWire($item['id']);
- // pay for item
- $makePayment = PromisePay::Item()->makePayment(
- $item['id'],
- array(
- 'account_id' => $buyerBank['id']
- )
- );
- $wireDetails = PromisePay::Item()->getWireDetails($item['id']);
- $this->assertNotNull($wireDetails); // this passes
- print_r($makePayment); // state is payment_pending, instead of completed (see below for full dump)
- $itemTransactions = PromisePay::Transaction()->getList(
- array(
- 'limit' => 200,
- 'item_id' => $item['id']
- )
- );
- var_dump($itemTransactions); // yields NULL instead of array
- }
- /*
- print_r($makePayment);
- (
- [id] => dbb29e6c-2125-4bb1-b0c5-243d04346e54
- [name] => Item #12893489
- [description] => This is item's description.
- [created_at] => 2016-06-17T00:58:47.877Z
- [updated_at] => 2016-06-17T00:58:53.310Z
- [state] => payment_pending
- [net_amount] => 1000
- [refunded_amount] => 0
- [released_amount] => 0
- [buyer_fees] => 0
- [seller_fees] => 0
- [credit_card_fee] => 0
- [paypal_fee] => 0
- [seller_url] =>
- [buyer_url] =>
- [direct_debit_fee] => 0
- [status] => 22150
- [amount] => 1000
- [payment_type_id] => 2
- [due_date] =>
- [pending_release_amount] => 0
- [deposit_reference] => 100014014942525
- [promisepay_fee] => 17
- [total_outstanding] => 1000
- [total_amount] => 1000
- [currency] => AUD
- [payment_method] => pending
- [buyer_name] => Test Test
- [buyer_email] => [email protected]
- [buyer_country] => AUS
- [seller_name] => test sdfdf edited Test
- [seller_email] => [email protected]
- [seller_country] => AUS
- [payment_credit_card_enabled] => 1
- [payment_direct_debit_enabled] => 1
- [related] => Array
- (
- [buyers] => fdf58725-96bd-4bf8-b5e6-9b61be20662e
- [sellers] => ec9bf096-c505-4bef-87f6-18822b9dbf2c
- )
- [links] => Array
- (
- [self] => /items/dbb29e6c-2125-4bb1-b0c5-243d04346e54/make_payment?account_id=539818e1-23cc-4939-bcbc-b265cfdfd669
- [buyers] => /items/dbb29e6c-2125-4bb1-b0c5-243d04346e54/buyers
- [sellers] => /items/dbb29e6c-2125-4bb1-b0c5-243d04346e54/sellers
- [status] => /items/dbb29e6c-2125-4bb1-b0c5-243d04346e54/status
- [fees] => /items/dbb29e6c-2125-4bb1-b0c5-243d04346e54/fees
- [transactions] => /items/dbb29e6c-2125-4bb1-b0c5-243d04346e54/transactions
- [wire_details] => /items/dbb29e6c-2125-4bb1-b0c5-243d04346e54/wire_details
- [bpay_details] => /items/dbb29e6c-2125-4bb1-b0c5-243d04346e54/bpay_details
- )
- )
- */
Add Comment
Please, Sign In to add comment