public function getAccount() { self::$userId = \Input::get('user_id', ''); self::$accChannel = ChannelUtil::calculateAccountChannel(\Input::get('channel', 0)); $account = AccountBiz::getInstance()->getAccount(self::$userId, self::$accChannel); if (!$account) { throw new PayException(ErrCode::ERR_ACCOUNT_NO_EXISTS); } return $account; }
private function _getPayNotifyArgs($channel, $gateway) { $channel = Util\ChannelUtil::calculateAccountChannel($channel); $gatewayObj = Util\GatewayUtil::getGatewayObj($gateway); try { $notice = $gatewayObj->notify($channel); if (!$notice) { return false; } return $notice; } catch (\Exception $e) { return $e->getMessage(); } }
public function getOrCreateAccount($userId, $channel = 1) { $accChannel = ChannelUtil::calculateAccountChannel($channel); $account = $this->getAccount($userId, $accChannel); if (!$account) { $primaryId = $this->_accountModel->calculPrimaryId(); $this->_accountModel->id = $primaryId; $this->_accountModel->user_id = $userId; $this->_accountModel->acc_channel = $accChannel; $this->_accountModel->create_time = time(); $this->_accountModel->save(); return $this->_accountModel; } return $account; }
public function transThirdParty($batchNo) { $transArr = TransModel::where('batch_no', $batchNo)->get(); foreach ($transArr as $trans) { $fields[] = ['channel' => ChannelUtil::calculateAccountChannel($trans['channel']), 'gateway' => $trans['gateway'], 'mer_trans_no' => $trans['mer_trans_no'], 'batch_no' => $trans['batch_no'], 'bank_code' => $trans['bank_code'], 'timestamp' => $trans['create_time'], 'trans_amount' => $trans['trans_amount'], 'subject' => $trans['subject'], 'user_name' => $trans['person_name'], 'user_account' => $trans['person_account'], 'notify_url' => PayVars::getNotifyUrl() . "notify/trans/{$trans['channel']}/{$trans['gateway']}"]; } $gatewayObj = GatewayUtil::getGatewayObj($fields[0]['gateway']); return $gatewayObj->trans($fields); }
public function seConfirmTrans($job, $data) { $errCode = 0; $transOrder = TransModel::find($data['id'])->first(); do { if (!$transOrder || $transOrder->status != TransModel::STATUS_DEFAULT) { $errCode = 1; break; } if (!$transOrder->gateway || !$transOrder->channel) { $errCode = 2; break; } if (false === ($channel = ChannelUtil::calculateAccountChannel($transOrder->channel))) { $errCode = 3; break; } $gatewayObj = gatewayUtil::getGatewayObj($transOrder->gateway); if (!$gatewayObj) { $errCode = 4; break; } if (!method_exists($gatewayObj, 'transQuery')) { $errCode = 5; break; } } while (0); if ($errCode == 0) { $order = ['channel' => $channel, 'gateway' => $transOrder->gateway, 'batch_no' => $transOrder->batch_no, 'mer_trans_no' => $transOrder->mer_trans_no]; $notice = $gatewayObj->transQuery($order); $ret = SerNotifyBiz::getInstance()->payNotify($notice, 'trans'); if ($ret->is_success == 'T') { $job->delete(); } else { $job->release(60 * 60); } } else { $job->delete(); } }
public function directThirdParty($rechargeOrder) { $fields['channel'] = Util\ChannelUtil::calculateAccountChannel($rechargeOrder['channel']); $fields['gateway'] = $rechargeOrder['gateway']; $fields['plat'] = $rechargeOrder['plat']; $fields['mer_recharge_no'] = $rechargeOrder['mer_recharge_no']; $fields['bank_code'] = $rechargeOrder['bank_code']; $fields['timestamp'] = $rechargeOrder['create_time']; $fields['amount'] = $rechargeOrder['recharge_amount']; $fields['expire_time'] = $rechargeOrder['expire_time']; $fields['subject'] = $rechargeOrder['subject']; $fields['body'] = $rechargeOrder['body']; $fields['open_id'] = $rechargeOrder['gateway_account']; $gatewayObj = Util\GatewayUtil::getGatewayObj($fields['gateway']); $fields['notify_url'] = PayVars::getNotifyUrl() . "notify/direct/{$fields['channel']}/{$fields['gateway']}"; $fields['return_url'] = PayVars::getReturnUrl() . 'return/' . $gatewayObj->makeReturnUri($fields); return $gatewayObj->direct($fields); }