现金红包状态查询
@param string $billno
@return bool|array
@link https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=13_7&index=6
335677
public function queryRedPack($billno)
    {
        $data['mch_billno'] = $billno;
        $data['bill_type'] = 'MCHT';
        $result = $this->postXmlSSL($data, self::MCH_BASE_URL . '/mmpaymkttransfers/gethbinfo');
        $json = Tools::xml2arr($result);
        if (!empty($json) && false === $this->_parseResult($json)) {
            return false;
        }
        return $json;
    }
1289219
public function createSupercashCoupon(array $supercashCoupon)
    {
        $coupon = ['go_id' => $this->payments->getGopay()->getConfig('goid')] + $supercashCoupon;

        return $this->payments->post('supercash/coupon', GoPay::JSON, $coupon);
    }
728772
public function getCoinsInfo()
    {
        $url = "https://api.weixin.qq.com/card/pay/getcoinsinfo?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpGetForJson($url);
    }
1350004
public static function NewBill($data)
	{
		$bill = new Bill;
		$merchantData = Headers::GetMerchant();
		$bill->merchant_id = $merchantData['login'];
		$bill->bill_id = $data['bill_id'];
		$bill->user = $data['user'];
		$bill->amount = $data['amount'];
		$bill->ccy = $data['ccy'];
		$bill->comment = isset($data['comment']) ? $data['comment'] : null;
		$bill->lifetime = isset($data['lifetime']) ? $data['lifetime'] : 0;
		$bill->pay_source = isset($data['pay_source']) ? $data['pay_source'] : null;
		$bill->prv_name = isset($data['prv_name']) ? $data['prv_name'] : null;
		$bill->status = Bill::C_STATUS_WAITING;
		$bill->save();

		return $bill;

	}
551625
public function QPayOrderQuery($params = array()){
        /*        //入参
                $params = array();
                $params["out_trade_no"] = "20160512161914_BBC";
                $params["sub_mch_id"] = "1900005911";*/
        if (empty($params["out_trade_no"])){
            throw new Exception('商户订单号参数不能缺少' ,'OUT_TRADE_NO_MUST_INPUT');
        }
        if (empty($params["sub_mch_id"])){
            throw new Exception('sub_mch_id不能缺少' ,'FEE_TYPE');
        }

        //api调用
        $qpayApi = new QpayMchAPI('https://qpay.qq.com/cgi-bin/pay/qpay_order_query.cgi', null, 10);
        $qpayApi->setMchId('1490434181');
        $qpayApi->setMchKey('8525638f86969d1de5c51ad0494f4f13');
        $ret = $qpayApi->reqQpay($params);
        return QpayMchUtil::xmlToArray($ret);
    }
569120
public function closeOrder($out_trade_no)
    {
        $data = array('out_trade_no' => $out_trade_no);
        $result = $this->getArrayResult($data, self::MCH_BASE_URL . '/pay/closeorder');
        if (false === $this->_parseResult($result)) {
            return false;
        }
        return ($result['return_code'] === 'SUCCESS');
    }
762446
public function payRecharge($coin_count)
    {
        $url = "https://api.weixin.qq.com/card/pay/recharge?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, ['coin_count' => $coin_count]);
    }
426809
public static function doPay($billId)
	{
		$isUpdate = self::whereBillId($billId)
			->whereStatus(self::C_STATUS_WAITING)
			->update(
				array('status' => self::C_STATUS_PAID)
			);
		if ($isUpdate) {
			return true;
		}

		return false;
	}
735156
public static function downloadBill($inputObj, $timeOut = 6)
	{
		$url = "https://api.mch.weixin.qq.com/pay/downloadbill";
		//检测必填参数
		if(!$inputObj->IsBill_dateSet()) {
			throw new WxPayException("对账单接口中，缺少必填参数bill_date！");
		}
		$inputObj->SetAppid(WxPayConfig::$APPID);//公众账号ID
		$inputObj->SetMch_id(WxPayConfig::$MCHID);//商户号
		$inputObj->SetNonce_str(self::getNonceStr());//随机字符串
		
		$inputObj->SetSign();//签名
		$xml = $inputObj->ToXml();
		
		$response = self::postXmlCurl($xml, $url, false, $timeOut);
		if(substr($response, 0 , 5) == "<xml>"){
			return "";
		}
		return $response;
	}
