printObj($paymentProfile, 1);
        print "Updating External Accounts ..." . PHP_EOL;
        // Now that we have the PaymentProfile we can set the API Payment Profile ID so it can be used by default on other calls
        echo "Setting the default Payment Profile ID for the connection" . PHP_EOL;
        $oaConn->setPaymentProfileId($paymentProfile->payment_profile_id, OAConnection::IDTYPE_API);
        // External accounts represent the user's bank accounts
        // Retrieve the external accounts on this profile
        echo "\tGetting External Accounts..." . PHP_EOL;
        $externalAccounts = $oaConn->getExternalAccountsSummary();
        foreach ($externalAccounts as $extAcct) {
            print "\tExternal Account: (" . $extAcct->external_account_id . ") " . $extAcct->external_account_bank . " - " . $extAcct->external_account_name . PHP_EOL;
            printObj($extAcct, 2);
            $oaConn->setExternalAccountId($extAcct->external_account_id);
            echo "Modifying External Account..." . PHP_EOL;
            // To modify the external account retrieving the whole account is required.
            $externalAccount = $oaConn->getExternalAccount($extAcct->external_account_id);
            // Let's reverse the name of the account holder every time this demo is run
            $nameBefore = $externalAccount->external_account_holder;
            $externalAccount->external_account_holder = strrev($externalAccount->external_account_holder);
            $updatedExternalAccount = $oaConn->saveExternalAccount($externalAccount);
            if (isset($updatedExternalAccount->external_account_id)) {
                print "Updated External Account: was-'" . $nameBefore . "' is now-'" . $updatedExternalAccount->external_account_holder . "'" . PHP_EOL;
            }
        }
    }
} catch (Exception $e) {
    echo $e->getMessage() . PHP_EOL;
}
if ($connected) {
    print "Disconnecting ";
    $res = $oaConn->disconnect();
示例#2
0
 }
 if (isset($paymentProfile->payment_profile_id)) {
     // Now that we have the PaymentProfile we can set the API Payment Profile ID so it can be used by default on other calls
     echo "Setting the default Payment Profile ID for the connection" . PHP_EOL;
     $oaConn->setPaymentProfileId($paymentProfile->payment_profile_id, OAConnection::IDTYPE_API);
     // External accounts represent the user's bank accounts
     // Retrieve the external accounts on this profile
     echo "\tGetting External Accounts..." . PHP_EOL;
     $externalAccounts = $oaConn->getExternalAccountsSummary();
     foreach ($externalAccounts as $extAcct) {
         print "\tExternal Account: (" . $extAcct->external_account_id . ") " . $extAcct->external_account_bank . " - " . $extAcct->external_account_name . PHP_EOL;
         printObj($extAcct, 2);
         // Just like with payment profiles we can set this as the default external account for subsequent commands
         $oaConn->setExternalAccountId($extAcct->external_account_id);
         // To modify the external account retrieving the whole account is required.
         $externalAccount = $oaConn->getExternalAccount($extAcct->external_account_id);
         if (isset($externalAccount->external_account_id)) {
             print "Retrieved External Account: '" . $externalAccount->external_account_id . "' name is: '" . $externalAccount->external_account_holder . "'" . PHP_EOL;
             echo "Modifying External Account..." . PHP_EOL;
             // Let's reverse the name of the account holder every time this demo is run
             $nameBefore = $externalAccount->external_account_holder;
             print "Changing name to: '" . strrev($nameBefore) . PHP_EOL;
             $externalAccount->external_account_holder = strrev($nameBefore);
             printObj($externalAccount, 3);
             $response = $oaConn->saveExternalAccount($externalAccount);
             if (isset($response->external_account_id)) {
                 print "Updated External Account: was-'" . $nameBefore . "' is now-'" . $response->external_account_holder . "'" . PHP_EOL;
             }
         }
     }
     // Retrieve all currently active paymentSchedules associated to this external account.