/**
  *
  * @param object $order
  * @param array $methods
  * @param integer $method_id
  */
 public function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     //
     //
     $this->response = $this->generateTransaction($order, $method_id);
     // Store the Access Code directly in the order object
     //
     if (!$this->response->getErrors()) {
         $update_order = new stdClass();
         $update_order->order_id = (int) $order->order_id;
         $update_order->order_payment_params = @$order->order_payment_params;
         if (!empty($update_order->order_payment_params) && is_string($update_order->order_payment_params)) {
             $update_order->order_payment_params = unserialize($update_order->order_payment_params);
         }
         if (empty($update_order->order_payment_params)) {
             $update_order->order_payment_params = new stdClass();
         }
         $update_order->order_payment_params->eway_accesscode = $this->response->AccessCode;
         $orderClass = hikashop_get('class.order');
         $orderClass->save($update_order);
     } else {
         $app = JFactory::getApplication();
         $error_msg = array();
         foreach ($this->response->getErrors() as $error) {
             $error_mgs[] = eWayRapidBridge::getErrorMessage(trim($error));
         }
         $this->app->enqueueMessage('eWay Errors<br/>' . implode('<br/>', $error_msgs), 'error');
     }
     return $this->showPage('end');
 }
Example #2
0
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     // This is a mandatory line in order to initialize the attributes of the payment method
     //Here we can do some checks on the options of the payment method and make sure that every required parameter is set and otherwise display an error message to the user
     if (empty($this->payment_params->identifier)) {
         $this->app->enqueueMessage('You have to configure an identifier for the Mpesa plugin payment first : check your plugin\'s parameters, on your website backend', 'error');
         //Enqueued messages will appear to the user, as Joomla's error messages
         return false;
     } elseif (empty($this->payment_params->password)) {
         $this->app->enqueueMessage('You have to configure a password for the Mpesa plugin payment first : check your plugin\'s parameters, on your website backend', 'error');
         return false;
     } elseif (empty($this->payment_params->payment_url)) {
         $this->app->enqueueMessage('You have to configure a payment url for the Mpesa plugin payment first : check your plugin\'s parameters, on your website backend', 'error');
         return false;
     } else {
         //Here, all the required parameters are valid, so we can proceed to the payment platform
         $amout = round($order->cart->full_total->prices[0]->price_value_with_tax, 2) * 100;
         //The order's amount, here in cents and rounded with 2 decimals because of the payment plateform's requirements
         //There is a lot of information in the $order variable, such as price with/without taxes, customer info, products... you can do a var_dump here if you need to display all the available information
         //This array contains all the required parameters by the payment plateform
         //Not all the payment platforms will need all these parameters and they will probably have a different name.
         //You need to look at the payment gateway integration guide provided by the payment gateway in order to know what is needed here
         $vars = array('IDENTIFIER' => $this->payment_params->identifier, 'CLIENTIDENT' => $order->order_user_id, 'DESCRIPTION' => "order number : " . $order->order_number, 'ORDERID' => $order->order_id, 'VERSION' => 2.0, 'AMOUNT' => $amout);
         $vars['HASH'] = $this->mpesa_signature($this->payment_params->password, $vars);
         //Hash generated to certify the values integrity
         //This hash is generated according to the plateform requirements
         $this->vars = $vars;
         //Ending the checkout, ready to be redirect to the plateform payment final form
         //The showPage function will call the mpesa_end.php file which will display the redirection form containing all the parameters for the payment platform
         return $this->showPage('end');
     }
 }
Example #3
0
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     if (empty($this->payment_params->identifier)) {
         $this->app->enqueueMessage(JText::sprintf('CONFIGURE_X_PAYMENT_PLUGIN_ERROR', 'an identifer', 'Paygate'), 'error');
         return false;
     } elseif (empty($this->payment_params->key)) {
         $this->app->enqueueMessage(JText::sprintf('CONFIGURE_X_PAYMENT_PLUGIN_ERROR', 'a key', 'Paygate'), 'error');
         return false;
     } elseif (empty($this->payment_params->payment_url)) {
         $this->app->enqueueMessage(JText::sprintf('CONFIGURE_X_PAYMENT_PLUGIN_ERROR', 'a payment url', 'Paygate'), 'error');
         return false;
     } else {
         $date = date('Y-m-d h:i:s');
         $reference = $order->order_id . '-' . $order->order_number;
         $currency = $this->currency->currency_code;
         $amout = round($order->cart->full_total->prices[0]->price_value_with_tax, 2) * 100;
         $notif_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=notify&amp;notif_payment=' . $this->name . '&tmpl=component';
         if ($this->payment_params->sandbox) {
             $id = '10011013800';
             $key = 'secret';
         } else {
             $id = $this->payment_params->identifier;
             $key = $this->payment_params->key;
         }
         $vars = array('PAYGATE_ID' => $id, 'REFERENCE' => $reference, 'AMOUNT' => $amout, 'CURRENCY' => $currency, 'RETURN_URL' => $notif_url, 'TRANSACTION_DATE' => $date);
         $vars['CHECKSUM'] = $this->paygate_signature($key, $vars);
         if ($this->payment_params->debug) {
             var_dump($vars);
         }
         $this->vars = $vars;
         return $this->showPage('end');
     }
 }
