ishenkoyv/commweb

Server-Hosted Payment的CommWeb集成库

dev-master 2018-06-18 09:52 UTC

This package is auto-updated.

Last update: 2024-09-17 02:50:01 UTC


README

https://www.commbank.com.au

CommWeb是一个快速可靠的在线商店支付接受服务。获得世界级的安全保障,简化您的支付管理。当使用Server-Hosted Payments时,通过CommWeb虚拟支付客户端使用包含交易请求字段的查询字符串和HTTPS重定向方法,将交易请求发送到支付服务器。

public function commwebOrderHandler()
{
  $returnUrl = '/commweb-response-handler.html';
  
  $payment = $this->get('paymentService')->getPayment($this->getParam('payment_id'));
  $returnUrl .= '?token=' . $payment['token'];
  
  $paymentParams = $this->getAllParams();
  $commweb = $this->get('CommwebService');
  $paymentData = $commweb->getPaymentData($paymentParams, $payment, 'http');
  
  $vpcURL = $commweb->getHttpPaymentUrl($paymentData);
  $queryParts = parse_url($vpcURL);
  
  // log request information
  header("Location: " . $vpcURL);
 }
 
 public function commwebResponseHandler()
 {
  $commweb = $this->get('CommwebService');
 
  $errorTxt = $commweb->getHttpResponseErrorTxt($this->getAllParams());
  if ($errorTxt) {
    return $this->redirectPaymentError($errorTxt, $returnUrl);
  }
  
  $this->get('paymentService')->paymentProcessedSuccessfully($this->getParam('payment_id');
 }