Пример #1
0
 public function submitPayment()
 {
     $gateway = Omnipay::create('AuthorizeNet_AIM');
     $gateway->setApiLoginId(Config::get('vividstore.authnetLoginID'));
     $gateway->setTransactionKey(Config::get('vividstore.authnetTransactionKey'));
     $gateway->setDeveloperMode(Config::get('vividstore.authnetTestmode'));
     $customer = new StoreCustomer();
     $formData = array('firstName' => $customer->getValue("billing_first_name"), 'lastName' => $customer->getValue("billing_last_name"), 'billingPhone' => $customer->getValue("billing_phone"), 'email' => $customer->getEmail(), 'number' => $_POST['authnet-checkout-credit-card'], 'expiryMonth' => $_POST['authnet-checkout-exp-month'], 'expiryYear' => $_POST['authnet-checkout-exp-year'], 'cvv' => $_POST['authnet-checkout-ccv']);
     $response = $gateway->purchase(array('amount' => StoreCalculator::getGrandTotal(), 'currency' => 'USD', 'card' => $formData))->send();
     if ($response->isSuccessful()) {
         return array('error' => 0, 'transactionReference' => $response->getTransactionReference());
     } else {
         // payment failed: display message to customer
         return array('error' => 1, 'errorMessage' => $response->getMessage());
     }
 }
Пример #2
0
 public function getTotal()
 {
     echo StorePrice::format(StoreCalculator::getGrandTotal());
 }
Пример #3
0
 public function getTotal()
 {
     return StoreCalculator::getGrandTotal();
 }