sign() 공개 정적인 메소드

public static sign ( $data, $key )
 /**
  * Get the raw data array for this message. The format of this varies from gateway to
  * gateway, but will usually be either an associative array, or a SimpleXMLElement.
  * @return mixed
  * @throws InvalidRequestException
  */
 public function getData()
 {
     $this->validate('app_id', 'mch_id', 'out_trade_no');
     $data = array('appid' => $this->getAppId(), 'mch_id' => $this->getMchId(), 'out_trade_no' => $this->getOutTradeNo(), 'nonce_str' => md5(uniqid()));
     $data = array_filter($data);
     $data['sign'] = Helper::sign($data, $this->getApiKey());
     return $data;
 }
 /**
  * Get the raw data array for this message. The format of this varies from gateway to
  * gateway, but will usually be either an associative array, or a SimpleXMLElement.
  * @return mixed
  * @throws InvalidRequestException
  */
 public function getData()
 {
     $this->validate('app_id', 'mch_id', 'out_trade_no', 'cert_path', 'key_path');
     $data = array('appid' => $this->getAppId(), 'mch_id' => $this->getMchId(), 'device_info' => $this->getDeviceInfo(), 'transaction_id' => $this->getTransactionId(), 'out_trade_no' => $this->getOutTradeNo(), 'out_refund_no' => $this->getOutRefundNo(), 'total_fee' => $this->getTotalFee(), 'refund_fee' => $this->getRefundFee(), 'refund_fee_type' => $this->getRefundFee(), 'op_user_id' => $this->getOpUserId() ?: $this->getMchId(), 'nonce_str' => md5(uniqid()));
     $data = array_filter($data);
     $data['sign'] = Helper::sign($data, $this->getApiKey());
     return $data;
 }
 /**
  * Get the raw data array for this message. The format of this varies from gateway to
  * gateway, but will usually be either an associative array, or a SimpleXMLElement.
  * @return mixed
  * @throws InvalidRequestException
  */
 public function getData()
 {
     $this->validate('app_id', 'mch_id', 'long_url');
     $data = array('appid' => $this->getAppId(), 'mch_id' => $this->getMchId(), 'long_url' => $this->getLongUrl(), 'nonce_str' => md5(uniqid()));
     $data = array_filter($data);
     $data['sign'] = Helper::sign($data, $this->getApiKey());
     return $data;
 }
 /**
  * Get the raw data array for this message. The format of this varies from gateway to
  * gateway, but will usually be either an associative array, or a SimpleXMLElement.
  *
  * @return mixed
  */
 public function getData()
 {
     $this->validate('app_id', 'mch_id', 'body', 'out_trade_no', 'total_fee', 'auth_code');
     $data = array('appid' => $this->getAppId(), 'mch_id' => $this->getMchId(), 'device_info' => $this->getDeviceInfo(), 'body' => $this->getBody(), 'detail' => $this->getDetail(), 'attach' => $this->getAttach(), 'out_trade_no' => $this->getOutTradeNo(), 'fee_type' => $this->getFeeType(), 'total_fee' => $this->getTotalFee(), 'spbill_create_ip' => $this->getClientIp() ?: $this->getServerIp(), 'goods_tag' => $this->getGoodsTag(), 'limit_pay' => $this->getLimitPay(), 'auth_code' => $this->getAuthCode(), 'nonce_str' => md5(uniqid()));
     $data = array_filter($data);
     $data['sign'] = Helper::sign($data, $this->getApiKey());
     return $data;
 }
 /**
  * Get the raw data array for this message. The format of this varies from gateway to
  * gateway, but will usually be either an associative array, or a SimpleXMLElement.
  * @return mixed
  * @throws InvalidRequestException
  */
 public function getData()
 {
     $this->validate('app_id', 'mch_id', 'bill_date');
     $data = array('appid' => $this->getAppId(), 'mch_id' => $this->getMchId(), 'device_info' => $this->getDeviceInfo(), 'bill_date' => $this->getBillDate(), 'bill_type' => $this->getBillType(), 'nonce_str' => md5(uniqid()));
     $data = array_filter($data);
     $data['sign'] = Helper::sign($data, $this->getApiKey());
     return $data;
 }
 public function getOrderData()
 {
     if ($this->isSuccessful()) {
         $data = array('app_id' => $this->request->getAppId(), 'mch_id' => $this->request->getMchId(), 'prepay_id' => $this->getPrepayId(), 'package' => 'Sign=WXPay', 'nonce' => md5(uniqid()), 'timestamp' => time());
         $data['sign'] = Helper::sign($data, $this->request->getApiKey());
     } else {
         $data = null;
     }
     return $data;
 }
 public function getJSOrderData()
 {
     if ($this->isSuccessful()) {
         $data = array('appId' => $this->request->getAppId(), 'package' => 'prepay_id=' . $this->getPrepayId(), 'nonceStr' => md5(uniqid()), 'timeStamp' => time());
         $data['signType'] = 'MD5';
         $data['paySign'] = Helper::sign($data, $this->request->getApiKey());
     } else {
         $data = null;
     }
     return $data;
 }
 /**
  * Get the raw data array for this message. The format of this varies from gateway to
  * gateway, but will usually be either an associative array, or a SimpleXMLElement.
  * @return mixed
  * @throws InvalidRequestException
  */
 public function getData()
 {
     $this->validate('app_id', 'mch_id');
     if (!$this->getTransactionId() && !$this->getOutTradeNo()) {
         throw new InvalidRequestException("The 'transaction_id' or 'out_trade_no' parameter is required");
     }
     $data = array('appid' => $this->getAppId(), 'mch_id' => $this->getMchId(), 'transaction_id' => $this->getTransactionId(), 'out_trade_no' => $this->getOutTradeNo(), 'nonce_str' => md5(uniqid()));
     $data = array_filter($data);
     $data['sign'] = Helper::sign($data, $this->getApiKey());
     return $data;
 }
 /**
  * Get the raw data array for this message. The format of this varies from gateway to
  * gateway, but will usually be either an associative array, or a SimpleXMLElement.
  *
  * @return mixed
  */
 public function getData()
 {
     $this->validate('app_id', 'mch_id', 'body', 'out_trade_no', 'total_fee', 'notify_url', 'trade_type', 'spbill_create_ip');
     $tradeType = strtoupper($this->getTradeType());
     if ($tradeType == 'JSAPI') {
         $this->validate('open_id');
     }
     $data = array('appid' => $this->getAppId(), 'mch_id' => $this->getMchId(), 'device_info' => $this->getDeviceInfo(), 'body' => $this->getBody(), 'detail' => $this->getDetail(), 'attach' => $this->getAttach(), 'out_trade_no' => $this->getOutTradeNo(), 'fee_type' => $this->getFeeType(), 'total_fee' => $this->getTotalFee(), 'spbill_create_ip' => $this->getSpbillCreateIp(), 'time_start' => $this->getTimeStart(), 'time_expire' => $this->getTimeExpire(), 'goods_tag' => $this->getGoodsTag(), 'notify_url' => $this->getNotifyUrl(), 'trade_type' => $this->getTradeType(), 'limit_pay' => $this->getLimitPay(), 'openid' => $this->getOpenId(), 'nonce_str' => md5(uniqid()));
     $data = array_filter($data);
     $data['sign'] = Helper::sign($data, $this->getApiKey());
     return $data;
 }
 /**
  * Get the raw data array for this message. The format of this varies from gateway to
  * gateway, but will usually be either an associative array, or a SimpleXMLElement.
  * @return mixed
  * @throws InvalidRequestException
  */
 public function getData()
 {
     $this->validate('app_id', 'mch_id');
     $queryIdEmpty = !$this->getTransactionId() && !$this->getOutTradeNo();
     $queryIdEmpty = $queryIdEmpty && !$this->getOutRefundNo() && !$this->getRefundId();
     if ($queryIdEmpty) {
         $message = "The 'transaction_id' or 'out_trade_no' or 'out_refund_no' or 'refund_id' parameter is required";
         throw new InvalidRequestException($message);
     }
     $data = array('appid' => $this->getAppId(), 'mch_id' => $this->getMchId(), 'device_info' => $this->getDeviceInfo(), 'transaction_id' => $this->getTransactionId(), 'out_trade_no' => $this->getOutTradeNo(), 'out_refund_no' => $this->getOutRefundNo(), 'refund_id' => $this->getRefundId(), 'nonce_str' => md5(uniqid()));
     $data = array_filter($data);
     $data['sign'] = Helper::sign($data, $this->getApiKey());
     return $data;
 }
 /**
  * Send the request with specified data
  *
  * @param  mixed $data The data to send
  *
  * @return ResponseInterface
  */
 public function sendData($data)
 {
     $data = $this->getData();
     $sign = Helper::sign($data, $this->getApiKey());
     $responseData = array();
     if (isset($data['sign']) && $data['sign'] && $sign === $data['sign']) {
         $responseData['sign_match'] = true;
     } else {
         $responseData['sign_match'] = false;
     }
     if ($responseData['sign_match'] && isset($data['result_code']) && $data['result_code'] == 'SUCCESS') {
         $responseData['paid'] = true;
     } else {
         $responseData['paid'] = false;
     }
     return $this->response = new CompletePurchaseResponse($this, $responseData);
 }