Esempio n. 1
0
 /**
  * Adds a CreditCard object
  *
  * @param CreditCard $creditcard
  * @param array reference $post
  */
 private function add_creditcard(CreditCard $creditcard, $options)
 {
     $credit = array('CardDetails' => array('CardName' => $creditcard->name(), 'CV2' => $creditcard->verification_value, 'CardNumber' => $creditcard->number, 'ExpiryDate' => array('@attributes' => array('Month' => $this->cc_format($creditcard->month, 'two_digits'), 'Year' => $this->cc_format($creditcard->year, 'two_digits')))));
     return $credit;
 }
Esempio n. 2
0
<?php

require_once '../../autoload.php';
require_once '../../vendor/autoload.php';
require_once '../login.php';
use AktiveMerchant\Billing\Base;
use AktiveMerchant\Billing\CreditCard;
Base::mode('test');
# Remove this on production mode
#Alternative way to get a gateway instanse.
$gateway = Base::gateway('worldpay', array('login' => WORLDPAY_LOGIN, 'password' => WORLDPAY_PASS, 'inst_id' => WORLDPAY_INSTALLATION_ID));
$cc = new CreditCard(array("first_name" => "John", "last_name" => "Doe", "number" => "4111111111111111", "month" => "01", "year" => "2015", "verification_value" => "000"));
$options = array('order_id' => 'REF' . $gateway->generateUniqueId(), 'description' => 'Worldpay Test Transaction', 'address' => array('address1' => '1234 Street', 'zip' => '98004', 'state' => 'WA', 'country' => 'US'));
try {
    if (false == $cc->isValid()) {
        var_dump($cc->errors());
    } else {
        $response = $gateway->authorize("0.01", $cc, $options);
        echo $response->message() . "\n";
    }
} catch (Exception $e) {
    echo $e->getMessage() . "\n";
}
Esempio n. 3
0
 /**
  *
  * @param CreditCard $creditcard
  */
 private function add_creditcard(CreditCard $creditcard)
 {
     $this->post['CardName'] = $creditcard->name();
     $this->post['CardNumber'] = $creditcard->number;
     $this->post['ExpiryDateMM'] = $this->cc_format($creditcard->month, 'two_digits');
     $this->post['ExpiryDateYY'] = $this->cc_format($creditcard->year, 'two_digits');
     if ($this->requires_start_date_or_issue_number($creditcard)) {
         $this->post['StartDateMM'] = $this->cc_format($creditcard->start_month, "two_digits");
         $this->post['StartDateYY'] = $this->cc_format($creditcard->start_year, "two_digits");
         $this->post['IssueNumber'] = $creditcard->issue_number;
         $this->post['CV2'] = $creditcard->verification_value;
     }
 }
    /**
     *
     * @param CreditCard $creditcard
     */
    private function add_creditcard(CreditCard $creditcard)
    {
        $month = $this->cc_format($creditcard->month, 'two_digits');
        $cardholdername = strtoupper($creditcard->name());
        $this->post .= <<<XML
      <ns:CardInfo>
        <ns:CardType>{$this->CARD_MAPPINGS[$creditcard->type]}</ns:CardType>
        <ns:CardNumber>{$creditcard->number}</ns:CardNumber>
        <ns:CardHolderName>{$cardholdername}</ns:CardHolderName>
        <ns:ExpirationMonth>{$month}</ns:ExpirationMonth>
        <ns:ExpirationYear>{$creditcard->year}</ns:ExpirationYear>
        <ns:Cvv2>{$creditcard->verification_value}</ns:Cvv2>
        <ns:Aid/>
        <ns:Emv/>
        <ns:PinBlock/>
      </ns:CardInfo>
XML;
    }
Esempio n. 5
0
<?php

require_once '../../autoload.php';
require_once '../login.php';
use AktiveMerchant\Billing\Base;
use AktiveMerchant\Billing\CreditCard;
Base::mode('test');
# Remove this on production mode
#Alternative way to get a gateway instanse.
$gateway = Base::gateway('authorize_net', array('login' => AUTH_NET_LOGIN, 'password' => AUTH_NET_PASS));
$cc = new CreditCard(array("first_name" => "John", "last_name" => "Doe", "number" => "4111111111111111", "month" => "01", "year" => "2015", "verification_value" => "000"));
$options = array('order_id' => 'REF' . $gateway->generateUniqueId(), 'description' => '', 'length' => '1', 'unit' => 'months', 'start_date' => date("Y-m-d", strtotime('tomorrow')), 'occurrences' => '10', 'billing_address' => array('first_name' => 'John', 'last_name' => 'Doe', 'address1' => '1234 Street', 'zip' => '98004', 'state' => 'WA'));
try {
    if (false == $cc->isValid()) {
        var_dump($cc->errors());
    } else {
        $response = $gateway->recurring("1.00", $cc, $options);
        if ($response->success()) {
            echo " Subscription id: " . $response->subscription_id;
        } else {
            echo $response->message();
        }
    }
} catch (Exception $e) {
    echo $e->getMessage();
}
Esempio n. 6
0
 private function add_recurring_creditcard(CreditCard $creditcard)
 {
     $post['card_holder'] = $creditcard->name();
     $post['card_number'] = $creditcard->number;
     $post['expiry_date'] = $this->cc_format($creditcard->month, 'two_digits') . "/" . $this->cc_format($creditcard->year, 'four_digits');
     $post['cvv'] = $creditcard->verification_value;
     $this->post['card'] = $post;
 }
Esempio n. 7
0
 /**
  * Adds a CreditCard object
  *
  * @param CreditCard $creditcard
  */
 private function add_creditcard(CreditCard $creditcard)
 {
     $this->post['CardNumber'] = $creditcard->number;
     $this->post['CardExpiryMonth'] = $this->cc_format($creditcard->month, 'two_digits');
     $this->post['CardExpiryYear'] = $this->cc_format($creditcard->year, 'two_digits');
     $this->post['CustomerFirstName'] = $creditcard->first_name;
     $this->post['CustomerLastName'] = $creditcard->last_name;
     $this->post['CardHoldersName'] = $creditcard->name();
     if ($creditcard->verification_value) {
         $this->post['CVN'] = $creditcard->verification_value;
     }
 }