Example #4
0
    function onAfterOrderConfirm(&$order, &$methods, $method_id)
    {
        parent::onAfterOrderConfirm($order, $methods, $method_id);
        if ($this->payment_params->testingMode == true) {
            $this->payment_params->url = "https://sandbox.google.com/checkout/inapp/lib/buy.js";
        } else {
            $this->payment_params->url = "https://wallet.google.com/inapp/lib/buy.js";
        }
        if (empty($this->payment_params->sellerIdentifier)) {
            $this->app->enqueueMessage('You have to configure an seller Identifier for the googlewallet plugin payment first : check your plugin\'s parameters,
			on your website backend', 'error');
            return false;
        }
        if (empty($this->payment_params->sellerSecret)) {
            $this->app->enqueueMessage('You have to configure the seller Secret for the googlewallet plugin payment first : check your plugin\'s parameters,
			on your website backend', 'error');
            return false;
        }
        $amount = round($order->cart->full_total->prices[0]->price_value_with_tax, 2);
        $succes_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=after_end&order_id=' . $order->order_id . $this->url_itemid;
        $cancel_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=order&task=cancel_order&order_id=' . $order->order_id . $this->url_itemid;
        $this->payment_params->succes_url = $succes_url;
        $this->payment_params->cancel_url = $cancel_url;
        $vars = array('iss' => trim($this->payment_params->sellerIdentifier), 'aud' => "Google", 'typ' => "google/payments/inapp/item/v1", 'exp' => time() + 3600, 'iat' => time(), 'request' => array('name' => $order->order_number, 'description' => "", 'price' => $amount, 'currencyCode' => $this->currency->currency_code, 'sellerData' => $order->order_id));
        $sellerSecret = $this->payment_params->sellerSecret;
        $token = JWT::encode($vars, $sellerSecret);
        $this->token = $token;
        $this->showPage('end');
        if ($this->payment_params->debug) {
            $this->writeToLog("Data send to googlewallet: \n\n\n" . print_r($vars, true));
        }
    }
Example #5
0
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     $httpsHikashop = HIKASHOP_LIVE;
     //str_replace('http://','https://', HIKASHOP_LIVE);
     $notify_url = $httpsHikashop . 'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=cmcic&tmpl=component&orderId=' . $order->order_id . '&lang=' . $this->locale;
     $return_url = $httpsHikashop . 'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=cmcic&tmpl=component&cmcic_return=1&orderId=' . $order->order_id . '&lang=' . $this->locale;
     $localeCM = 'FR';
     if (in_array($this->locale, array('fr', 'en', 'de', 'it', 'es', 'nl', 'pt'))) {
         $localCM = strtoupper($this->locale);
     }
     if (@$this->payment_params->sandbox) {
         $urls = array('cm' => 'https://paiement.creditmutuel.fr/test/paiement.cgi', 'cic' => 'https://ssl.paiement.cic-banques.fr/test/paiement.cgi', 'obc' => 'https://ssl.paiement.banque-obc.fr/test/paiement.cgi');
     } else {
         $urls = array('cm' => 'https://paiement.creditmutuel.fr/paiement.cgi', 'cic' => 'https://ssl.paiement.cic-banques.fr/paiement.cgi', 'obc' => 'https://ssl.paiement.banque-obc.fr/paiement.cgi');
     }
     if (!isset($this->payment_params->bank) || !isset($urls[$this->payment_params->bank])) {
         $this->payment_params->bank = 'cm';
     }
     $this->url = $urls[$this->payment_params->bank];
     $this->vars = array('TPE' => trim($this->payment_params->tpe), 'date' => date('d/m/Y:H:i:s'), 'montant' => number_format($order->cart->full_total->prices[0]->price_value_with_tax, 2, '.', '') . $this->currency->currency_code, 'reference' => $order->order_number, 'texte-libre' => '', 'version' => '3.0', 'lgue' => $localeCM, 'societe' => trim($this->payment_params->societe), 'mail' => $this->user->user_email);
     $this->vars['MAC'] = $this->generateHash($this->vars, $this->payment_params->key, 19);
     if (@$this->payment_params->debug) {
         echo 'Data sent<pre>' . var_export($this->vars, true) . '</pre>';
     }
     $this->vars['url_retour'] = HIKASHOP_LIVE . 'index.php?option=com_hikashop';
     $this->vars['url_retour_ok'] = $return_url;
     $this->vars['url_retour_err'] = $return_url;
     $this->showPage('end');
     return true;
 }
Example #6
0
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     if ($this->payment_params->testingMode == true) {
         $this->payment_params->url = "https://sandbox.payfast.co.za/eng/process";
     } else {
         $this->payment_params->url = "https://www.payfast.co.za/eng/process";
     }
     if (empty($this->payment_params->merchant_id)) {
         $this->app->enqueueMessage('You have to configure an merchant id for the payfast plugin payment first : check your plugin\'s parameters, on your website backend', 'error');
         return false;
     }
     if (empty($this->payment_params->merchant_key)) {
         $this->app->enqueueMessage('You have to configure the merchant key for the payfast plugin payment first : check your plugin\'s parameters, on your website backend', 'error');
         return false;
     }
     $amount = round($order->cart->full_total->prices[0]->price_value_with_tax, 2);
     $notify_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=' . $this->name . '&tmpl=component&lang=' . $this->locale . $this->url_itemid;
     $return_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=after_end&order_id=' . $order->order_id . $this->url_itemid;
     $cancel_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=order&task=cancel_order&order_id=' . $order->order_id . $this->url_itemid;
     $vars = array('merchant_id' => trim($this->payment_params->merchant_id), 'merchant_key' => trim($this->payment_params->merchant_key), 'return_url' => $return_url, 'cancel_url' => $cancel_url, 'notify_url' => $notify_url, 'name_first' => substr(@$order->cart->billing_address->address_firstname, 0, 99), 'name_last' => substr(@$order->cart->billing_address->address_lastname, 0, 99), 'email_address' => substr($this->user->user_email, 0, 99), 'm_payment_id' => (int) $order->order_id, 'amount' => $amount, 'item_name' => $order->order_number);
     $this->vars = $vars;
     $pfOutput = array();
     foreach ($vars as $key => $val) {
         if (!empty($val)) {
             $pfOutput[] = $key . '=' . urlencode(trim($val));
         }
     }
     $getString = implode('&', $pfOutput);
     $vars['signature'] = md5($getString);
     if ($this->payment_params->debug) {
         $this->writeToLog("Data sent to PayFast: \n\n" . print_r($vars, true));
     }
     return $this->showPage('end');
 }
Example #7
0
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     $address = $this->app->getUserState(HIKASHOP_COMPONENT . '.billing_address');
     if (!empty($address)) {
         $firstname = @$order->cart->billing_address->address_firstname;
         $lastname = @$order->cart->billing_address->address_lastname;
         $address1 = '';
         if (!empty($order->cart->billing_address->address_street)) {
             $address1 = substr($order->cart->billing_address->address_street, 0, 200);
         }
         $zip = @$order->cart->billing_address->address_post_code;
         $city = @$order->cart->billing_address->address_city;
         $state = @$order->cart->billing_address->address_state->zone_code_3;
         $country = @$order->cart->billing_address->address_country->zone_code_2;
         $email = $this->user->user_email;
         $phone = @$order->cart->billing_address->address_telephone;
     }
     $notify_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=alipay&tmpl=component&lang=' . $this->locale . $this->url_itemid;
     $return_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=after_end&order_id=' . $order->order_id . $this->url_itemid;
     $out_trade_no = $order->order_id;
     if ($this->payment_params->Mode == "Partner") {
         $order_params = array("seller_email" => $this->payment_params->email, "service" => "create_partner_trade_by_buyer", "partner" => $this->payment_params->partner_id, "return_url" => $return_url, "notify_url" => $notify_url, "_input_charset" => "utf-8", "subject" => 'order number : ' . $out_trade_no, "body" => '', "out_trade_no" => $out_trade_no, "payment_type" => "1", "price" => round($order->order_full_price, (int) $this->currency->currency_locale['int_frac_digits']), "quantity" => "1", "logistics_type" => "EXPRESS", "logistics_fee" => "0.00", "logistics_payment" => "BUYER_PAY", 'receive_name' => $lastname . ' ' . $firstname, 'receive_address' => $address1, 'receive_zip' => $zip, 'receive_phone' => $phone);
     } else {
         $order_params = array("seller_email" => $this->payment_params->email, "service" => "create_direct_pay_by_user", "partner" => $this->payment_params->partner_id, "return_url" => $return_url, "notify_url" => $notify_url, "_input_charset" => "utf-8", "subject" => 'order number : ' . $out_trade_no, "body" => '', "out_trade_no" => $out_trade_no, "payment_type" => "1", "total_fee" => round($order->order_full_price, (int) $this->currency->currency_locale['int_frac_digits']));
     }
     $alipay = new alipay();
     $alipay->set_order_params($order_params);
     $alipay->set_transport($this->payment_params->transport);
     $alipay->set_security_code($this->payment_params->security_code);
     $alipay->set_sign_type($this->payment_params->sign_type);
     $sign = $alipay->_sign($alipay->_order_params);
     $this->payment_params->url = $alipay->create_payment_link();
     return $this->showPage('end');
 }
