public function ProcessPaymentForm($data = array()) { $postData = $this->_Validate($data); if ($postData === false) { return false; } // Is setup in test or live mode? $this->_testmode = $this->GetValue("testmode") == "YES"; // PaySimple accepts payments in cents $ccname = $postData['name']; $cctype = $postData['cctype']; $ccissueno = $postData['ccissueno']; $ccissuedatem = $postData['ccissuedatem']; $ccissuedatey = $postData['ccissuedatey']; $ccnum = $postData['ccno']; $ccexpm = $postData['ccexpm']; $ccexpy = $postData['ccexpy']; $cccvd = $postData['cccvd']; $billingDetails = $this->GetBillingDetails(); $testmode = ($this->GetValue('testmode') == 'YES'); $message = ''; try{ $gateway = new Gateway(); $gateway->production = !$testmode; $dynamicKey = new DynamicKey($this, $gateway); //Create Customer $customer = new Customer(); $BillingAddress = new Address(); $BillingAddress->AddressLine1 = $billingDetails['ordbillstreet1'] . ' ' . $billingDetails['ordbillstreet2']; $BillingAddress->City = $billingDetails['ordbillsuburb']; $BillingAddress->ZipCode = $billingDetails['ordbillzip']; $customer->BillingAddress = $BillingAddress; $customer->BillingCountryName = GetCountryISO3ById($billingDetails['ordbillcountryid']); $customer->ShippingAddress = $BillingAddress; $contact = new Contact(); $contact->EMail = $billingDetails['ordbillemail']; $contact->Phone1 = $billingDetails['ordbillphone']; $name = new Name(); $name->FirstName = $billingDetails['ordbillfirstname']; $name->LastName = $billingDetails['ordbilllastname']; $contact->Name = $name; $customer->Contact = $contact; $customer = $gateway->AddCustomer($dynamicKey->key, $customer); if ($gateway->isError()) { $message = $gateway->getErrorMessage(); } $account = new CustomerAccountDTO(); $account->IsCreditCard = true; $account->CreditCardNo = $ccnum; $account->CCExpiry = "20".$ccexpy."-".$ccexpm."-01T00:00:00"; $account->CCType = $cctype; $account->CustomerId = $customer; $account->CardName = $ccname; if (!$gateway->isError()) { $account = $gateway->AddAccount($dynamicKey->key, $account); } if ($gateway->isError()) { $message = $gateway->getErrorMessage(); } if (isset($account->Id)) { $PSpayment = new Payment(); if ($testmode) { $PSpayment->Amount = 120; } else { $PSpayment->Amount = $this->GetGatewayAmount(); } $PSpayment->CustomerId = $customer; $PSpayment->FromAccountId = $account->Id; $PSpayment->PaymentTypeCode = "CC"; $PSpayment->PaymentSubTypeCode = "MOTO"; if (!$gateway->isError()) { $PSpayment = $gateway->MakePayment($dynamicKey->key, $PSpayment, null); } if ($gateway->isError()) { $message = $gateway->getErrorMessage(); } } else { $PSpayment = $account; } } catch (Exception $e) { $message = $e; } return $this->_HandleResponse($PSpayment, $message); }