Пример #1
0
                                                 print_r($result);
                                             } else {
                                                 if ($_POST['_act'] == 'CreateTransEscrow') {
                                                     $result = Braintree_Transaction::sale(array('merchantAccountId' => $_POST["sub_merchant_id"], 'amount' => $_POST["amount"], 'paymentMethodNonce' => $_POST["payment_method_nonce"], 'serviceFeeAmount' => $_POST["serviceFeeAmount"], 'options' => array('holdInEscrow' => true)));
                                                     print_r($result);
                                                     $file = './data/trans_id.txt';
                                                     //[ADD Customer ID to text file]
                                                     $transID = $result->transaction->id . "\r\n";
                                                     // Write the contents to the file,
                                                     // using the FILE_APPEND flag to append the content to the end of the file
                                                     // and the LOCK_EX flag to prevent anyone else writing to the file at the same time
                                                     file_put_contents($file, $transID, FILE_APPEND | LOCK_EX);
                                                     print_r($result);
                                                 } else {
                                                     if ($_POST['_act'] == 'ReleaseTransEscrow') {
                                                         $result = Braintree_Transaction::releaseFromEscrow($_POST['trans_id']);
                                                         print_r($result);
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
 function testCancelRelease_fromEscrow()
 {
     $transaction = $this->createEscrowedTransaction();
     $result = Braintree_Transaction::releaseFromEscrow($transaction->id);
     $result = Braintree_Transaction::cancelRelease($transaction->id);
     $this->assertTrue($result->success);
     $this->assertEquals(Braintree_Transaction::ESCROW_HELD, $result->transaction->escrowStatus);
 }
Пример #3
0
 public function releaseFromEscrow($transaction_id)
 {
     $result = Braintree_Transaction::releaseFromEscrow($transaction_id);
     if ($result->success) {
         return $result;
     } else {
         return array('success' => 0, 'errors' => $result->errors->deepAll());
     }
 }