Example #8
0
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     // This is a mandatory line in order to initialize the attributes of the payment method
     $notify_url = HIKASHOP_LIVE . 'paypaladvanced_' . $method_id . '_' . $this->payment_params->secret_code . '.php';
     $cancel_url = HIKASHOP_LIVE . 'paypaladvanced_cancel_' . $method_id . '.php';
     $return_url = HIKASHOP_LIVE . 'paypaladvanced_return_' . $method_id . '.php';
     //return URL to the page of redirection created in onPaymentConfigurationSave(), this can't change
     $vars = array('USER' => $this->payment_params->user, 'PWD' => $this->payment_params->password, 'VENDOR' => $this->payment_params->vendor, 'PARTNER' => $this->payment_params->partner, 'SECURETOKENID' => uniqid('', true), 'SECURETOKEN' => '', 'AMT' => @round($order->cart->order_full_price, (int) $this->currency->currency_locale['int_frac_digits']), 'SILENT_POST_URL' => $notify_url, 'RETURN_URL' => $return_url, 'CANCEL_URL' => $cancel_url, 'CURRENCYCODE' => $this->currency->currency_code, 'EMAIL' => $this->user->user_email, 'HOST_ADDR' => 'https://payflowpro.paypal.com');
     if ($this->payment_params->test_mode == '1') {
         //if we are in test mode, the adress isn't the same
         $vars['HOST_ADDR'] = 'https://pilot-payflowpro.paypal.com';
     }
     $type = @$this->payment_params->validation ? 'A' : 'S';
     $postdata = "USER="******"&VENDOR=" . $vars['VENDOR'] . "&PARTNER=" . $vars['PARTNER'] . "&PWD=" . $vars['PWD'] . "&CREATESECURETOKEN=" . 'Y' . "&SECURETOKENID=" . $vars['SECURETOKENID'] . "&TRXTYPE=" . $type . "&AMT=" . $vars['AMT'] . "&CURRENCY=" . $vars['CURRENCYCODE'] . "&SHOWAMOUNT=TRUE" . "&INVNUM=" . $order->order_id . "&SILENTPOSTURL=" . $vars['SILENT_POST_URL'] . "&RETURNURL=" . $vars['RETURN_URL'] . "&CANCELURL=" . $vars['CANCEL_URL'] . "&BILLTOEMAIL=" . $vars['EMAIL'] . "&BILLTOFIRSTNAME=" . @$order->cart->billing_address->address_firstname . "&BILLTOLASTNAME=" . @$order->cart->billing_address->address_lastname . "&BILLTOSTREET=" . @$order->cart->billing_address->address_street . "&BILLTOCITY=" . @$order->cart->billing_address->address_city . "&BILLTOZIP=" . @$order->cart->billing_address->address_post_code . "&BILLTOSTATE=" . @$order->cart->billing_address->address_state->zone_name . "&BILLTOCOUNTRY=" . @$order->cart->billing_address->address_country->zone_code_2 . "&SHIPTOFIRSTNAME=" . @$order->cart->shipping_address->address_firstname . "&SHIPTOLASTNAME=" . @$order->cart->shipping_address->address_lastname . "&SHIPTOSTREET=" . @$order->cart->shipping_address->address_street . "&SHIPTOCITY=" . @$order->cart->shipping_address->address_city . "&SHIPTOZIP=" . @$order->cart->shipping_address->address_post_code . "&SHIPTOSTATE=" . @$order->cart->shipping_address->address_state->zone_name . "&SHIPTOCOUNTRY=" . @$order->cart->shipping_address->address_country->zone_code_2;
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $vars['HOST_ADDR']);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
     curl_setopt($ch, CURLOPT_POST, TRUE);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
     $resp = curl_exec($ch);
     if (!$resp) {
         echo "<p>No response from PayPal's servers, please try again. </p>";
     }
     $arr = null;
     parse_str($resp, $arr);
     if ($arr['RESULT'] != 0) {
         echo "<p>An error has occurred, please try again.</p>";
     }
     $vars['SECURETOKEN'] = $arr['SECURETOKEN'];
     $this->vars = $vars;
     return $this->showPage('end');
 }
