public function process($sProvider = '')
 {
     switch ($sProvider) {
         case 'paypal':
             $oPayPal = new PayPal($this->config->values['module.setting']['sandbox.enabled']);
             if ($oPayPal->valid() && $this->httpRequest->postExists('item_number') && $this->httpRequest->postExists('custom')) {
                 if ($this->oUserModel->updateMembership($this->httpRequest->post('item_number'), $this->httpRequest->post('custom', 'int'), $this->httpRequest->post('amount'), $this->dateTime->dateTime('Y-m-d H:i:s'))) {
                     $this->_bStatus = true;
                     // Status is OK
                     // PayPal will call automatically the "notification()" method thanks its IPN feature and "notify_url" form attribute.
                 }
             }
             unset($oPayPal);
             break;
         case 'stripe':
             if ($this->httpRequest->postExists('stripeToken')) {
                 \Stripe\Stripe::setApiKey($this->config->values['module.setting']['stripe.secret_key']);
                 $oCharge = \Stripe\Charge::create(array('source' => $this->httpRequest->post('stripeToken'), 'email' => $this->httpRequest->post('stripeEmail')));
                 if ($this->oUserModel->updateMembership($this->httpRequest->post('item_number'), $this->httpRequest->post('member_id', 'int'), $this->httpRequest->post('amount'), $this->dateTime->dateTime('Y-m-d H:i:s'))) {
                     $this->_bStatus = true;
                     // Status is OK
                     $this->notification('Stripe');
                     // Add info into the log file
                 }
             }
             break;
         case '2co':
             $o2CO = new TwoCO($this->config->values['module.setting']['sandbox.enabled']);
             $sVendorId = $this->config->values['module.setting']['2co.vendor_id'];
             $sSecretWord = $this->config->values['module.setting']['2co.secret_word'];
             if ($o2CO->valid($sVendorId, $sSecretWord) && $this->httpRequest->postExists('sale_id')) {
                 if ($this->oUserModel->updateMembership($this->httpRequest->post('sale_id'), $this->iProfileId, $this->httpRequest->post('price'), $this->dateTime->dateTime('Y-m-d H:i:s'))) {
                     $this->_bStatus = true;
                     // Status is OK
                     $this->notification('TwoCO');
                     // Add info into the log file
                 }
             }
             unset($o2CO);
             break;
         case 'ccbill':
             // In developing...
             // Contact us at <*****@*****.**> or <*****@*****.**> if you want to help us by developing the payment system CCBill
             break;
         default:
             $this->displayPageNotFound(t('Provinder Not Found!'));
     }
     // Set the page titles
     $this->sTitle = $this->_bStatus ? t('Thank you!') : t('Error occurred!');
     $this->view->page_title = $this->sTitle;
     $this->view->h2_title = $this->sTitle;
     if ($this->_bStatus) {
         $this->updateAffCom();
     }
     // Set the valid page
     $sPage = $this->_bStatus ? 'success' : 'error';
     $this->manualTplInclude($sPage . $this->view->getTplExt());
     // Output
     $this->output();
 }
 /**
  * @param object $oMembership The Object Membership Model.
  * @return void
  */
 public function buttonPayPal($oMembership)
 {
     $oPayPal = new PayPal($this->config->values['module.setting']['sandbox.enabled']);
     $oPayPal->param('business', $this->config->values['module.setting']['paypal.email'])->param('custom', $this->session->get('member_id'))->param('amount', $oMembership->price)->param('item_number', $oMembership->groupId)->param('item_name', $this->registry->site_name . ' ' . $oMembership->name)->param('no_note', 1)->param('no_shipping', 1)->param('currency_code', $this->config->values['module.setting']['currency'])->param('tax_cart', $this->config->values['module.setting']['vat_rate'])->param('return', Uri::get('payment', 'main', 'process', 'paypal'))->param('rm', 2)->param('notify_url', Uri::get('payment', 'main', 'notification', 'PayPal'))->param('cancel_return', Uri::get('payment', 'main', 'pay', '?msg=' . t('The payment was aborted, no changes have been made to your account.'), false));
     echo '<form action="', $oPayPal->getUrl(), '" method="post">', $oPayPal->generate(), '<button type="submit" name="submit">', static::buyTxt($oMembership->name, 'PayPal'), '</button>
     </form>';
     unset($oPayPal, $oMembership);
 }