|
@@ -12,7 +12,7 @@ class TomatoPay {
|
|
|
$this->key = $key;
|
|
|
}
|
|
|
|
|
|
- public function pay ($cny, $type, $trade) {
|
|
|
+ public function alipay ($cny, $type, $trade) {
|
|
|
$params = [
|
|
|
'mchid' => $this->mchid,
|
|
|
'account' => $this->account,
|
|
@@ -21,16 +21,17 @@ class TomatoPay {
|
|
|
'trade' => $trade
|
|
|
];
|
|
|
$params['signs'] = $this->sign(http_build_query($params));
|
|
|
- return $this->buildHtml($params);
|
|
|
+ return $this->buildHtml('https://b.fanqieui.com/gateways/alipay.php', $params);
|
|
|
}
|
|
|
|
|
|
public function sign ($str) {
|
|
|
return md5($str.$this->key);
|
|
|
}
|
|
|
|
|
|
- public function buildHtml($params, $method = 'post', $target = '_self'){
|
|
|
+ public function buildHtml($url, $params, $method = 'post', $target = '_self'){
|
|
|
+
|
|
|
// var_dump($params);exit;
|
|
|
- $html = "<form id='submit' name='submit' action='https://b.fanqieui.com/gateways/submit.php' method='$method' target='$target'>";
|
|
|
+ $html = "<form id='submit' name='submit' action='".$url."' method='$method' target='$target'>";
|
|
|
foreach ($params as $key => $value) {
|
|
|
$html .= "<input type='hidden' name='$key' value='$value'/>";
|
|
|
}
|