Example #9
0
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     if (empty($this->payment_params->sessionvalidity)) {
         $this->payment_params->sessionvalidity = 1;
     }
     if (empty($this->payment_params->merchantaccount)) {
         $this->app->enqueueMessage('You have to configure a merchant account for the adyen plugin payment first : check your plugin\'s parameters, on your website backend', 'error');
         return false;
     }
     if (empty($this->payment_params->skincode)) {
         $this->app->enqueueMessage('You have to configure the Skin Code for the adyen plugin payment first : check your plugin\'s parameters, on your website backend', 'error');
         return false;
     } elseif (empty($this->payment_params->hmacKey)) {
         $this->app->enqueueMessage('You have to configure the Hmac Key for the adyen plugin payment first : check your plugin\'s parameters, on your website backend', 'error');
         return false;
     }
     $amount = round($order->cart->full_total->prices[0]->price_value_with_tax, 2) * 100;
     list($shipping_house, $shipping_street) = $this->splitStreet($order->cart->shipping_address->address_street);
     list($billing_house, $billing_street) = $this->splitStreet($order->cart->billing_address->address_street);
     $resURL = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=adyen&tmpl=component' . $this->url_itemid;
     $vars = array('merchantReference' => $order->order_id, 'paymentAmount' => $amount, 'currencyCode' => $this->currency->currency_code, 'shipBeforeDate' => date('Y-m-d', strtotime('+3 days')), 'skinCode' => trim($this->payment_params->skincode), 'merchantAccount' => trim($this->payment_params->merchantaccount), 'sessionValidity' => date('c', strtotime('+' . (int) $this->payment_params->sessionvalidity . ' days')), 'shopperLocale' => trim($this->payment_params->language_code), 'shopperEmail' => $this->user->user_email, 'shopperReference' => $this->user->user_id, 'resURL' => $resURL, 'allowedMethods' => preg_replace('#[^a-z0-9_\\-,]#i', '', $this->payment_params->allowedmethods), 'blockedMethods' => preg_replace('#[^a-z0-9_\\-,]#i', '', $this->payment_params->blockedmethods), 'billingAddress.street' => $billing_street, 'billingAddress.houseNumberOrName' => $billing_house, 'billingAddress.city' => $order->cart->billing_address->address_city, 'billingAddress.stateOrProvince' => $order->cart->billing_address->address_state->zone_name, 'billingAddress.country' => $order->cart->billing_address->address_country->zone_code_2, 'billingAddress.postalCode' => @$order->cart->billing_address->address_post_code, 'deliveryAddress.street' => $shipping_street, 'deliveryAddress.houseNumberOrName' => $shipping_house, 'deliveryAddress.city' => $order->cart->shipping_address->address_city, 'deliveryAddress.postalCode' => @$order->cart->shipping_address->address_post_code, 'deliveryAddress.stateOrProvince' => @$order->cart->shipping_address->address_state->zone_name, 'deliveryAddress.country' => $order->cart->shipping_address->address_country->zone_code_2, 'shopper.firstName' => @$order->cart->billing_address->address_firstname, 'shopper.lastName' => @$order->cart->billing_address->address_lastname, 'shopper.telephoneNumber' => @$order->cart->billing_address->address_telephone);
     $vars['merchantSig'] = base64_encode(pack('H*', hash_hmac('sha1', $vars['paymentAmount'] . $vars['currencyCode'] . $vars['shipBeforeDate'] . $vars['merchantReference'] . $vars['skinCode'] . $vars['merchantAccount'] . $vars['sessionValidity'] . $vars['shopperEmail'] . $vars['shopperReference'] . $vars['allowedMethods'] . $vars['blockedMethods'], trim($this->payment_params->hmacKey))));
     $vars['billingAddressSig'] = base64_encode(pack('H*', hash_hmac('sha1', $vars['billingAddress.street'] . $vars['billingAddress.houseNumberOrName'] . $vars['billingAddress.city'] . $vars['billingAddress.postalCode'] . $vars['billingAddress.stateOrProvince'] . $vars['billingAddress.country'], trim($this->payment_params->hmacKey))));
     $vars['deliveryAddressSig'] = base64_encode(pack('H*', hash_hmac('sha1', $vars['deliveryAddress.street'] . $vars['deliveryAddress.houseNumberOrName'] . $vars['deliveryAddress.city'] . $vars['deliveryAddress.postalCode'] . $vars['deliveryAddress.stateOrProvince'] . $vars['deliveryAddress.country'], trim($this->payment_params->hmacKey))));
     $vars['shopperSig'] = base64_encode(pack('H*', hash_hmac('sha1', $vars['shopper.firstName'] . $vars['shopper.lastName'] . $vars['shopper.telephoneNumber'], trim($this->payment_params->hmacKey))));
     $this->vars = $vars;
     return $this->showPage('end');
 }
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     //Order Header values
     $totalAmount = round($order->order_full_price, (int) $this->currency->currency_locale['int_frac_digits']);
     $orderId = $order->order_id;
     //Option values
     $paymentSuccessfulURL = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=netgiro&lang=' . $this->locale . $this->url_itemid;
     $cancelUrl = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=order&task=cancel_order&order_id=' . $orderId . $this->url_itemid;
     $applicationId = $this->payment_params->application_id;
     $secretKey = $this->payment_params->secret_key;
     $maxInstallments = $this->payment_params->max_installments;
     $returnCustomerInfo = 'false';
     /*showP1 = show pay later option (14 days delay in payment)
      *showP2 = show partial payments
      *showP3 = show partial payments without interest
      */
     $paymentOptions = new paymentOptionsCls();
     $paymentOptions->showP1 = $this->payment_params->payment_opt1;
     $paymentOptions->showP2 = $this->payment_params->payment_opt2;
     $paymentOptions->showP3 = $this->payment_params->payment_opt3;
     //Signature - Signature for the message, calculated as SHA256(SecretKey + OrderId + TotalAmount + ApplicationId)
     $signature = hash('sha256', $secretKey . $orderId . $totalAmount . $applicationId);
     switch ($this->payment_params->mode) {
         case 'LIVE':
             $netGiropaymentUrl = 'https://www.netgiro.is/SecurePay';
             break;
         case 'TEST':
             $netGiropaymentUrl = 'http://test.netgiro.is/user/securepay';
             break;
         default:
             $netGiropaymentUrl = 'http://test.netgiro.is/user/securepay';
             break;
     }
     // Values that will be posted to Netgiro
     $vars = array('ApplicationID' => $applicationId, 'Signature' => $signature, 'PaymentSuccessfulURL' => $paymentSuccessfulURL, 'PaymentCancelledURL' => $cancelUrl, 'ReturnCustomerInfo' => 'false', 'Iframe' => 'false', 'OrderId' => $orderId, 'TotalAmount' => $totalAmount, 'MaxNumberOfInstallments' => $maxInstallments);
     //Order Item values
     $n = 0;
     foreach ($order->cart->products as $product) {
         $productPrice = round($product->order_product_price, (int) $this->currency->currency_locale['int_frac_digits']);
         $tax = round($product->order_product_tax, (int) $this->currency->currency_locale['int_frac_digits']);
         $unitPrice = $productPrice + $tax;
         $productAmount = round($product->order_product_total_price, (int) $this->currency->currency_locale['int_frac_digits']);
         //Quantity should be passed in 1/1000 units. For example if the quantity is 2 then it should be represented as 2000
         $quantity = $product->order_product_quantity * 1000;
         $vars["Items[{$n}].ProductNo"] = $product->order_product_code;
         $vars["Items[{$n}].Name"] = $product->order_product_name;
         $vars["Items[{$n}].UnitPrice"] = $unitPrice;
         $vars["Items[{$n}].Quantity"] = $quantity;
         $vars["Items[{$n}].Amount"] = $productAmount;
         $n++;
     }
     $this->vars = $vars;
     $this->netGiropaymentUrl = $netGiropaymentUrl;
     $this->paymentOptions = $paymentOptions;
     $this->appId = $applicationId;
     //call the netgiro_end.php
     return $this->showPage('end');
 }
Example #11
0
    function onAfterOrderConfirm(&$order, &$methods, $method_id)
    {
        parent::onAfterOrderConfirm($order, $methods, $method_id);
        // echo HIKASHOP_LIVE.'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment='.$this->name;
        // die;
        $amount = $order->cart->full_total->prices[0]->price_value_with_tax;
        $url = JURI::root() . 'plugins/hikashoppayment/ubrir/catcher.php?id=' . $order->order_number;
        $readyToPay = false;
        // возможность платежа
        $bankHandler = new Ubrir(array('shopId' => $this->payment_params->twpg_id, 'order_id' => $order->order_number, 'sert' => $this->payment_params->twpg_private_pass, 'amount' => $amount, 'approve_url' => $url, 'cancel_url' => $url, 'decline_url' => $url));
        $response_order = $bankHandler->prepare_to_pay();
        // что вернул банк
        if (!empty($response_order)) {
            $db = JFactory::getDBO();
            $sql = " INSERT INTO #__twpg_orders  \n\t\t\t(`shoporderid`, `OrderID`, `SessionID`) \n\t\t\tVALUES  \n\t\t\t('" . $order->order_number . "', '" . $response_order->OrderID[0] . "', '" . $response_order->SessionID[0] . "') ";
            $db->setQuery($sql);
            if (!$db->query()) {
                exit('error_1101');
            }
        } else {
            switch ($response_order) {
                case 30:
                    echo 'Неверный формат сообщения';
                    break;
                case 10:
                    echo 'ИМ не имеет доступа к этой операции';
                    break;
                case 54:
                case 96:
                    echo 'недопустимая операция';
                    break;
            }
            exit;
        }
        $twpg_url = $response_order->URL[0] . '?orderid=' . $response_order->OrderID[0] . '&sessionid=' . $response_order->SessionID[0];
        echo '<p>Данный заказ необходимо оплатить одним из методов, приведенных ниже: </p> <INPUT TYPE="button" value="Оплатить Visa" onclick="document.location = \'' . $twpg_url . '\'">';
        if ($this->payment_params->two == 1) {
            $id = trim($this->payment_params->uniteller_id);
            $login = trim($this->payment_params->uniteller_login);
            $pass = trim($this->payment_params->uniteller_pass);
            $orderid = $order->order_number;
            $amount = round($amount, 2);
            $sign = strtoupper(md5(md5($id) . '&' . md5($login) . '&' . md5($pass) . '&' . md5($orderid) . '&' . md5($amount)));
            echo '<form action="https://91.208.121.201/estore_listener.php" name="uniteller" method="post" hidden>
			  <input type="number" name="SHOP_ID" value="' . $id . '">
			  <input type="text" name="LOGIN" value="' . $login . '">
			  <input type="text" name="ORDER_ID" value="' . $orderid . '">
			  <input type="number" name="PAY_SUM" value="' . $amount . '">
			  <input type="text" name="VALUE_1" value="' . $orderid . '">
			  <input type="text" name="URL_OK" value="' . JURI::root() . 'plugins/hikashoppayment/ubrir/catcher.php?status=ok&">
			  <input type="text" name="URL_NO" value="' . JURI::root() . 'plugins/hikashoppayment/ubrir/catcher.php?status=no&">
			  <input type="text" name="SIGN" value="' . $sign . '">
			  <input type="text" name="LANG" value="RU">
			</form>';
            // die;
            echo '<INPUT TYPE="button" value="Оплатить MasterCard" onclick="document.forms.uniteller.submit()">';
        }
    }
