function Step2CreateCreditCard($merchantAccountId)
{
    //    $account = get_account_by_merchantAccountId($merchantAccountId);
    //To save a soap call, you can use sparse objects.
    $account = new Account();
    $account->merchantAccountId = $merchantAccountId;
    $merchantPaymentMethodId = $merchantAccountId;
    $paymentMethod = new PaymentMethod();
    $cc = new CreditCard();
    $paymentMethod->setBillingAddress($account->shippingAddress);
    $paymentMethod->setMerchantPaymentMethodId($merchantPaymentMethodId);
    // Use Test cards only in ProdTest.  Use Real cards only in Production.
    $cc->setAccount("4112344112344113");
    $cc->setExpirationDate("201811");
    $paymentMethod->setType('CreditCard');
    $paymentMethod->setCreditCard($cc);
    // Do not check AVS, CVN.  Do not validate.
    $replaceOnAutoBills = true;
    $updateBehavior = "Update";
    $ignoreAvsPolicy = true;
    $ignoreCvnPolicy = true;
    $srd = '';
    $response = $account->updatePaymentMethod($srd, $paymentMethod, $replaceOnAutoBills, $updateBehavior, $ignoreAvsPolicy, $ignoreCvnPolicy);
    // Log soap id for each API call.
    //    $log->addDebug('Method = Account.updatePaymentMethod' . PHP_EOL);
    //    $log->addDebug('Soap Id = ' . $response['data']->return->soapId . PHP_EOL);
    //    $log->addDebug('Return Code = ' . $response['returnCode'] . PHP_EOL);
    //    $log->addDebug('Return String = ' . $response['returnString'] . PHP_EOL);
    if ($response['returnCode'] == 200) {
        print "Call succeeded" . PHP_EOL;
    } else {
        print "Call failed" . PHP_EOL;
    }
}
コード例 #2
0
<?php

ini_set('include_path', '/usr/local');
ini_set('display_errors', 1);
error_reporting(E_ALL | E_STRICT);
require_once 'Vindicia/Soap/Vindicia.php';
require_once 'Vindicia/Soap/Const.php';
$ccnum = $argv[1];
$pm = new PaymentMethod();
$pm->setType('CreditCard');
$cc = new CreditCard();
$cc->setAccount($ccnum);
$pm->setCreditCard($cc);
$acct = new Account();
$page = 0;
$pageSize = 1000;
// max 1000 records per page
do {
    $count = 0;
    $response = $acct->fetchByPaymentMethod('', $pm, $page, $pageSize);
    $return_code = $response['returnCode'];
    print "Return Code is: {$return_code} \n";
    print_r($response);
    if ($return_code == 200) {
        $accounts = $response['data']->accounts;
        //$count = sizeof($accounts);
        foreach ($accounts as $account) {
            // process each account found here
            print "Found account with id: " . $account->getMerchantAccountId() . "\n";
            $acct_name = $account->getname();
            $acct_zip = $account->paymentMethods[0]->billingAddress->postalCode;
コード例 #3
0
$name = "Parent Account";
$addr1 = "19 Davis Dr";
$city = "Belmont";
$state = "CA";
$postalcode = "94002";
$country = "US";
$email = "parent-" . rand(10000, 99999) . "@vindicia.com";
$pAddress = new Address();
$pAddress->setName($name);
$pAddress->setAddr1($addr1);
$pAddress->setCity($city);
$pAddress->setDistrict($state);
$pAddress->setPostalCode($postalcode);
$pAddress->setCountry($country);
$cc = new CreditCard();
$cc->setAccount('4485983356242217');
$cc->setExpirationDate('201710');
$pm = new PaymentMethod();
$pm->setType('CreditCard');
$pm->setBillingAddress($pAddress);
$pm->setCreditCard($cc);
$pm->setActive(1);
$pm_array = array($pm);
$pAccountId = "parent-" . rand(1000, 9999) . "-" . rand(1000, 999999);
$account = new Account();
$account->setMerchantAccountId($pAccountId);
$account->setEmailAddress($email);
$account->setShippingAddress($pAddress);
$account->setEmailTypePreference('html');
$account->setWarnBeforeAutoBilling(false);
$account->setName($name);