コード例 #1
0
        printObj($paymentProfile, 1);
        // 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);
        print "Updating Payment Schedules ..." . PHP_EOL;
        // Retrieve all currently active paymentSchedules associated to this external account.
        // Useful to view / modify / discontinue / disable payments
        echo "\tGetting Payment Schedules..." . PHP_EOL;
        #$paymentSchedules = $oaConn->getPaymentSchedulesSummary( $extAcct->external_account_id);
        $paymentSchedules = $oaConn->getPaymentSchedulesSummary();
        foreach ($paymentSchedules as $paySched) {
            print "\tPayment Schedule: " . $paySched->payment_schedule_id . PHP_EOL;
            printObj($paySched, 2);
            // // Modify the Payment Schedule and Save it back
            print "Modifying Payment Schedule: " . $paySched->payment_schedule_id . PHP_EOL;
            $paymentSchedule = $oaConn->getPaymentSchedule($paySched->payment_schedule_id);
            $payment_schedule_amount = $paymentSchedule->payment_schedule_amount;
            $paymentSchedule->payment_schedule_amount = $payment_schedule_amount + 100.0;
            $response = $oaConn->savePaymentSchedule($paymentSchedule);
            if (isset($response->payment_schedule_id)) {
                print "Updated Payment Schedule: was-'" . $payment_schedule_amount . "' is now-'" . $response->payment_schedule_amount . "'" . PHP_EOL;
            }
        }
    }
} catch (Exception $e) {
    echo $e->getMessage() . PHP_EOL;
}
if ($connected) {
    print "Disconnecting ";
    $res = $oaConn->disconnect();
    printObj($res);
コード例 #2
0
 // Here are all the paymentSchedule fields:
 //payment_schedule_id =
 //payment_schedule_external_account_id =
 //payment_schedule_payment_type_id =
 //payment_schedule_amount =
 //payment_schedule_currency_code =
 //payment_schedule_next_date =
 //payment_schedule_frequency =
 //payment_schedule_end_date =
 //payment_schedule_remaining_occurrences =
 //payment_schedule_status =
 // First call getPaymentSchedule passing in '' as the schedule id.
 // That will initialize a payment_schedule web object with frequency "once"; end_date "today";
 // It will stub in all the fields with empty values making it very easy to inspect.
 // (Likely to be replaced with a $oaCon->createNewPaymentSchedule( $ext_acct_id, $pay_type_id, $amt, $frequency, $end_date, $currency ) call.)
 $paymentSchedule = $oaConn->getPaymentSchedule('');
 $paymentSchedule->payment_schedule_external_account_id = $external_account_id;
 $paymentSchedule->payment_schedule_payment_type_id = $payment_type_id;
 $paymentSchedule->payment_schedule_amount = rand(10000, 99999) / 100;
 printObj($paymentSchedule, 1);
 print "Saving Payment Schedule..." . PHP_EOL;
 $paymentSchedule = $oaConn->savePaymentSchedule($paymentSchedule);
 if (isset($paymentSchedule->payment_schedule_id)) {
     // The reponse from savePaymentSchedule was actually the new Payment Schedule;
     // we retrieve it here separately just to demonstrate it worked.
     print "Retrieving payment schedule to confirm save..." . PHP_EOL;
     $response = $oaConn->getPaymentSchedule($paymentSchedule->payment_schedule_id);
     printObj($response, 1);
     print "Succesfully retrieved new Payment Schedule!" . PHP_EOL;
 } else {
     printobj($paymentSchedule, 1);