364821
protected function userPayment()
    {
        $this->refId = Input::get('RefNum');
        $this->trackingCode = Input::get('‫‪TRACENO‬‬');
        $this->cardNumber = Input::get('‫‪SecurePan‬‬');
        $payRequestRes = Input::get('State');
        $payRequestResCode = Input::get('StateCode');

        if ($payRequestRes == 'OK') {
            return true;
        }

        $this->transactionFailed();
        $this->newLog($payRequestResCode, @SamanException::$errors[$payRequestRes]);
        throw new SamanException($payRequestRes);
    }
940142
public function getFPaymentCosts()
    {
        $oPaymentCost = $this->getCosts('oxpayment');
        if ($oPaymentCost && $oPaymentCost->getBruttoPrice()) {
            return \OxidEsales\Eshop\Core\Registry::getLang()->formatCurrency($oPaymentCost->getBruttoPrice(), $this->getBasketCurrency());
        }

        return false;
    }
300817
public function codeGet($code, $check_consume = true, $card_id = '')
    {
        if (empty($code) || !is_bool($check_consume)) {
            $this->setError('参数错误');

            return false;
        }

        $queryStr = [];
        if (!empty($card_id)) {
            $queryStr['card_id'] = $card_id;
        }
        $queryStr['code']          = $code;
        $queryStr['check_consume'] = $check_consume;

        $this->apitype = 'card';
        $this->module  = 'code';
        $res           = $this->_post('get', $queryStr);

        return $res;
    }
345875
public static function createFromBill($bill, $scenario)
    {
        $attributes = $bill->getAttributes([
            'id', 'object_id', 'client_id', 'currency', 'type',
            'gtype', 'sum', 'time', 'quantity', 'unit', 'label', 'object', 'class',
        ]);

        $form = new self(['scenario' => $scenario]);
        $form->setAttributes($attributes, false);

        $form->charges = array_map(function ($model) use ($scenario) {
            $model->scenario = $scenario;

            return $model;
        }, $bill->charges);

        return $form;
    }
914762
public function payment(Payment $payment, &$paymentParams)
    {
        if (!$this->checkCurrency($payment->currency)) {
            Yii::$app->session->setFlash(Yii::t('payment', 'The gateway does not support the current currency!'));
        } else {
            $params = [
                'MerNo' => $this->merNo,
                'BillNo' => $payment->id,
                'Amount' => round($payment->money, 2),
                'ReturnURL' => $this->getReturnUrl(),
                'AdviceURL' => $this->getNoticeUrl(),
                'products' => !empty($payment->model_id) ? $payment->model_id : '充值',
                'Remark' => 'Remark',
                'defaultBankNumber' => $this->defaultBankNumber,
                'orderTime' => date('YmdHis')
            ];
            $md5src = $this->merNo . '&' . $payment->id . '&' . $params['Amount'] . '&' . $params['ReturnURL'] . '&' . $this->md5Key;        //校验源字符串
            $params['SignInfo'] = strtoupper(md5($md5src));//MD5检验结果
            $this->getRedirectResponse($params);
        }
    }
1176858
public function query($mchBillno)
    {
        $this->params->offsetUnset('wxappid');
        $this->params->set('appid', $this->config->get('appid'));
        $url = "https://api.mch.weixin.qq.com/mmpaymkttransfers/gethbinfo";
        return $this->callPostApi($url, ['mch_billno' => $mchBillno, 'bill_type' => 'MCHT'], true, 'MD5', false);
    }
656421
protected function getCouponId()
	{
		if( !isset( $this->couponId ) )
		{
			$manager = \Aimeos\MShop::create( $this->getContext(), 'coupon' );

			$search = $manager->createSearch()->setSlice( 0, 1 );
			$search->setConditions( $search->compare( '=~', 'coupon.provider', 'Voucher' ) );

			$items = $manager->searchItems( $search );

			if( ( $item = reset( $items ) ) === false ) {
				throw new \Aimeos\Controller\Jobs\Exception( 'No coupon provider "Voucher" available' );
			}

			$this->couponId = $item->getId();
		}

		return $this->couponId;
	}
1323989
private function isActive(CouponInterface $coupon, \DateTime $now = null)
    {
        if (!$coupon->isEnabled()) {
            return false;
        }

        $now = $now ?: $this
            ->dateTimeFactory
            ->create();

        if ($coupon->getValidFrom() > $now) {
            return false;
        }

        $validTo = $coupon->getValidTo();
        if ($validTo && $now > $validTo) {
            return false;
        }

        return true;
    }