Exemplo n.º 1
0
 /**
  * Process Credit Card Payment
  */
 function processCard()
 {
     // Update contact information
     $billingContact = new ContactDBO($this->post['contactname'], null, null, $this->post['address1'], $this->post['address2'], $this->post['city'], $this->post['state'], $this->post['postalcode'], $this->post['country'], $this->post['phone'], null, null);
     // Format the expire date
     $expireDate = date("my", $this->post['cardexpire']);
     // Create a new Payment DBO and process the payment
     $paymentDBO = new PaymentDBO();
     $paymentDBO->setType("Module");
     $paymentDBO->setModule($_SESSION['module']->getName());
     $paymentDBO->setOrderID($this->session['order']->getID());
     $paymentDBO->setAmount($this->session['order']->getTotal());
     $paymentDBO->setStatus("Pending");
     if (!$paymentDBO->processCreditCard($billingContact, $this->post['cardnumber'], $expireDate, $this->post['cardcode'], $this->conf['payment_gateway']['order_method'])) {
         print "card error";
         $this->setError(array("type" => "[CC_PROCESSING_ERROR]"));
         $this->reload();
     }
     // Card processed, save the payment DBO
     add_PaymentDBO($paymentDBO);
     // Complete the order
     $_SESSION['order']->complete();
     // Show receipt
     $this->gotoPage("receipt");
 }