sifangpay/app/ServicePay/PayApiProvidesTrait.php

116 lines
3.8 KiB
PHP

<?php
namespace App\ServicePay;
trait PayApiProvidesTrait
{
/**
* 设置当前的支付API Services选择
* @param $pay_type
*/
public function setPayService($pay_type)
{
switch ($pay_type) {
case 'alipay':
case 'weixin':
case 'alipayscan':
case 'weixinh5':
case 'weixinscan':
return $this->pay_service = new WeixinAlipayServices();
break;
case 'unionpay':
return $this->pay_service = new UnionpayServices();
break;
case 'citpay':
return $this->pay_service = new CitPayServices();
break;
case 'usdtpay':
return $this->pay_service = new UsdtPayServices();
break;
case 'tr_wxal':
case 'tr_wxalbank':
case 'tr_weixin':
case 'tr_alipay':
case 'tr_bank':
case 'tr_bank2':
return $this->pay_service = new GuMaPayServices();
case 'sanyecaopay_alipay':
return $this->pay_service = new SanyecaoPayServices();
case 'baobeiyepay_alipay':
return $this->pay_service = new BaobeiyePayServices();
case 'xianyupay_alipay':
return $this->pay_service = new XianYuPayServices();
case 'baoyingpay_alipay':
return $this->pay_service = new BaoYingPayServices();
case 'liangliangpay':
return $this->pay_service = new LiangLiangPayServices();
case 'xinbaoyingpay':
return $this->pay_service = new XinBaoYingPayServices();
case 'longepay':
return $this->pay_service = new LongEPayServices();
case 'wangfupay':
return $this->pay_service = new WangfuPayServices();
case 'dashengfupay':
return $this->pay_service = new DaShengPayServices();
case 'dalepay':
return $this->pay_service = new DaLePayServices();
case 'shandianpay':
return $this->pay_service = new ShanDianServices();
case 'rongyipay':
return $this->pay_service = new RongYiServices();
case 'zhanxinpay':
return $this->pay_service = new ZhanXinPayServices();
case '1003':
return $this->pay_service = new DaliPayServices();
case '1000':
return $this->pay_service = new PingguopayServices();
case '1004':
return $this->pay_service = new KoulinghbPayServices();
case '1002':
return $this->pay_service = new YiHuiBaoPayServices();
case '1001':
return $this->pay_service = new ShanYePayServices();
case '1005':
return $this->pay_service = new ShouJiPayServices();
case '1006':
return $this->pay_service = new DongJinPayServices();
break;
}
}
/**
* 转换支付对应类型和方法
* @param $pay_type
* @return array
*/
public function payMethod($pay_type)
{
$arr = [];
$arr['pay_type'] = $pay_type;
switch ($pay_type) {
case 'alipayscan':
$arr['method'] = 'scan';
$arr['pay_type'] = 'alipay';
break;
case 'weixinscan':
$arr['method'] = 'scan';
$arr['pay_type'] = 'weixin';
break;
case 'weixinh5':
$arr['method'] = 'wap';
$arr['pay_type'] = 'weixin';
break;
default:
$mothod = 'wap';
$arr['method'] = $mothod;
break;
}
return $arr;
}
}