Example #12
0
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     $this->methods = $methods;
     $this->method_id = $method_id;
     $this->amount_total = round($order->cart->full_total->prices[0]->price_value_with_tax, 2) * 100;
     $this->id_pedido = $order->order_id;
     return $this->showPage('end');
 }
Example #13
0
File: epay.php Project: rodhoff/MNW
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     if (empty($this->payment_params)) {
         return false;
     }
     $this->vars = $this->getVars($order);
     return $this->showPage('end');
 }
Example #14
0
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     $plugin = $this->loadCurrentPlugin($order->order_payment_id, $this->payment_params->common_payment_plugin);
     if (!is_object($plugin) || !method_exists($plugin, 'onTP_GetHTML')) {
         return '';
     }
     echo $plugin->onTP_GetHTML($this->_loadVars($order));
 }
Example #15
0
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     if (!$this->init()) {
         return false;
     }
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     $this->notifyurl = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=' . $this->name . '&tmpl=component&orderid=' . $order->order_id;
     $this->order =& $order;
     return $this->showPage('end');
 }
Example #16
0
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     if ($order->order_status != $this->payment_params->order_status) {
         $this->modifyOrder($order->order_id, $this->payment_params->order_status, (bool) @$this->payment_params->status_notif_email, false);
     }
     $this->removeCart = true;
     $currencyClass = hikashop_get('class.currency');
     $this->amount = $currencyClass->format($order->order_full_price, $order->order_currency_id);
     $this->order_number = $order->order_number;
     $this->showPage('end');
 }
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     // adding PagSeguro API
     require_once 'PagSeguroLibrary/PagSeguroLibrary.php';
     $notify_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=pagseguro&tmpl=component&invoice=' . $order->order_id;
     $return_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=after_end&order_id=' . $order->order_id . $this->url_itemid;
     // performing PagSeguro transaction
     $pagSeguroPaymentRequest = $this->_generatePagSeguroRequestData($order, $notify_url, $return_url);
     $url = $this->_performPagSeguroRequest($pagSeguroPaymentRequest);
     $this->payment_params->url = $url;
     return $this->showPage('end');
 }
Example #18
0
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     $method =& $methods[$method_id];
     $this->modifyOrder($order->order_id, $method->payment_params->order_status, @$method->payment_params->status_notif_email, false);
     $this->removeCart = true;
     $this->information = $method->payment_params->information;
     if (preg_match('#^[a-z0-9_]*$#i', $this->information)) {
         $this->information = JText::_($this->information);
     }
     $currencyClass = hikashop_get('class.currency');
     $this->amount = $currencyClass->format($order->order_full_price, $order->order_currency_id);
     $this->order_number = $order->order_number;
     return $this->showPage('end');
 }
Example #19
0
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     if ($this->currency->currency_locale['int_frac_digits'] > 2) {
         $this->currency->currency_locale['int_frac_digits'] = 2;
     }
     $notify_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=' . $this->name . '&tmpl=component&lang=' . $this->locale . $this->url_itemid;
     $return_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=after_end&order_id=' . $order->order_id . $this->url_itemid;
     $cancel_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=order&task=cancel_order&order_id=' . $order->order_id . $this->url_itemid;
     $cc_type = JRequest::getVar('cc_type', '');
     $this->MerchantSecretKey = $this->payment_params->MerchantSecretKey;
     $request["MerchantGuid"] = $this->MerchantGuid = $this->payment_params->MerchantGuid;
     $request['SelectedPaySystemId'] = isset($cc_type) ? $cc_type : $this->GetMerchnatInfo(false, true);
     $request['Currency'] = $this->currency->currency_code;
     $request['Language'] = $this->locale;
     $sum = $qty = 0;
     foreach ($order->cart->products as $product) {
         if ($product->order_product_option_parent_id) {
             continue;
         }
         $request['Products'][] = array("ProductId" => $product->product_id, "ProductName" => substr(strip_tags($product->order_product_name), 0, 127), "ProductPrice" => round($product->order_product_price, (int) $this->currency->currency_locale['int_frac_digits']), "ProductItemsNum" => $product->order_product_quantity, "ImageUrl" => '');
         $sum += round($product->order_product_price, (int) $this->currency->currency_locale['int_frac_digits']) * $product->order_product_quantity;
         $qty += $product->order_product_quantity;
     }
     $amount = round($order->cart->full_total->prices[0]->price_value_with_tax, (int) $this->currency->currency_locale['int_frac_digits']);
     if ($sum != $amount) {
         $sum += $order_info_total = (int) ($amount - $sum);
         $request['Products'][] = array("ProductId" => '1', "ProductName" => 'Delivery', "ProductPrice" => $order_info_total, "ProductItemsNum" => 1, "ImageUrl" => '');
         $qty++;
     }
     $BuyerCountry = @$order->cart->shipping_address->address_state->zone_name;
     $BuyerFirstname = @$order->cart->shipping_address->address_firstname;
     $BuyerLastname = @$order->cart->shipping_address->address_lastname;
     $BuyerStreet = $order->cart->shipping_address->address_street;
     $BuyerCity = @$order->cart->shipping_address->address_city;
     $request['PaymentDetails'] = array("MerchantInternalPaymentId" => $order->order_id, "MerchantInternalUserId" => $order->order_user_id, "EMail" => $this->user->user_email, "PhoneNumber" => $order->cart->shipping_address->address_telephone, "CustomMerchantInfo" => "", "StatusUrl" => "{$notify_url}", "ReturnUrl" => "{$return_url}", "BuyerCountry" => "{$BuyerCountry}", "BuyerFirstname" => "{$BuyerFirstname}", "BuyerPatronymic" => "", "BuyerLastname" => "{$BuyerLastname}", "BuyerStreet" => "{$BuyerStreet}", "BuyerZone" => "", "BuyerZip" => "", "BuyerCity" => "{$BuyerCity}", "DeliveryFirstname" => "{$BuyerFirstname}", "DeliveryLastname" => "{$BuyerLastname}", "DeliveryZip" => "", "DeliveryCountry" => "{$BuyerCountry}", "DeliveryPatronymic" => "", "DeliveryStreet" => "{$BuyerStreet}", "DeliveryCity" => "{$BuyerCity}", "DeliveryZone" => "");
     $request["Signature"] = md5(strtoupper($request["MerchantGuid"]) . number_format($sum, 2, ".", "") . $request["SelectedPaySystemId"] . $request["PaymentDetails"]["EMail"] . $request["PaymentDetails"]["PhoneNumber"] . $request["PaymentDetails"]["MerchantInternalUserId"] . $request["PaymentDetails"]["MerchantInternalPaymentId"] . strtoupper($request["Language"]) . strtoupper($request["Currency"]) . strtoupper($this->MerchantSecretKey));
     $response = $this->sendRequestKaznachey(json_encode($request), "CreatePaymentEx");
     $result = json_decode($response, true);
     if ($result['ErrorCode'] != 0) {
         JController::setRedirect($fail_url, 'Ошибка транзакции');
         JController::redirect();
     } else {
         print base64_decode($result["ExternalForm"]);
         die;
     }
     return $this->showPage('end');
 }
