public function testapi()
 {
     $o_bcpc = new BaseCommerceClient(RENTSQUARE_MERCH_USER, RENTSQUARE_MERCH_PASS, RENTSQUARE_MERCH_KEY);
     $o_bcpc->setSandbox(BC_SANDBOXVALUE);
     $o_address = new Address();
     $o_address->setName(Address::$XS_ADDRESS_NAME_BILLING);
     $o_address->setLine1("123 Some Address");
     $o_address->setCity("Tempe");
     $o_address->setState("AZ");
     $o_address->setZipcode("12345");
     $o_bc = new BankCard();
     $o_bc->setBillingAddress($o_address);
     $o_bc->setExpirationMonth("02");
     $o_bc->setExpirationYear("2015");
     $o_bc->setName("Nick 2");
     $o_bc->setNumber("4111111111111111");
     $o_bc->setToken("myToken12asdfas3");
     $o_bc = $o_bcpc->addBankCard($o_bc);
     if ($o_bc->isStatus(BankCard::$XS_BC_STATUS_FAILED)) {
         //the add Failed, look at messages array for reason(s) why
         //var_dump( $o_bc->getMessages() );
         $this->set('message', $o_bc->getMessages());
     } else {
         if ($o_bc->isStatus(BankCard::$XS_BC_STATUS_ACTIVE)) {
             //Card added successfully
             //var_dump( $o_bc->getToken() );
             $this->set('message', $o_bc->getToken());
         }
     }
 }
Exemplo n.º 2
0
function create_ecp_PaymentMethod()
{
    $uniqueValue = get_unique_value();
    $merchantAccountId = 'account-' . $uniqueValue;
    $merchantPaymentMethodId = 'pm-' . $uniqueValue;
    $email = get_unique_value() . '@nomail.com';
    $successUrl = 'http://good.com/';
    //need a trailing slash
    $errorUrl = 'http://bad.com/';
    //need a trailing slash
    $name = 'John Vindicia';
    $addr1 = '303 Twin Dolphin Drive';
    $city = 'Redwood City';
    $district = 'CA';
    $postalCode = '94065';
    $country = 'US';
    $address = new Address();
    $address->setName($name);
    $address->setAddr1($addr1);
    $address->setCity($city);
    $address->setDistrict($district);
    $address->setPostalCode($postalCode);
    $address->setCountry($country);
    $paymentmethod = new PaymentMethod();
    $paymentmethod->setType('ECP');
    $paymentmethod->setAccountHolderName($name);
    $paymentmethod->setBillingAddress($address);
    $paymentmethod->setMerchantPaymentMethodId($merchantPaymentMethodId);
    $paymentmethod->setCurrency('USD');
    $ecp = new ECP();
    $ecp->setAccount('495958930');
    $ecp->setRoutingNumber('611111111');
    $ecp->setAllowedTransactionType('Inbound');
    $ecp->setAccountType('ConsumerChecking');
    $paymentmethod->setECP($ecp);
    $account = new Account();
    $account->setMerchantAccountId($merchantAccountId);
    $account->setEmailAddress($email);
    $account->setShippingAddress($address);
    $account->setEmailTypePreference('html');
    $account->setName($name);
    $account->setPaymentMethods(array($paymentmethod));
    return $account;
}
function create_paypal_PaymentMethod()
{
    $uniqueValue = get_unique_value();
    $merchantAccountId = 'account-' . $uniqueValue;
    $merchantPaymentMethodId = 'pm-' . $uniqueValue;
    $email = get_unique_value() . '@nomail.com';
    $successUrl = 'http://good.com/';
    //need a trailing slash
    $errorUrl = 'http://bad.com/';
    //need a trailing slash
    $name = 'John Vindicia';
    $addr1 = '303 Twin Dolphin Drive';
    $city = 'Redwood City';
    $district = 'CA';
    $postalCode = '94065';
    $country = 'US';
    $address = new Address();
    $address->setName($name);
    $address->setAddr1($addr1);
    $address->setCity($city);
    $address->setDistrict($district);
    $address->setPostalCode($postalCode);
    $address->setCountry($country);
    $paymentmethod = new PaymentMethod();
    $paymentmethod->setType('PayPal');
    $paymentmethod->setAccountHolderName($name);
    $paymentmethod->setBillingAddress($address);
    $paymentmethod->setMerchantPaymentMethodId($merchantPaymentMethodId);
    $paymentmethod->setCurrency('USD');
    $paypal = new PayPal();
    $paypal->setReturnUrl($successUrl);
    $paypal->setCancelUrl($errorUrl);
    $paymentmethod->setPaypal($paypal);
    $account = new Account();
    $account->setMerchantAccountId($merchantAccountId);
    $account->setEmailAddress($email);
    $account->setShippingAddress($address);
    $account->setEmailTypePreference('html');
    $account->setName($name);
    //$account->setPaymentMethods(array($paymentmethod));
    //return $account;
    return array('account' => $account, 'paymentmethod' => $paymentmethod);
}
Exemplo n.º 4
0
 /**
  * 
  * Builds and Returns an Address object based off of the JSON input.
  * 
  * @param vo_json   JSON representation of an address
  * @return  the Address
  * @throws JSONException  if the json is not properly formatted
  */
 static function buildFromJSON($o_data)
 {
     $o_instance = new Address();
     if ($o_data != NULL) {
         if (array_key_exists("address_name", $o_data)) {
             $o_instance->setName($o_data['address_name']);
         }
         if (array_key_exists("address_line1", $o_data)) {
             $o_instance->setLine1($o_data['address_line1']);
         }
         if (array_key_exists("address_line2", $o_data)) {
             $o_instance->setLine2($o_data['address_line2']);
         }
         if (array_key_exists("address_city", $o_data)) {
             $o_instance->setCity($o_data['address_city']);
         }
         if (array_key_exists("address_state", $o_data)) {
             $o_instance->setState($o_data['address_state']);
         }
         if (array_key_exists("address_zipcode", $o_data)) {
             $o_instance->setZipcode($o_data['address_zipcode']);
         }
         if (array_key_exists("address_country", $o_data)) {
             $o_instance->setCountry($o_data['address_country']);
         }
     }
     return $o_instance;
 }
