コード例 #1
0
$autobill = new AutoBill();
$response = $autobill->fetchByAccount($account, false);
print_r($response);
if ($response['returnCode'] == 200) {
    $targetAutoBill = $response['data']->autobills[0];
    $paymentMethod = $targetAutoBill->paymentMethod;
    $merchantPaymentMethodId = $paymentMethod->merchantPaymentMethodId;
    print "\$merchantPaymentMethodId={$merchantPaymentMethodId}" . PHP_EOL;
    $results = hoaAccountUpdatePaymentMethod($merchantAccountId, $merchantPaymentMethodId);
    $apiReturnCode = $results['apiReturnCode'];
    $validated = $results['validated'];
    print "results: apiReturnCode={$apiReturnCode}, validated={$validated}" . PHP_EOL;
    if ($apiReturnCode == '200' && $validated == '1') {
        print "Card successfully validated when updated.  Now check if AutoBill re-activated:" . PHP_EOL;
        $entitlement = new Entitlement();
        $response = $entitlement->fetchByAccount($account, true, false);
        print_r($response);
        $now = strtotime('now');
        # current time
        $entitlements = $response['data']->entitlements;
        if (isset($entitlements) && is_array($entitlements)) {
            foreach ($entitlements as $index => $entitlement) {
                # print "\n\$index = $index\n";
                print "entitlements[" . $index . "]: = \n";
                # print_r ($entitlement);
                print "endTimestamp = " . $entitlement->endTimestamp . "\n";
                if (empty($entitlement->endTimestamp) || is_null($entitlement->endTimestamp) || strtotime($entitlement->endTimestamp) > $now) {
                    print "...entitled!  ==> subscription activated successfully.\n";
                    return;
                }
            }
コード例 #2
0
<?php

require_once 'Vindicia/Soap/Vindicia.php';
require_once 'Vindicia/Soap/Const.php';
$accountID = $argv[1];
$showAll = false;
$includeChildren = false;
print "merchantAccountId: {$accountID} \n";
$account = new Account();
$account->setMerchantAccountId($accountID);
$entitlement = new Entitlement();
$response = $entitlement->fetchByAccount($account, $showAll, $includeChildren);
print_r($response);