Example #20
0
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     $totalAmount = round($order->order_full_price, (int) $this->currency->currency_locale['int_frac_digits']);
     $orderId = $order->order_id;
     $paymentSuccessfulURL = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=netgiro&lang=' . $this->locale . $this->url_itemid;
     $cancelUrl = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=order&task=cancel_order&order_id=' . $orderId . $this->url_itemid;
     $applicationId = $this->payment_params->application_id;
     $secretKey = $this->payment_params->secret_key;
     $maxInstallments = $this->payment_params->max_installments;
     $returnCustomerInfo = 'false';
     $paymentOptions = new paymentOptionsCls();
     $paymentOptions->showP1 = $this->payment_params->payment_opt1;
     $paymentOptions->showP2 = $this->payment_params->payment_opt2;
     $paymentOptions->showP3 = $this->payment_params->payment_opt3;
     $signature = hash('sha256', $secretKey . $orderId . $totalAmount . $applicationId);
     switch ($this->payment_params->mode) {
         case 'LIVE':
             $netGiropaymentUrl = 'https://www.netgiro.is/SecurePay';
             break;
         case 'TEST':
             $netGiropaymentUrl = 'http://test.netgiro.is/user/securepay';
             break;
         default:
             $netGiropaymentUrl = 'http://test.netgiro.is/user/securepay';
             break;
     }
     $vars = array('ApplicationID' => $applicationId, 'Signature' => $signature, 'PaymentSuccessfulURL' => $paymentSuccessfulURL, 'PaymentCancelledURL' => $cancelUrl, 'ReturnCustomerInfo' => 'false', 'Iframe' => 'false', 'OrderId' => $orderId, 'TotalAmount' => $totalAmount, 'MaxNumberOfInstallments' => $maxInstallments);
     $n = 0;
     foreach ($order->cart->products as $product) {
         $productPrice = round($product->order_product_price, (int) $this->currency->currency_locale['int_frac_digits']);
         $tax = round($product->order_product_tax, (int) $this->currency->currency_locale['int_frac_digits']);
         $unitPrice = $productPrice + $tax;
         $productAmount = round($product->order_product_total_price, (int) $this->currency->currency_locale['int_frac_digits']);
         $quantity = $product->order_product_quantity * 1000;
         $vars["Items[{$n}].ProductNo"] = $product->order_product_code;
         $vars["Items[{$n}].Name"] = $product->order_product_name;
         $vars["Items[{$n}].UnitPrice"] = $unitPrice;
         $vars["Items[{$n}].Quantity"] = $quantity;
         $vars["Items[{$n}].Amount"] = $productAmount;
         $n++;
     }
     $this->vars = $vars;
     $this->netGiropaymentUrl = $netGiropaymentUrl;
     $this->paymentOptions = $paymentOptions;
     $this->appId = $applicationId;
     return $this->showPage('end');
 }
Example #21
0
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     $return_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=after_end&order_id=' . $order->order_id . $this->url_itemid;
     $notif_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=' . $this->name . '&notif_id=' . $method_id . '&order_id=' . $order->order_id . '&lang=' . $this->locale . $this->url_itemid;
     require_once dirname(__FILE__) . '/lib/payplug.php';
     try {
         Payplug::setConfigFromFile(HIKASHOP_MEDIA . "payplug_parameters.json");
         $paymentUrl = PaymentUrl::generateUrl(array('amount' => (int) (round($order->cart->full_total->prices[0]->price_value_with_tax, 2) * 100), 'currency' => 'EUR', 'ipnUrl' => $notif_url, 'email' => $this->user->user_email, 'firstName' => @$order->cart->billing_address->address_firstname, 'lastName' => @$order->cart->billing_address->address_lastname, 'order' => $order->order_id, 'returnUrl' => $return_url));
     } catch (Exception $e) {
         $this->app->enqueueMessage($e->getMessage());
         return;
     }
     header("Location: {$paymentUrl}");
     exit;
 }
