AltheimNoob Posted January 27, 2018 Share Posted January 27, 2018 Hi everyone. I desperately need a ipay88 module for the payment gateway ipay88. I got my hands on an ipay88 module but it only support prestashop 1.6 and I looked through the guide on updating 1.6 payment module to 1.7 but no lucks. Below is some changes on code I tried: //added this line use PrestaShop\PrestaShop\Core\Payment\PaymentOption; function install() { //changed hook from payment to paymentOption if (!parent::install() || !$this->registerHook('paymentOptions') || !$this->registerHook('paymentReturn') || !$this->registerHook('header')) return false; else { return true; } } //changed hookPayment to hookPaymentOption, changed the function to return an array of payment option public function hookPaymentOptions($params) { if (!$this->active) return; if (!$this->checkCurrency($params['cart'])) return; $address = new Address(intval($params['cart']->id_address_invoice)); $customer = new Customer((int)$this->context->cart->id_customer); $merchantCode = Configuration::get('ipay88_merchantCode'); $merchantKey = Configuration::get('ipay88_merchantKey'); $currency_obj = $this->context->currency; $currency_code = $currency_obj->iso_code; $orderid = (int)$this->context->cart->id; $amount = $this->context->cart->getOrderTotal(true, Cart::BOTH); $amount = number_format($amount,2,".",""); $bill_name = $customer->firstname." ".$customer->lastname; $bill_email = $customer->email; $country_obj = new Country(intval($address->id_country)); $country = $country_obj->iso_code; $country_name_obj = $country_obj->name; $country_name = $country_name_obj[1]; $ipaySignature = ''; $HashAmount = str_replace(".","",str_replace(",","",$amount)); $str = sha1($merchantKey . $merchantCode . $orderid . $HashAmount . $currency_code); for ($i=0;$i<strlen($str);$i=$i+2) { $ipaySignature .= chr(hexdec(substr($str,$i,2))); } $sg = base64_encode($ipaySignature); $responseurl = Tools::getShopDomainSsl(true).__PS_BASE_URI__.'index.php?fc=module&module=ipay88&controller=validation'; $newOption = new PaymentOption(); $newOption->setModuleName($this->name) ->setCallToActionText($this->l('Pay by Online Payment')) ->setAction($this->context->link->getModuleLink($this->name, 'validation', array(), true)) ->setInputs([ 'MerchantCode' => [ 'name' => 'MerchantCode', 'type' => 'hidden', 'value'=> $merchantCode, ], 'RefNo' => [ 'name' => 'RefNo', 'type' => 'hidden', 'value'=> $orderid, ], 'Amount' => [ 'name' => 'Amount', 'type' => 'hidden', 'value'=> $amount, ], 'Currency' => [ 'name' => 'Currency', 'type' => 'hidden', 'value'=> $currency_code, ], 'ProdDesc' => [ 'name' => 'ProdDesc', 'type' => 'hidden', 'value'=> 'Payment for Order #'.$orderid.'', ], 'UserName' => [ 'name' => 'UserName', 'type' => 'hidden', 'value'=> $bill_name, ], 'UserEmail' => [ 'name' => 'UserEmail', 'type' => 'hidden', 'value'=> $bill_email, ], 'UserContact' => [ 'name' => 'UserContact', 'type' => 'hidden', 'value'=> $address->phone, ], 'Remark' => [ 'name' => 'Remark', 'type' => 'hidden', 'value'=> '', ], 'Lang' => [ 'name' => 'Lang', 'type' => 'hidden', 'value'=> "UTF-8", ], 'returnurl' => [ 'name' => 'returnurl', 'type' => 'hidden', 'value'=> $responseurl, ], 'Signature' => [ 'name' => 'Signature', 'type' => 'hidden', 'value'=> $sg, ], ]) ->setAdditionalInformation($this->context->smarty->fetch('module:ipay88/views/templates/hook/ipay88.tpl')) ->setLogo(Media::getMediaPath(_PS_MODULE_DIR_.$this->name.'/logo.gif')); $payment_options = [ $newOption, ]; return $payment_options; //return $this->context->smarty->fetch('module:ipay88/views/templates/hook/ipay88.tpl'); } Can anyone develop ipay88 module for prestashop 1.7 or provide me some guides on editing the code? The data integration detail is in this link: integration doc And the ipay88 module for prestashop 1.6 is downloadable over here: ipay88.zip Should you need a merchant code and key to test: Merchant Code : M13391 Merchant Key : MnlzhTYuqT iPay88 for Prestashop 1.6.zip Link to comment Share on other sites More sharing options...
siraf82 Posted November 20, 2019 Share Posted November 20, 2019 (edited) Yes, you can't see iPay88 module for PS 1.7 under the download section in iPay88 merchant account, but you can simply request the module by emailing the iPay88 support team. They will send it to you in email. I just use the module they send it to me (support PS 1.7). Perhaps they should just update the download section to include module for PS 1.7 as well by now. Edited November 20, 2019 by siraf82 (see edit history) Link to comment Share on other sites More sharing options...
hitmsbkk Posted November 26, 2019 Share Posted November 26, 2019 On 11/21/2019 at 1:08 AM, siraf82 said: Yes, you can't see iPay88 module for PS 1.7 under the download section in iPay88 merchant account, but you can simply request the module by emailing the iPay88 support team. They will send it to you in email. I just use the module they send it to me (support PS 1.7). Perhaps they should just update the download section to include module for PS 1.7 as well by now. Hi, are you sure they will email to us? is it from malaysia? Previous i did email to their support team to request module for PS 1.7 but they reply that they did not develop for PS 1.7. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now