저자: Nick Sagona, III (nick@popphp.org)
예제 #1
0
<?php

require_once '../../bootstrap.php';
use Pop\Payment\Payment;
use Pop\Payment\Adapter\TrustCommerce;
try {
    $payment = new Payment(new TrustCommerce('CUSTID', 'PASSWORD', Payment::TEST));
    $payment->cardNum = '4111111111111111';
    $payment->amount = '25.27';
    $payment->expDate = '04/12';
    $payment->send();
    if ($payment->isApproved()) {
        echo "You're approved!" . PHP_EOL;
        echo $payment->getMessage();
    } else {
        if ($payment->isDeclined()) {
            echo "You were declined!" . PHP_EOL;
            echo $payment->getMessage();
        } else {
            if ($payment->isError()) {
                echo "There was an error!" . PHP_EOL;
                echo $payment->getMessage();
            }
        }
    }
} catch (\Exception $e) {
    echo $e->getMessage() . PHP_EOL . PHP_EOL;
}
예제 #2
0
 public function testSendException()
 {
     $this->setExpectedException('Pop\\Payment\\Adapter\\Exception');
     $p = new Payment(new Authorize('API_LOGIN_ID', 'TRANS_KEY', Payment::TEST));
     $p->send();
 }