Example #22
0
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     if ($this->payment_params->type == 'hosted') {
         $address = trim($order->cart->shipping_address->address_street . ' ' . $order->cart->billing_address->address_city);
         $customerName = trim($order->cart->billing_address->address_firstname . ' ' . $order->cart->billing_address->address_lastname);
         $redirectUrl = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=' . $this->name . '&tmpl=component&orderid=' . $order->order_id;
         $callbackUrl = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=after_end&order_id=' . $order->order_id;
         $fields = array('merchantID' => $this->payment_params->merchantid, 'action' => 'SALE', 'type' => 1, 'amount' => round($order->cart->full_total->prices[0]->price_value_with_tax, 2) * 100, 'countryCode' => $this->payment_params->country_code, 'currencyCode' => $this->payment_params->currency_code, 'redirectURL' => $redirectUrl, 'callbackURL' => $callbackUrl, 'transactionUnique' => $order->order_id . '-' . date('Y-m-d'), 'orderRef' => $order->order_id, 'customerName' => $customerName, 'customerAddress' => $address, 'customerPostCode' => $order->cart->shipping_address->address_post_code, 'customerPhone' => $order->cart->shipping_address->address_telephone, 'customerEmail' => $this->user->user_email);
         $fields['signature'] = createSignature($fields, $this->payment_params->secret);
         $this->fields = $fields;
         return $this->showPage('end');
     }
     if ($this->payment_params->type == 'direct') {
     }
 }
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     if (empty($this->payment_params->merchant_id) || empty($this->payment_params->secret_key)) {
         $this->app->enqueueMessage('You have to configure a merchant account and its secret key for the Platron plugin payment first. Please check your payment method parameters on your website backend', 'error');
         return false;
     }
     include_once dirname(__FILE__) . DS . 'PG_Signature.php';
     $viewType = 'end';
     $strDescription = '';
     foreach ($order->cart->products as $objItem) {
         $strDescription .= $objItem->order_product_name;
         if ($objItem->order_product_quantity > 1) {
             $strDescription .= "*" . $objItem->order_product_quantity;
         }
         $strDescription .= "; ";
     }
     $server_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=platron&notif_id=' . $method_id . '&tmpl=component' . $this->url_itemid;
     $failure_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=order&task=cancel_order&order_id=' . $order->order_id . $this->url_itemid;
     $success_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=after_end&order_id=' . $order->order_id . $this->url_itemid;
     $strCurrency = $this->currency->currency_code;
     if ($strCurrency == 'RUB') {
         $strCurrency = 'RUR';
     }
     $arrFields = array('pg_merchant_id' => $this->payment_params->merchant_id, 'pg_order_id' => $order->order_id, 'pg_currency' => $strCurrency, 'pg_amount' => sprintf('%0.2f', $order->cart->full_total->prices[0]->price_value_with_tax), 'pg_lifetime' => isset($this->payment_params->lifetime) ? $this->payment_params->lifetime * 60 : 0, 'pg_testing_mode' => $this->payment_params->testmode, 'pg_description' => $strDescription, 'pg_user_ip' => $_SERVER['REMOTE_ADDR'], 'pg_language' => JFactory::getLanguage()->getTag() == 'ru-RU' ? 'ru' : 'en', 'pg_check_url' => $server_url, 'pg_result_url' => $server_url, 'pg_success_url' => $success_url, 'pg_failure_url' => $failure_url, 'pg_request_method' => 'GET', 'pg_salt' => rand(21, 43433));
     if (!empty($order->cart->shipping_address->address_telephone)) {
         preg_match_all("/\\d/", $order->cart->shipping_address->address_telephone, $array);
         $strPhone = implode('', @$array[0]);
         $arrFields['pg_user_phone'] = $strPhone;
     } elseif (!empty($order->cart->billing_address->address_telephone)) {
         preg_match_all("/\\d/", $order->cart->billing_address->address_telephone, $array);
         $strPhone = implode('', @$array[0]);
         $arrFields['pg_user_phone'] = $strPhone;
     }
     if (!empty($order->cart->customer->email)) {
         $arrFields['pg_user_email'] = $order->cart->customer->email;
         $arrFields['pg_user_contact_email'] = $order->cart->customer->email;
     }
     if (!empty($this->payment_params->payment_system)) {
         $arrFields['pg_payment_system'] = $this->payment_params->payment_system;
     }
     $arrFields['pg_sig'] = PG_Signature::make('payment.php', $arrFields, $this->payment_params->secret_key);
     $this->arrPaymentParams = $arrFields;
     return $this->showPage($viewType);
 }
Example #24
0
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     $return_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=after_end&order_id=' . $order->order_id . $this->url_itemid;
     $cancel_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=order&task=cancel_order&order_id=' . $order->order_id . $this->url_itemid;
     $notif_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=' . $this->name . '&notif_id=' . $method_id . '&order_id=' . $order->order_id . '&lang=' . $this->locale . $this->url_itemid;
     $locale = strtoupper($this->locale);
     if (!in_array($locale, $this->languages)) {
         $locale = 'EN';
     }
     if (isset($this->payment_params->sandbox) && $this->payment_params->sandbox) {
         $this->url = 'https://test.borgun.is/SecurePay/default.aspx';
     } else {
         $this->url = 'https://securepay.borgun.is/securepay/default.aspx';
     }
     $this->vars = array('MerchantId' => @$this->payment_params->merchantid, 'paymentgatewayid' => @$this->payment_params->paymentgatewayid, 'Orderid' => $order->order_id, 'reference' => $order->order_number, 'checkhash' => md5(@$this->payment_params->merchantid . $notif_url . @$this->payment_params->securecode), 'amount' => number_format($order->cart->full_total->prices[0]->price_value_with_tax, 2, ',', ''), 'currency' => $this->currency->currency_code, 'language' => $locale, 'Itemdescription_1' => JText::_('CART_PRODUCT_TOTAL_PRICE'), 'Itemcount_1' => '1', 'Itemunitamount_1' => number_format($order->cart->full_total->prices[0]->price_value_with_tax, 2, ',', ''), 'Itemamount_1' => number_format($order->cart->full_total->prices[0]->price_value_with_tax, 2, ',', ''), 'buyername' => '', 'buyeremail' => $this->user->user_email, 'returnurlsuccess' => $notif_url, 'returnurlsuccessserver' => $notif_url, 'returnurlcancel' => $cancel_url, 'returnurlerror' => $cancel_url);
     return $this->showPage('end');
 }
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     require_once dirname(__FILE__) . '/library/sofortLib.php';
     $viewType = 'end';
     if (empty($this->payment_params->return_url)) {
         $return_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=after_end&order_id=' . $order->order_id . $this->url_itemid;
     } else {
         $return_url = $this->payment_params->return_url;
     }
     $notify_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=' . $this->name . '&tmpl=component&lang=nl';
     if (empty($this->payment_params->cancel_url)) {
         $cancel_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=order&task=cancel_order';
     } else {
         $cancel_url = $this->payment_params->cancel_url;
     }
     $configkey = $this->payment_params->user_id . ':' . $this->payment_params->project_id . ':' . $this->payment_params->token;
     $amount = round($order->cart->full_total->prices[0]->price_value_with_tax, (int) $this->currency->currency_locale['int_frac_digits']);
     $order_text = "\r\n" . JText::sprintf('betaling Feeen en ridders: order ', $order->order_id);
     $transactionId = 0;
     $Sofort = new SofortLib_Multipay($configkey);
     $Sofort->setSofortueberweisung();
     $Sofort->setAmount($amount, $this->currency->currency_code);
     $Sofort->setReason($order_text);
     $Sofort->addUserVariable($order->order_id);
     //$Sofort->setSofortrechnungOrderId($order->order_id);
     $Sofort->addUserVariable($method_id);
     $Sofort->setSuccessUrl($return_url);
     $Sofort->setAbortUrl($cancel_url);
     $Sofort->setTimeoutUrl($cancel_url);
     $Sofort->setNotificationUrl($notify_url);
     $Sofort->sendRequest();
     if ($Sofort->isError()) {
         //PNAG-API didn't accept the data
         echo $Sofort->getError();
         return false;
     } else {
         //buyer must be redirected to $paymentUrl else payment cannot be successfully completed!
         $this->redirect_url = $Sofort->getPaymentUrl();
         //header('Location: '.$this->redirect_url);
     }
     return $this->showPage('end');
 }
Example #26
0
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     $surl = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=' . $this->name . '&tmpl=component&lang=' . $this->locale . $this->url_itemid;
     $curl = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=order&task=cancel_order&order_id=' . $order->order_id . $this->url_itemid;
     $debug = @$this->payment_params->debug;
     $vars = array('key' => $this->payment_params->key, 'txnid' => $order->order_id, 'surl' => $surl, 'furl' => $curl, 'curl' => $curl, 'productinfo' => JText::_('ORDER_NUMBER') . ' ' . $order->order_number, 'charset' => 'utf-8', 'firstname' => $order->cart->shipping_address->address_firstname, 'lastname' => $order->cart->shipping_address->address_lastname, 'email' => $this->user->user_email, 'phone' => $order->cart->shipping_address->address_telephone, 'amount' => round($order->cart->full_total->prices[0]->price_value_with_tax, (int) $this->currency->currency_locale['int_frac_digits']));
     $vars['hash'] = $this->get_hash($vars, $this->payment_params->salt);
     if (@$this->payment_params->paisa) {
         $vars['service_provider'] = 'payu_paisa';
     }
     if ($this->payment_params->environnement == 'test') {
         $this->payment_params->url = 'https://test.payu.in/_payment';
     } else {
         $this->payment_params->url = 'https://secure.payu.in/_payment';
     }
     $this->vars = $vars;
     return $this->showPage('end');
 }
