public function uninstall()
 {
     $paypal = PaymentMethod::getByHandle('paypal_express');
     if (is_object($paypal)) {
         $paypal->delete();
     }
     parent::uninstall();
 }
 public function validate($args, $e)
 {
     $pm = PaymentMethod::getByHandle('paypal_standard');
     if ($args['paymentMethodEnabled'][$pm->getPaymentMethodID()] == 1) {
         if ($args['paypalEmail'] == "") {
             $e->add(t("PayPal Email must be set"));
         }
     }
     return $e;
 }
 public function validate($args, $e)
 {
     $pm = PaymentMethod::getByHandle('auth_net');
     if ($args['paymentMethodEnabled'][$pm->getPaymentMethodID()] == 1) {
         if ($args['authnetTransactionKey'] == "") {
             $e->add(t("Transaction Key must be set"));
         }
         if ($args['authnetLoginID'] == "") {
             $e->add(t("Login ID must be set"));
         }
     }
     return $e;
 }
Beispiel #4
0
 public function uninstall()
 {
     $authnetpm = PaymentMethod::getByHandle('auth_net');
     if (is_object($authnetpm)) {
         $authnetpm->delete();
     }
     $invoicepm = PaymentMethod::getByHandle('invoice');
     if (is_object($invoicepm)) {
         $invoicepm->delete();
     }
     $paypalpm = PaymentMethod::getByHandle('paypal_standard');
     if (is_object($paypalpm)) {
         $paypalpm->delete();
     }
     $shippingMethodType = ShippingMethodType::getByHandle('flat_rate');
     if (is_object($shippingMethodType)) {
         $shippingMethodType->delete();
     }
     $shippingMethodType = ShippingMethodType::getByHandle('free_shipping');
     if (is_object($shippingMethodType)) {
         $shippingMethodType->delete();
     }
     parent::uninstall();
 }
Beispiel #5
0
 public function uninstall()
 {
     $authpm = PaymentMethod::getByHandle('auth_net');
     if (is_object($authpm)) {
         $authpm->delete();
     }
     $invoicepm = PaymentMethod::getByHandle('invoice');
     if (is_object($invoicepm)) {
         $invoicepm->delete();
     }
     parent::uninstall();
 }
Beispiel #6
0
 public static function installPaymentMethod($handle, $name, $pkg = null, $displayName = null, $enabled = false)
 {
     $pm = StorePaymentMethod::getByHandle($handle);
     if (!is_object($pm)) {
         StorePaymentMethod::add($handle, $name, $pkg, $displayName, $enabled);
     }
 }
Beispiel #7
0
 public function submit()
 {
     $data = $this->post();
     //process payment
     $pmHandle = $data['payment-method'];
     $pm = PaymentMethod::getByHandle($pmHandle);
     if (!$pm instanceof PaymentMethod) {
         //There was no payment method enabled somehow.
         //so we'll force invoice.
         $pm = PaymentMethod::getByHandle('invoice');
     } else {
         if ($pm->getMethodController()->external == true) {
             $pmsess = Session::get('paymentMethod');
             $pmsess[$pm->getPaymentMethodID()] = $data['payment-method'];
             Session::set('paymentMethod', $pmsess);
             $order = VividOrder::add($data, $pm, 'incomplete');
             Session::set('orderID', $order->getOrderID());
             $this->redirect('/checkout/external');
         } else {
             $payment = $pm->submitPayment();
             if ($payment['error'] == 1) {
                 $pmsess = Session::get('paymentMethod');
                 $pmsess[$pm->getPaymentMethodID()] = $data['payment-method'];
                 Session::set('paymentMethod', $pmsess);
                 $pesess = Session::get('paymentErrors');
                 $pesess = $payment['errorMessage'];
                 Session::set('paymentErrors', $pesess);
                 $this->redirect("/checkout/failed#payment");
             } else {
                 VividOrder::add($data, $pm);
                 $this->redirect('/checkout/complete');
             }
         }
     }
 }
Beispiel #8
0
 public function submit()
 {
     $data = $this->post();
     //process payment
     $pmHandle = $data['payment-method'];
     $pm = StorePaymentMethod::getByHandle($pmHandle);
     if ($pm === false) {
         //There was no payment method enabled somehow.
         //so we'll force invoice.
         $pm = StorePaymentMethod::getByHandle('invoice');
     }
     if ($pm->getMethodController()->external == true) {
         $pmsess = Session::get('paymentMethod');
         $pmsess[$pm->getPaymentMethodID()] = $data['payment-method'];
         Session::set('paymentMethod', $pmsess);
         $order = StoreOrder::add($data, $pm, null, 'incomplete');
         Session::set('orderID', $order->getOrderID());
         $this->redirect('/checkout/external');
     } else {
         $payment = $pm->submitPayment();
         if ($payment['error'] == 1) {
             $pmsess = Session::get('paymentMethod');
             $pmsess[$pm->getPaymentMethodID()] = $data['payment-method'];
             Session::set('paymentMethod', $pmsess);
             $errors = $payment['errorMessage'];
             Session::set('paymentErrors', $errors);
             $customer = new StoreCustomer();
             if ($customer->isGuest()) {
                 $this->redirect("/checkout/?guest=1#payment");
             } else {
                 $this->redirect("/checkout/failed#payment");
             }
         } else {
             $transactionReference = $payment['transactionReference'];
             StoreOrder::add($data, $pm, $transactionReference);
             $this->redirect('/checkout/complete');
         }
     }
 }