예제 #1
0
 public function on_start()
 {
     $this->currentCart = CartObject::getCurrentCart();
     $this->set('cart', $this->currentCart);
     $this->set('order', $this->currentCart);
     $this->set('displayMode', 'full');
     $checkout = new CheckoutObject();
     $this->set('checkout', $checkout);
     Session::set('rcID', '/checkout');
     $this->requireAsset('css', 'fs_stepper_css');
     $this->requireAsset('css', 'razor_cart');
     $this->requireAsset('css', 'razor_checkout');
     $this->requireAsset('css', 'razor_css');
     $this->requireAsset('javascript', 'razor_js_paths');
     $this->requireAsset('javascript', 'fs_stepper_js');
     $this->requireAsset('javascript', 'jquery_validate');
     // payment setup
     $payment_methods = Payment::getMethods();
     foreach ($payment_methods as $payment_method) {
         $payment_method->setup($this);
     }
     $this->set('payment_methods', $payment_methods);
     $this->requireAsset('javascript', 'razor_cart');
     $this->requireAsset('javascript', 'razor_checkout');
     $this->requireAsset('javascript', 'razor_js');
 }
예제 #2
0
 public function processCheckoutForm($data)
 {
     $orderID = $data['order_id'];
     $amount = $data['amount'];
     $order = Order::getByID($orderID);
     // get or make user account
     $u = new User();
     $userExists = $u->isLoggedIn();
     if (!$userExists) {
         $ui = $this->addUserAccount($data);
     } else {
         $ui = UserInfo::getByID($u->getUserID());
     }
     // save user field data
     foreach ($data['akID'] as $key => $value) {
         Field::update($key, $value['value'], 'user');
     }
     // process payment
     $payment_type = $data['payment_type'];
     $payment_method = PaymentMethod::getByHandle($payment_type);
     $charge = $payment_method->process($order, $ui, $data);
     // record payment
     $typeReference = json_encode($charge);
     Payment::add($orderID, $payment_type, $amount, $typeReference);
     // update order status
     $order = Order::getByID($orderID);
     $order->updateStatus('checkout_complete');
     // redirect user to finish page
     return true;
 }
예제 #3
0
 public function on_start()
 {
     // this should all be set from the donation package, called from the PageType library class
     $this->currentCart = CartObject::getCurrentCart();
     $this->set('cart', $this->currentCart);
     $this->set('order', false);
     $this->set('displayMode', 'minimal');
     $checkout = new CheckoutObject();
     $this->set('checkout', $checkout);
     Session::set('rcID', '/checkout');
     $this->requireAsset('css', 'fs_stepper_css');
     $this->requireAsset('css', 'razor_css');
     $this->requireAsset('javascript', 'razor_js_paths');
     $this->requireAsset('javascript', 'fs_stepper_js');
     $this->requireAsset('javascript', 'jquery_validate');
     // payment setup
     $payment_methods = Payment::getMethods();
     foreach ($payment_methods as $payment_method) {
         $payment_method->setup($this);
     }
     $this->set('payment_methods', $payment_methods);
     $this->requireAsset('javascript', 'razor_js');
 }
예제 #4
0
 public function loadPaymentMethods()
 {
     return PaymentClass::getMethods();
 }
예제 #5
0
 public function getResult($queryRow)
 {
     $o = Payment::getByID($queryRow['paymentID']);
     return $o;
 }
예제 #6
0
 protected function install_extensions()
 {
     $ext = new Extension();
     // product types
     $productType = new Product();
     $productType->installDefaultTypes();
     // payment methods
     $payment = new Payment();
     $payment->installDefaultMethods();
     // shipping methods
     $shipping = new Shipping();
     $shipping->installDefaultMethods();
 }