<?php
//namespace App\Http\Vendors\Pay\VNPT_V2;
/**
 * Created by PhpStorm.
 * User: zhuguoqing
 * Date: 2017/12/11
 * Time: 11:01
 */

//    case 1:
//        $TxtType = 'VTT';
//        $TxtUrl  = 'https://api.knp.vn/VIETTEL';
//    break;
//    case 2:
//        $TxtType = 'VMS';
//        $TxtUrl  = 'https://api.knp.vn/MOBI';
//    break;
//    case 3:
//        $TxtType = 'VNP';
//        $TxtUrl  = 'https://api.knp.vn/VINA';
//    break;
//    case 4:
//        $TxtType = 'GATE';
//        $TxtUrl  = 'https://api.knp.vn/GATE';
//    break;


include 'class/class.vnptGateWay.php';

Class VNPT{
    private $TxtPartnerId   = 65;
    private $TxtSignal      = "a17z33m17";
    private $baseUrl        = "http://apis.mthecao.com/";

    /**
     * @param $TxtTransID   - 交易 ID 可以自定义
     * @param $TxtType      - 交易类型 目前有4种
     * @param $TxtUrlPath   - 渠道 Url路径
     * @param $TxtSeri      - 卡号
     * @param $TxtPassword  - 卡密
     */
    public function cardCharging($TxtTransID,$TxtType,$TxtUrlPath,$TxtSeri,$TxtPassword){
        oo::logs()->debug3('id:'.$TxtTransID.'  type:'.$TxtType.'  url:'.$TxtUrlPath.'  seri:'.$TxtSeri.'  passwd:'.$TxtPassword, 'vnpt.php');
        $TxtKey   = md5(trim(
            $this->TxtPartnerId.
            $TxtType.
            $TxtTransID.
            $TxtPassword.
            $this->TxtSignal));
        $TxtUrl = $this->baseUrl . $TxtUrlPath;
        $gateWay  = new \vnptGateWay(
            $this->TxtPartnerId,
            $TxtType,
            $TxtPassword,
            $TxtSeri,
            $TxtTransID,
            $TxtKey,
            $TxtUrl);
        $response = $gateWay->ReturnResult();
        return $response;
    }

}
