| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace services\common;
- use common\components\payment\HuijuBill;
- use common\components\Service;
- use common\enums\AddonsEnum;
- use common\enums\PayTypeEnum;
- use Exception;
- use Yii;
- /**
- *
- * 订单第三方在线支付退款服务
- */
- class ThirdPartyRefundService extends Service
- {
- /**
- * 批量加入队列处理
- *
- * @param array $data
- * @return void
- */
- public static function batchHandleByQueue($data)
- {
- if (in_array($data['payment_type'], PayTypeEnum::thirdParty())) {
- throw new Exception('支付类型不符合');
- }
- // 检查是否存在处理方法
- $method = PayTypeEnum::action($data['payment_type']);
- if (!method_exists(self::class, $method)) {
- throw new Exception(PayTypeEnum::getValue($data['payment_type']) . '未定义退款处理方法');
- }
- return call_user_func([self::class, $method], $data);
- }
- /**
- * 汇聚分账退款
- *
- * @param array $data
- * @return void
- */
- public static function huiju_bill($data)
- {
- $config = Yii::$app->services->setting->addons->get($data['mall_id'], AddonsEnum::ADDONS_NAME_HUIJU_BILL, 'basic');
- $pay = Yii::$app->payment->huijuBill($config);
- // 发起退款
- return $pay->refund($data);
- }
- }
|