prestashop支付流程

首先需要安装支付模块,以我的支付模块ingenico为例。
1,根目录文件ingenico.php (model文件)需要引入支付接口文件,需要引入prestashop支付模块文件
class Ingenico extends PaymentModule
{
}
2,安装的时候会执行install函数,install里挂载钩子
public function install()
{
}
,3,执行钩子函数
public function hookPaymentOptions(KaTeX parse error: Expected '}', got 'EOF' at end of input: …{ if (!this->active) {
return;
}
if (! t h i s − > c h e c k C u r r e n c y ( this->checkCurrency( this>checkCurrency(params[‘cart’])) {
return;
}
$payment_options = [
$this->getIngenicoPaymentOption(),
];
return $payment_options;
}
,4, 执行需要调用的controller文件(modules/ingenico/controllers/front/iframe.php):
public function getIngenicoPaymentOption()
{
$engenicoPaymentOption = new PaymentOption();
e n g e n i c o P a y m e n t O p t i o n − > s e t C a l l T o A c t i o n T e x t ( engenicoPaymentOption->setCallToActionText( engenicoPaymentOption>setCallToActionText(this->l(‘Pay whith Ingenico’))
->setAction( t h i s − > c o n t e x t − > l i n k − > g e t M o d u l e L i n k ( this->context->link->getModuleLink( this>context>link>getModuleLink(this->name, ‘iframe’, array(), true))
->setAdditionalInformation($this->context->smarty->fetch(‘module:Ingenico/views/templates/front/ingenico.tpl’))
->setLogo(Media::getMediaPath(PS_MODULE_DIR . $this->name . ‘/payment.jpg’));
return $engenicoPaymentOption;
}
,5, controller文件调用支付接口生成的url返回到model文件ingenico.php,(controller文件iframe.php需要引入接口文件)
include_once PS_MODULE_DIR . ‘ingenico/vendor/autoload.php’;
include_once PS_MODULE_DIR . ‘ingenico/ingenico.php’;
use Ingenico\Connect\Sdk\Examples\HostedCheckoutTest;

 	$ingenico = new Ingenico();
    $payment_html = $ingenico->execPayment($this->context->cart, 'CreditCard', $con_string);
    $payment_html .= '<script>document.payForm.submit(); </script>';

,6, model文件 ingenico.php 获取返回的url和其他信息向支付页面发出请求
public function execPayment($cart, $APMType, $con_string){
$payment_html = ’



';
return $payment_html;
}
7,执行回调页面
returnUrl = “http://www.test.com/module/ingenico/test”;
8.回调页面返回的结果传递给model(ingenico.php)
将返回的订单状态插入到数据表

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值