/** * 获取微信支付时的签名 * * @param null|array $charge * @param null|string $url * @return string * @throws InvalidConfigException */ public function getWechatSignature($charge = null, $url = null) { if ($charge === null) { $charge = $this->getCharge(true); } if (!isset($charge['credential']) || !isset($charge['credential']['wx_pub'])) { throw new \BadMethodCallException('Credential must be ' . Channel::WX_PUB); } $component = $this->getComponent(); $jsApiTicket = $component->getJsApiTicket(); if ($url === null) { $url = Url::current([], true); } return WxpubOAuth::getSignature($this->getCharge(true), $jsApiTicket, $url); }
public function getSignature(Charge $charge, $ticket, $url = null) { return WxpubOAuth::getSignature($charge, $ticket, $url); }