| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- <?php
- namespace common\enums;
- /**
- *
- * 支付类型
- *
- * Class PayTypeEnum
- * @package common\enums
- */
- class PayTypeEnum extends BaseEnum
- {
- const ON_LINE = 0;
- const WECHAT = 1;
- const ALI = 2;
- const UNION = 3;
- //const PAY_ON_DELIVERY = 4; //货到付款
- const BALANCE = 5;
- //const TO_SHOP = 6;
- const JOINPAY = 7;
- const JOINPAY_FAST_PAY = 8;
- const FREE = 9;
- const HUIJU_BILL = 10; // 汇聚分账
- const SIC_PAY = 11; // 中金支付
- const SCORE = 12; // 积分支付
- const CARD_GIFT = 13;//礼包卡兑换
- const YUNFAST = 15; // 银典支付
- const UNIONPAY = 16; // 通联支付
- const MIXED = 17; // 组合支付
- const HUIFUPAY=18;// 汇付天下
- const SANDPAY=19;// 杉德支付
- const SANDPAY_FAST_PAY = 20; // 杉德快捷支付
- const ALLIN_TAX_PAY = 22; // 合规分账(通联支付分账)
- // 其他
- const OFFLINE = 100;
- const INTEGRAL = 101;
- const GOLD_SCORE = 108;
- const CONSUMER_CARD = 110; //积分增长赢-消费卡支付
- /**
- * @return array
- */
- public static function getMap(): array
- {
- return [
- self::ON_LINE => '在线支付',
- self::WECHAT => '微信',
- self::ALI => '支付宝',
- self::UNION => '银联卡',
- //self::PAY_ON_DELIVERY => '货到付款',
- self::BALANCE => '余额支付',
- self::JOINPAY => '汇聚支付',
- self::JOINPAY_FAST_PAY => '汇聚快捷支付',
- //self::TO_SHOP => '到店支付',
- self::FREE => '免支付',
- self::HUIJU_BILL => '汇聚分账',
- self::SIC_PAY => '中金支付',
- self::CARD_GIFT => '礼包卡兑换',
- // 其他
- self::OFFLINE => '线下支付',
- //self::INTEGRAL => '积分兑换',
- self::SCORE => '积分支付',
- self::YUNFAST => '银典支付',
- self::UNIONPAY => '通联支付',
- self::MIXED => '组合支付',
- self::HUIFUPAY => '汇付天下',
- self::SANDPAY => '杉德支付',
- self::SANDPAY_FAST_PAY => '杉德快捷支付',
- self::ALLIN_TAX_PAY => '合规分账',
- self::GOLD_SCORE => '金币支付',
- self::CONSUMER_CARD => '消费卡支付'
- ];
- }
- /**
- * 所有支付方式
- * @return array
- */
- public static function allAction(){
- return [
- self::WECHAT => 'wechat',
- self::ALI => 'alipay',
- self::UNION => 'union',
- // self::JOINPAY => 'joinpay',
- // self::JOINPAY_FAST_PAY => 'joinpay_fast',
- self::BALANCE => 'balance',
- // self::HUIJU_BILL => 'huiju_bill',
- self::SCORE => 'score',
- // self::MIXED => 'mixed',
- ];
- }
- /**
- * 调用方法
- *
- * @param $type
- * @return mixed|string
- */
- public static function action($type)
- {
- $ations = self::allAction();
- return $ations[$type] ?? '';
- }
- /**
- * @return array
- */
- public static function thirdParty()
- {
- return [
- self::WECHAT => '微信',
- self::ALI => '支付宝',
- self::UNION => '银联卡',
- // self::JOINPAY => '汇聚',
- // self::JOINPAY_FAST_PAY => '银行卡支付'
- ];
- }
- /**
- * 获取所有支付方式描述
- * @return array
- */
- public static function allTypeConf($mall_id)
- {
- $protocol = ($_SERVER['SERVER_PORT']==443?'https':'http').'://';
- $host = $protocol.$_SERVER['HTTP_HOST'];
- $map = self::getMap();
- $acitons = self::allAction();
- $score_name = \Yii::$app->services->setting->mall->get($mall_id, 'score.score_name');
- $balance_name = \Yii::$app->services->setting->mall->get($mall_id, 'balance.balance_name');
- $return = [];
- foreach($acitons as $key => $val){
- $name = $map[$key]??'';
- if(!empty($name)){
- $name = str_replace('积分',$score_name,$name);
- $name = str_replace('余额',$balance_name,$name);
- }
- $return[$val] = [
- 'name' => $name,
- 'img' => $host.'/resources/img/payment/'.$val.'.png',
- 'pay_type' => $key
- ];
- }
- return $return;
- }
- /**
- * @name:
- * @msg: 主商城本身支持的支付方式
- * @param {*}
- * @return {*}
- */
- public static function mallPayType()
- {
- return [
- self::WECHAT => '微信',
- self::ALI => '支付宝',
- self::BALANCE => '余额支付',
- self::SCORE => '积分支付',
- ];
- }
- /**
- * @name:
- * @msg: 主商城资金支付方式
- * @param {*}
- * @return {*}
- */
- public static function mallParty()
- {
- return [
- // self::BALANCE => '余额支付',
- self::SCORE => '积分支付',
- // self::GOLD_SCORE => '金币支付',
- ];
- }
- }
|