Source of file AuthorizeNetTypes.php
Size: 10,601 Bytes - Last Modified: 2021-12-23T10:42:25+00:00
/var/www/docs.ssmods.com/process/src/thirdparty/authorizenet/lib/shared/AuthorizeNetTypes.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399 | <?php /** * Classes for the various AuthorizeNet data types. * * @package AuthorizeNet * @subpackage AuthorizeNetCIM */ /** * A class that contains all fields for a CIM Customer Profile. * * @package AuthorizeNet * @subpackage AuthorizeNetCIM */ class AuthorizeNetCustomer { public $merchantCustomerId; public $description; public $email; public $paymentProfiles = array(); public $shipToList = array(); public $customerProfileId; } /** * A class that contains all fields for a CIM Address. * * @package AuthorizeNet * @subpackage AuthorizeNetCIM */ class AuthorizeNetAddress { public $firstName; public $lastName; public $company; public $address; public $city; public $state; public $zip; public $country; public $phoneNumber; public $faxNumber; public $customerAddressId; } /** * A class that contains all fields for a CIM Payment Profile. * * @package AuthorizeNet * @subpackage AuthorizeNetCIM */ class AuthorizeNetPaymentProfile { public $customerType; public $billTo; public $payment; public $customerPaymentProfileId; public function __construct() { $this->billTo = new AuthorizeNetAddress; $this->payment = new AuthorizeNetPayment; } } /** * A class that contains all fields for a CIM Payment Type. * * @package AuthorizeNet * @subpackage AuthorizeNetCIM */ class AuthorizeNetPayment { public $creditCard; public $bankAccount; public function __construct() { $this->creditCard = new AuthorizeNetCreditCard; $this->bankAccount = new AuthorizeNetBankAccount; } } /** * A class that contains all fields for a CIM Transaction. * * @package AuthorizeNet * @subpackage AuthorizeNetCIM */ class AuthorizeNetTransaction { public $amount; public $tax; public $shipping; public $duty; public $lineItems = array(); public $customerProfileId; public $customerPaymentProfileId; public $customerShippingAddressId; public $creditCardNumberMasked; public $bankRoutingNumberMasked; public $bankAccountNumberMasked; public $order; public $taxExempt; public $recurringBilling; public $cardCode; public $splitTenderId; public $approvalCode; public $transId; public function __construct() { $this->tax = (object)array(); $this->tax->amount = ""; $this->tax->name = ""; $this->tax->description = ""; $this->shipping = (object)array(); $this->shipping->amount = ""; $this->shipping->name = ""; $this->shipping->description = ""; $this->duty = (object)array(); $this->duty->amount = ""; $this->duty->name = ""; $this->duty->description = ""; // line items $this->order = (object)array(); $this->order->invoiceNumber = ""; $this->order->description = ""; $this->order->purchaseOrderNumber = ""; } } /** * A class that contains all fields for a CIM Transaction Line Item. * * @package AuthorizeNet * @subpackage AuthorizeNetCIM */ class AuthorizeNetLineItem { public $itemId; public $name; public $description; public $quantity; public $unitPrice; public $taxable; } /** * A class that contains all fields for a CIM Credit Card. * * @package AuthorizeNet * @subpackage AuthorizeNetCIM */ class AuthorizeNetCreditCard { public $cardNumber; public $expirationDate; public $cardCode; } /** * A class that contains all fields for a CIM Bank Account. * * @package AuthorizeNet * @subpackage AuthorizeNetCIM */ class AuthorizeNetBankAccount { public $accountType; public $routingNumber; public $accountNumber; public $nameOnAccount; public $echeckType; public $bankName; } /** * A class that contains all fields for an AuthorizeNet ARB Subscription. * * @package AuthorizeNet * @subpackage AuthorizeNetARB */ class AuthorizeNet_Subscription { public $name; public $intervalLength; public $intervalUnit; public $startDate; public $totalOccurrences; public $trialOccurrences; public $amount; public $trialAmount; public $creditCardCardNumber; public $creditCardExpirationDate; public $creditCardCardCode; public $bankAccountAccountType; public $bankAccountRoutingNumber; public $bankAccountAccountNumber; public $bankAccountNameOnAccount; public $bankAccountEcheckType; public $bankAccountBankName; public $orderInvoiceNumber; public $orderDescription; public $customerId; public $customerEmail; public $customerPhoneNumber; public $customerFaxNumber; public $billToFirstName; public $billToLastName; public $billToCompany; public $billToAddress; public $billToCity; public $billToState; public $billToZip; public $billToCountry; public $shipToFirstName; public $shipToLastName; public $shipToCompany; public $shipToAddress; public $shipToCity; public $shipToState; public $shipToZip; public $shipToCountry; public function getXml() { $xml = "<subscription> <name>{$this->name}</name> <paymentSchedule> <interval> <length>{$this->intervalLength}</length> <unit>{$this->intervalUnit}</unit> </interval> <startDate>{$this->startDate}</startDate> <totalOccurrences>{$this->totalOccurrences}</totalOccurrences> <trialOccurrences>{$this->trialOccurrences}</trialOccurrences> </paymentSchedule> <amount>{$this->amount}</amount> <trialAmount>{$this->trialAmount}</trialAmount> <payment> <creditCard> <cardNumber>{$this->creditCardCardNumber}</cardNumber> <expirationDate>{$this->creditCardExpirationDate}</expirationDate> <cardCode>{$this->creditCardCardCode}</cardCode> </creditCard> <bankAccount> <accountType>{$this->bankAccountAccountType}</accountType> <routingNumber>{$this->bankAccountRoutingNumber}</routingNumber> <accountNumber>{$this->bankAccountAccountNumber}</accountNumber> <nameOnAccount>{$this->bankAccountNameOnAccount}</nameOnAccount> <echeckType>{$this->bankAccountEcheckType}</echeckType> <bankName>{$this->bankAccountBankName}</bankName> </bankAccount> </payment> <order> <invoiceNumber>{$this->orderInvoiceNumber}</invoiceNumber> <description>{$this->orderDescription}</description> </order> <customer> <id>{$this->customerId}</id> <email>{$this->customerEmail}</email> <phoneNumber>{$this->customerPhoneNumber}</phoneNumber> <faxNumber>{$this->customerFaxNumber}</faxNumber> </customer> <billTo> <firstName>{$this->billToFirstName}</firstName> <lastName>{$this->billToLastName}</lastName> <company>{$this->billToCompany}</company> <address>{$this->billToAddress}</address> <city>{$this->billToCity}</city> <state>{$this->billToState}</state> <zip>{$this->billToZip}</zip> <country>{$this->billToCountry}</country> </billTo> <shipTo> <firstName>{$this->shipToFirstName}</firstName> <lastName>{$this->shipToLastName}</lastName> <company>{$this->shipToCompany}</company> <address>{$this->shipToAddress}</address> <city>{$this->shipToCity}</city> <state>{$this->shipToState}</state> <zip>{$this->shipToZip}</zip> <country>{$this->shipToCountry}</country> </shipTo> </subscription>"; $xml_clean = ""; // Remove any blank child elements foreach (preg_split("/(\r?\n)/", $xml) as $key => $line) { if (!preg_match('/><\//', $line)) { $xml_clean .= $line . "\n"; } } // Remove any blank parent elements $element_removed = 1; // Recursively repeat if a change is made while ($element_removed) { $element_removed = 0; if (preg_match('/<[a-z]+>[\r?\n]+\s*<\/[a-z]+>/i', $xml_clean)) { $xml_clean = preg_replace('/<[a-z]+>[\r?\n]+\s*<\/[a-z]+>/i', '', $xml_clean); $element_removed = 1; } } // Remove any blank lines // $xml_clean = preg_replace('/\r\n[\s]+\r\n/','',$xml_clean); return $xml_clean; } } /** * A class that contains all fields for an AuthorizeNet ARB SubscriptionList. * * @package AuthorizeNet * @subpackage AuthorizeNetARB */ class AuthorizeNet_GetSubscriptionList { public $searchType; public $sorting; public $paging; public function getXml() { $emptyString = ""; $sortingXml = (is_null($this->sorting)) ? $emptyString : $this->sorting->getXml(); $pagingXml = (is_null($this->paging)) ? $emptyString : $this->paging->getXml(); $xml = " <searchType>{$this->searchType}</searchType>" .$sortingXml .$pagingXml ; $xml_clean = ""; // Remove any blank child elements foreach (preg_split("/(\r?\n)/", $xml) as $key => $line) { if (!preg_match('/><\//', $line)) { $xml_clean .= $line . "\n"; } } // Remove any blank parent elements $element_removed = 1; // Recursively repeat if a change is made while ($element_removed) { $element_removed = 0; if (preg_match('/<[a-z]+>[\r?\n]+\s*<\/[a-z]+>/i', $xml_clean)) { $xml_clean = preg_replace('/<[a-z]+>[\r?\n]+\s*<\/[a-z]+>/i', '', $xml_clean); $element_removed = 1; } } // Remove any blank lines // $xml_clean = preg_replace('/\r\n[\s]+\r\n/','',$xml_clean); return $xml_clean; } } class paging { public $limit; public $offset; public function getXml() { $xml = "<paging> <limit>{$this->limit}</limit> <offset>{$this->offset}</offset> </paging>"; return $xml; } } class sorting { public $orderBy; public $orderDescending; public function getXml() { $xml = " <sorting> <orderBy>{$this->orderBy}</orderBy> <orderDescending>{$this->orderDescending}</orderDescending> </sorting>"; return $xml; } } |