Example #27
0
    function onAfterOrderConfirm(&$order, &$methods, $method_id)
    {
        parent::onAfterOrderConfirm($order, $methods, $method_id);
        global $Itemid;
        $tax_total = '';
        $discount_total = '';
        $pxPay = 'https://sec.paymentexpress.com/pxpay/pxaccess.aspx';
        $data = '<GenerateRequest>
	<PxPayUserId>' . @$this->payment_params->userid . '</PxPayUserId>
	<PxPayKey>' . @$this->payment_params->key . '</PxPayKey>
	<MerchantReference>' . @$this->payment_params->merchant_reference . '</MerchantReference>
	<TxnType>Purchase</TxnType>
	<AmountInput>' . number_format($order->cart->full_total->prices[0]->price_value_with_tax, 2, '.', '') . '</AmountInput>
	<CurrencyInput>' . $this->currency->currency_code . '</CurrencyInput>
	<TxnData1>' . $order->order_id . '</TxnData1>
	<TxnData2>' . $order->order_number . '</TxnData2>
	<TxnData3>' . @$Itemid . '</TxnData3>
	<EmailAddress>' . $this->user->user_email . '</EmailAddress>
	<UrlSuccess>' . HIKASHOP_LIVE . 'pxpay_' . $method_id . '.php</UrlSuccess>
	<UrlFail>' . HIKASHOP_LIVE . 'pxpay_' . $method_id . '.php</UrlFail>
</GenerateRequest>';
        if (@$this->payment_params->debug) {
            echo 'Data Sent<pre>';
            echo var_export($data, true);
            echo '</pre>';
        }
        $ret = $this->sendXml($pxPay, $data);
        $this->url = '';
        if (preg_match('#<URI>(.*)</URI>#iU', $ret, $res) !== false) {
            $this->url = $res[1];
        } else {
            $this->app->enqueueMessage(JText::_('ERROR'));
        }
        if (@$this->payment_params->debug) {
            echo 'Data received<pre>';
            echo var_export($ret, true);
            echo '</pre>';
        }
        $data = '';
        $ret = '';
        return $this->showPage('end');
    }
Example #28
0
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     if (empty($this->payment_params->merchantID)) {
         $this->app->enqueueMessage('You have to configure a merchant ID for the Atos sips plugin payment first : check your plugin\'s parameters, on your website backend', 'error');
         return false;
     }
     if (empty($this->payment_params->keyVersion)) {
         $this->app->enqueueMessage('You have to configure the Key Version for the Atos sips plugin payment first : check your plugin\'s parameters, on your website backend', 'error');
         return false;
     }
     if (empty($this->payment_params->secretKey)) {
         $this->app->enqueueMessage('You have to configure the Secret Key for the Atos sips plugin payment first : check your plugin\'s parameters, on your website backend', 'error');
         return false;
     }
     $PostUrl = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=' . $this->name . '&tmpl=component&lang=' . $this->locale . $this->url_itemid;
     $userPostUrl = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=' . $this->name . '&tmpl=component&user_return=1&lang=' . $this->locale . $this->url_itemid;
     if ($this->payment_params->testmode == true) {
         $url = 'https://payment-webinit.simu.sips-atos.com/paymentInit';
     } else {
         $url = 'https://payment-webinit.sips-atos.com/paymentInit';
     }
     $vars0 = array("currencyCode" => @$this->sync_currencies[$this->currency->currency_code], "merchantId" => trim($this->payment_params->merchantID), "normalReturnUrl" => $userPostUrl, "amount" => str_replace(array('.', ','), '', round($order->cart->full_total->prices[0]->price_value_with_tax, 2) * 100), "transactionReference" => $order->order_number, "keyVersion" => trim($this->payment_params->keyVersion), "automaticResponseUrl" => $PostUrl, "orderId" => $order->order_id, "statementReference" => $order->order_number);
     $this->payment_params->url = $url;
     $data = '';
     foreach ($vars0 as $key => $val) {
         if (!empty($val)) {
             $data .= $key . '=' . trim($val) . '|';
         }
     }
     $data = substr($data, 0, -1);
     $secretKey = utf8_encode($this->payment_params->secretKey);
     $seal = hash('sha256', utf8_encode($data . $secretKey));
     $vars = array("Data" => $data, "InterfaceVersion" => "HP_2.3", "Seal" => $seal);
     if ($this->payment_params->debug) {
         $this->writeToLog("Data sent to Atos Sips: \n\n\n");
         $this->writeToLog(print_r($vars, true));
     }
     $this->vars = $vars;
     return $this->showPage('end');
 }
Example #29
0
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     if (empty($this->payment_params->identifier)) {
         $this->app->enqueueMessage('You have to configure an identifer for the Be2Bill plugin payment first : check your plugin\'s parameters, on your website backend', 'error');
         return false;
     } elseif (empty($this->payment_params->password)) {
         $this->app->enqueueMessage('You have to configure a password for the Be2Bill plugin payment first : check your plugin\'s parameters, on your website backend', 'error');
         return false;
     } elseif (empty($this->payment_params->payment_url)) {
         $this->app->enqueueMessage('You have to configure a payment url for the Be2Bill plugin payment first : check your plugin\'s parameters, on your website backend', 'error');
         return false;
     } else {
         $version = 2.0;
         $amout = round($order->cart->full_total->prices[0]->price_value_with_tax, 2) * 100;
         $vars = array('IDENTIFIER' => $this->payment_params->identifier, 'OPERATIONTYPE' => "payment", 'CLIENTIDENT' => $order->order_user_id, 'CLIENTEMAIL' => @$order->customer->email, 'CARDFULLNAME' => @$order->customer->name, 'DESCRIPTION' => "ordernumber " . $order->order_number, 'ORDERID' => $order->order_id, 'VERSION' => $version, 'AMOUNT' => $amout);
         $vars['HASH'] = $this->be2bill_signature($this->payment_params->password, $vars);
         $this->vars = $vars;
         return $this->showPage('end');
     }
 }
 function onAfterOrderConfirm(&$order, &$methods, $method_id)
 {
     parent::onAfterOrderConfirm($order, $methods, $method_id);
     $method = $methods[$method_id];
     if (isset($order->order_status) && !empty($method->payment_params->order_status) && $method->payment_params->order_status != $order->order_status) {
         $orderObj = new stdClass();
         $orderObj->order_id = $order->order_id;
         $orderObj->order_status = $method->payment_params->order_status;
         if (!empty($method->payment_params->status_notif_email)) {
             $orderObj->history->history_notified = $method->payment_params->status_notif_email;
         }
         $orderClass = hikashop_get('class.order');
         $orderClass->save($orderObj);
     }
     $this->removeCart = true;
     $this->order_number = $order->order_number;
     $this->information = $method->payment_params->information;
     if (preg_match('#^[a-z0-9_]*$#i', $this->information)) {
         $this->information = JText::_($this->information);
     }
     return $this->showPage('end');
 }