<?php

require_once 'Vindicia/Soap/Vindicia.php';
require_once 'Vindicia/Soap/Const.php';
$parentID = $argv[1];
print "parent: {$parentID} \n";
$name = "Child One";
$addr1 = "19 Davis Dr";
$city = "Belmont";
$state = "CA";
$postalcode = "94002";
$country = "US";
$email = "childAccount" . rand(10000, 99999) . "@vindicia.com";
$address = new Address();
$address->setName($name);
$address->setAddr1($addr1);
$address->setCity($city);
$address->setDistrict($state);
$address->setPostalCode($postalcode);
$address->setCountry($country);
$accountID = "childAccount" . rand(1000, 9999) . "-" . rand(1000, 999999);
$child1 = new Account();
$child1->setMerchantAccountId($accountID);
$child1->setEmailAddress($email);
$child1->setShippingAddress($address);
$child1->setEmailTypePreference('html');
$child1->setWarnBeforeAutoBilling(false);
$child1->setName($name);
$parent = new Account();
$parent->setMerchantAccountId($parentID);
// use the force flag to remove these children from a previous parent
Exemplo n.º 6
0
 /**
  * This function takes in an array of the address objects generated by the message headers and turns them into an
  * associative array.
  *
  * @param string $addresses
  *
  * @return Address[]
  */
 protected function processAddressObject($addresses)
 {
     $output_addresses = array();
     $decoded_addresses = imap_rfc822_parse_adrlist($addresses, null);
     if (is_array($decoded_addresses)) {
         foreach ($decoded_addresses as $address) {
             $current_address = new Address($address->mailbox . '@' . $address->host);
             if (isset($address->personal)) {
                 $current_address->setName($address->personal);
             }
             array_push($output_addresses, $current_address);
         }
     }
     return $output_addresses;
 }