|
@@ -42,6 +42,36 @@ class WebGateway extends Gateway
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Pay an order.
|
|
|
+ *
|
|
|
+ * @author yansongda <me@yansongda.cn>
|
|
|
+ *
|
|
|
+ * @param string $endpoint
|
|
|
+ *
|
|
|
+ * @throws InvalidConfigException
|
|
|
+ * @throws InvalidArgumentException
|
|
|
+ */
|
|
|
+ public function pay_wap($endpoint, array $payload)
|
|
|
+ {
|
|
|
+ $biz_array = json_decode($payload['biz_content'], true);
|
|
|
+ $biz_array['product_code'] = $this->getProductCode();
|
|
|
+
|
|
|
+ $method = $biz_array['http_method'] ?? 'POST';
|
|
|
+
|
|
|
+ unset($biz_array['http_method']);
|
|
|
+ if ((Alipay::MODE_SERVICE === $this->mode) && (!empty(Support::getInstance()->pid))) {
|
|
|
+ $biz_array['extend_params'] = is_array($biz_array['extend_params']) ? array_merge(['sys_service_provider_id' => Support::getInstance()->pid], $biz_array['extend_params']) : ['sys_service_provider_id' => Support::getInstance()->pid];
|
|
|
+ }
|
|
|
+ $payload['method'] = $this->getMethod();
|
|
|
+ $payload['biz_content'] = json_encode($biz_array);
|
|
|
+ $payload['sign'] = Support::generateSign($payload);
|
|
|
+
|
|
|
+ Events::dispatch(new Events\PayStarted('Alipay', 'Web/Wap', $endpoint, $payload));
|
|
|
+
|
|
|
+ return $this->buildPayHtml_wap($endpoint, $payload, $method);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* Find.
|
|
|
*
|
|
|
* @author yansongda <me@yansongda.cn>
|
|
@@ -83,6 +113,20 @@ class WebGateway extends Gateway
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Build Html response.
|
|
|
+ *
|
|
|
+ * @author yansongda <me@yansongda.cn>
|
|
|
+ *
|
|
|
+ * @param string $endpoint
|
|
|
+ * @param array $payload
|
|
|
+ * @param string $method
|
|
|
+ */
|
|
|
+ protected function buildPayHtml_wap($endpoint, $payload, $method = 'POST')
|
|
|
+ {
|
|
|
+ return $endpoint.'&'.http_build_query($payload);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* Get method config.
|
|
|
*
|
|
|
* @author yansongda <me@yansongda.cn>
|