mirror of
http://124.126.16.154:8888/singularity/hdk-pay.git
synced 2026-01-15 07:35:09 +08:00
Compare commits
9 Commits
v1.0.0-alp
...
v1.0.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
047b0ce67a | ||
|
|
7216e2c207 | ||
|
|
621fb057e4 | ||
|
|
1065741a08 | ||
|
|
271cdb3c0a | ||
|
|
816649784d | ||
|
|
d12858dda8 | ||
|
|
4d1b5d2ab7 | ||
|
|
8cb8f7eb9e |
@@ -19,7 +19,7 @@ jobs:
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install zip
|
||||
zip dist.zip *
|
||||
zip -r dist.zip *
|
||||
- name: Publish to registry
|
||||
run: |
|
||||
curl --user ch4o5:4fd300672472e666014314c1c94c604c634165a9 \
|
||||
|
||||
29
CHANGELOG.md
29
CHANGELOG.md
@@ -1,4 +1,33 @@
|
||||
# 版本更新日志
|
||||
## [1.0.0-beta.2](http://124.126.16.154:8888/singularity/hdk-pay/compare/v1.0.0-beta.1...v1.0.0-beta.2) (2024-12-06)
|
||||
|
||||
|
||||
### ✨ Features | 新功能
|
||||
|
||||
* **order:** 增加订单商品数量参数并优化代码格式 ([7216e2c](http://124.126.16.154:8888/singularity/hdk-pay/commit/7216e2c20763801d9d3532aad4b4463afb6fcc7e))
|
||||
|
||||
## [1.0.0-beta.1](http://124.126.16.154:8888/singularity/hdk-pay/compare/v1.0.0-beta.0...v1.0.0-beta.1) (2024-02-27)
|
||||
|
||||
|
||||
### 📦 Build System | 打包构建
|
||||
|
||||
* **hyperf:** 更新 guzzle 版本 ([1065741](http://124.126.16.154:8888/singularity/hdk-pay/commit/1065741a08cb8ac355cfa5b0e6f207ce5a8ed228))
|
||||
|
||||
## [1.0.0-beta.0](http://124.126.16.154:8888/singularity/hdk-pay/compare/v1.0.0-alpha.12...v1.0.0-beta.0) (2024-02-27)
|
||||
|
||||
|
||||
### 📦 Build System | 打包构建
|
||||
|
||||
* **hyperf:** 迁移到 hyperf3.1 ([d12858d](http://124.126.16.154:8888/singularity/hdk-pay/commit/d12858dda85fd2ce66ca1daff7e27eb381450d2f))
|
||||
* **release:** 发布 beta ([8166497](http://124.126.16.154:8888/singularity/hdk-pay/commit/816649784d5a85b7bd2d61e5415258c0b514dcc1))
|
||||
|
||||
## [1.0.0-alpha.12](http://124.126.16.154:8888/singularity/hdk-pay/compare/v1.0.0-alpha.11...v1.0.0-alpha.12) (2023-10-23)
|
||||
|
||||
|
||||
### 👷 Continuous Integration | CI 配置
|
||||
|
||||
* 修复内容为空的问题 ([8cb8f7e](http://124.126.16.154:8888/singularity/hdk-pay/commit/8cb8f7eb9e8d97408a3a71fec75699579b058c09))
|
||||
|
||||
## [1.0.0-alpha.11](http://124.126.16.154:8888/singularity/hdk-pay/compare/v1.0.0-alpha.10...v1.0.0-alpha.11) (2023-10-23)
|
||||
|
||||
|
||||
|
||||
@@ -14,24 +14,24 @@
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.1",
|
||||
"php": ">=8.2",
|
||||
"composer/composer": ">=2.5.8",
|
||||
"hyperf/guzzle": "~3.0.0",
|
||||
"hyperf/config": "~3.1.0",
|
||||
"hyperf/constants": "3.1.*",
|
||||
"hyperf/contract": "~3.1.0",
|
||||
"hyperf/di": "~3.1.0",
|
||||
"hyperf/guzzle": "3.1.*",
|
||||
"hyperf/http-server": "3.1.*",
|
||||
"moneyphp/money": "^4.1",
|
||||
"singularity/hdk-core": "^1.0.0",
|
||||
"hyperf/contract": "~3.0.0",
|
||||
"hyperf/constants": "3.0.*",
|
||||
"hyperf/config": "~3.0.0",
|
||||
"hyperf/di": "~3.0.0",
|
||||
"hyperf/http-server": "3.0.*"
|
||||
"singularity/hdk-core": "^1.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"cooper/hyperf-pest": "^1.1",
|
||||
"firebase/php-jwt": "^6.8.0",
|
||||
"phpunit/phpunit": "^9.6.9",
|
||||
"hyperf/testing": "^3.1",
|
||||
"friendsofhyperf/pest-plugin-hyperf": "3.1.*",
|
||||
"swoole/ide-helper": "^4.8.13"
|
||||
},
|
||||
"minimum-stability": "alpha",
|
||||
"minimum-stability": "beta",
|
||||
"prefer-stable": true,
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
@@ -47,7 +47,7 @@
|
||||
"test": [
|
||||
"rm -rf runtime",
|
||||
"Composer\\Config::disableProcessTimeout",
|
||||
"co-pest --prepend tests/bootstrap.php -c phpunit.xml --colors=always"
|
||||
"APP_STATUS=false pest --coroutine --prepend=tests/bootstrap.php --colors=always $1"
|
||||
],
|
||||
"cs-fix": "php-cs-fixer fix $1",
|
||||
"analyse": "phpstan analyse --memory-limit 300M -l 0 -c phpstan.neon ./app ./config"
|
||||
@@ -62,5 +62,5 @@
|
||||
"url": "https://mirrors.aliyun.com/composer/"
|
||||
}
|
||||
},
|
||||
"version": "1.0.0-alpha.11"
|
||||
"version": "1.0.0-beta.2"
|
||||
}
|
||||
|
||||
3635
composer.lock
generated
3635
composer.lock
generated
File diff suppressed because it is too large
Load Diff
10
phpunit.xml
10
phpunit.xml
@@ -1,10 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php"
|
||||
colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd">
|
||||
<coverage/>
|
||||
<phpunit
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Pest">
|
||||
<directory>./tests/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<source/>
|
||||
</phpunit>
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
|
||||
docker run \
|
||||
--pull always \
|
||||
-ti --rm --name "hdk-pay" \
|
||||
-w "/srv/www" \
|
||||
-v "$(pwd)":/srv/www \
|
||||
-v ~/.ssh:/root/.ssh \
|
||||
harbor.luxcreo.cn/library/hyperf:8.1-swoole /bin/ash
|
||||
harbor.luxcreo.cn/library/hyperf:8.2-swoole /bin/ash
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
docker run --rm -it \
|
||||
-v $(pwd):/app -e "GIT_AUTHOR_NAME=ch4o5" -e "EMAIL=dongyun.li@luxcreo.ai" \
|
||||
detouched/standard-version:latest -p=alpha $1
|
||||
detouched/standard-version:latest -p=beta $1
|
||||
|
||||
@@ -14,13 +14,13 @@ use Singularity\HDK\Pay\Enum\OrderStatus;
|
||||
* Powered by PhpStorm
|
||||
* Created on 2023/9/19
|
||||
*
|
||||
* @property-read string $orderNo
|
||||
* @property-read string transactionId
|
||||
* @property-read Money amount
|
||||
* @property-read string $orderNo
|
||||
* @property-read string transactionId
|
||||
* @property-read Money amount
|
||||
* @property-read OrderStatus state
|
||||
* @property-read string uid
|
||||
* @property-read string payment
|
||||
* @property-read string remark
|
||||
* @property-read string uid
|
||||
* @property-read string payment
|
||||
* @property-read string remark
|
||||
*/
|
||||
class Order extends JsonResource
|
||||
{
|
||||
@@ -48,12 +48,13 @@ class Order extends JsonResource
|
||||
'goodsName' => $this->resource['goodsName'],
|
||||
'amount' => new Money(
|
||||
$this->resource['amount']['amount'],
|
||||
new Currency($this->resource['amount']['currency'])
|
||||
new Currency($this->resource['amount']['currency']),
|
||||
),
|
||||
'state' => OrderStatus::from($this->resource['state']),
|
||||
'uid' => $this->resource['uid'],
|
||||
'payment' => $this->resource['payment'],
|
||||
'remark' => $this->resource['remark'],
|
||||
'number' => $this->resource['number'] ?? 1,
|
||||
// extends
|
||||
// 'spId' => $this->spId,
|
||||
// 'goodsDetail' => GoodsCollection::make([$this->goodsDetail])->resolve(),
|
||||
|
||||
@@ -14,7 +14,6 @@ namespace Singularity\HDK\Pay\Sdk;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use GuzzleHttp\RequestOptions;
|
||||
use Hyperf\Codec\Json;
|
||||
use Hyperf\HttpServer\Contract\RequestInterface;
|
||||
use Lmc\HttpConstants\Header;
|
||||
use Money\Money;
|
||||
use Singularity\HDK\Core\Http\RequestService;
|
||||
@@ -22,7 +21,6 @@ use Singularity\HDK\Core\Http\RequestServiceFactory;
|
||||
use Singularity\HDK\Core\I18n\Enum\Languages;
|
||||
use Singularity\HDK\Pay\Resource\Order;
|
||||
use Singularity\HDK\Pay\Resource\StripeConfiguration;
|
||||
|
||||
use Singularity\HDK\Pay\Trait\WebhooksNotificationHandler;
|
||||
|
||||
use function Hyperf\Config\config;
|
||||
@@ -58,11 +56,15 @@ final class StripeRpc
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Money $money
|
||||
* @param string $uid
|
||||
* @param int $goodsId
|
||||
* @param string $goodsName
|
||||
* @param array $goodsDetail
|
||||
* @param Money $money 总金额
|
||||
* @param string $uid
|
||||
* @param int $goodsId
|
||||
* @param string $goodsName
|
||||
* @param array $goodsDetail
|
||||
* @param int $number
|
||||
* @param Languages|null $locale
|
||||
* @param int|null $service
|
||||
*
|
||||
* @return Order
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
@@ -72,6 +74,7 @@ final class StripeRpc
|
||||
int $goodsId,
|
||||
string $goodsName,
|
||||
array $goodsDetail,
|
||||
int $number = 1,
|
||||
?Languages $locale = null,
|
||||
?int $service = null,
|
||||
): Order {
|
||||
@@ -87,15 +90,16 @@ final class StripeRpc
|
||||
[
|
||||
'id' => $goodsId,
|
||||
'goodsName' => $goodsName,
|
||||
]
|
||||
],
|
||||
),
|
||||
'number' => $number,
|
||||
],
|
||||
options: [
|
||||
'headers' => [
|
||||
Header::CONTENT_TYPE => 'application/json',
|
||||
Header::ACCEPT_LANGUAGE => $locale?->value ?? config('translation.locale')
|
||||
]
|
||||
]
|
||||
Header::ACCEPT_LANGUAGE => $locale?->value ?? config('translation.locale'),
|
||||
],
|
||||
],
|
||||
);
|
||||
|
||||
$content = $response->getBody()->getContents();
|
||||
|
||||
@@ -46,10 +46,12 @@ final class WechatRpc
|
||||
|
||||
/**
|
||||
* @param RequestInterface $request
|
||||
* @param string $type
|
||||
* @param string $goodsName
|
||||
* @param Money $money
|
||||
* @param string $uid
|
||||
* @param string $type
|
||||
* @param string $goodsName
|
||||
* @param Money $money
|
||||
* @param string $uid
|
||||
* @param int $number
|
||||
*
|
||||
* @return array{uri: string, orderNo: string}
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
@@ -58,7 +60,8 @@ final class WechatRpc
|
||||
string $type,
|
||||
string $goodsName,
|
||||
Money $money,
|
||||
string $uid
|
||||
string $uid,
|
||||
int $number = 1,
|
||||
): array {
|
||||
$response = $this->requestService
|
||||
->setOptions([
|
||||
@@ -76,7 +79,8 @@ final class WechatRpc
|
||||
'goods_detail' => [
|
||||
'goods_name' => $goodsName,
|
||||
],
|
||||
]
|
||||
'number' => $number,
|
||||
],
|
||||
);
|
||||
|
||||
$content = $response->getBody()->getContents();
|
||||
|
||||
@@ -21,7 +21,7 @@ test(
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
function () {
|
||||
$service = new GoodsRpc('http://192.168.2.218:9611');
|
||||
$service = new GoodsRpc('http://192.168.2.246:9611');
|
||||
$goods = $service->find(
|
||||
1,
|
||||
[
|
||||
|
||||
@@ -18,7 +18,7 @@ use Singularity\HDK\Pay\Sdk\StripeRpc;
|
||||
|
||||
test('能够正常创建 Stripe 订单', function () {
|
||||
/** @var StripeRpc $service */
|
||||
$service = \Hyperf\Support\make(StripeRpc::class, ['baseUrl' => 'http://192.168.2.218:9611']);
|
||||
$service = \Hyperf\Support\make(StripeRpc::class, ['baseUrl' => 'http://192.168.2.246:9611']);
|
||||
$order = $service->createSession(
|
||||
money: Money::USD(51),
|
||||
uid: uniqid('NAT_'),
|
||||
@@ -33,7 +33,7 @@ test('能够正常创建 Stripe 订单', function () {
|
||||
|
||||
test('能够正常获取 Stripe 配置信息', function () {
|
||||
/** @var StripeRpc $service */
|
||||
$service = \Hyperf\Support\make(StripeRpc::class, ['baseUrl' => 'http://192.168.2.218:9611']);
|
||||
$service = \Hyperf\Support\make(StripeRpc::class, ['baseUrl' => 'http://192.168.2.246:9611']);
|
||||
$configures = $service->getConfigurations();
|
||||
|
||||
expect($configures)
|
||||
|
||||
Reference in New Issue
Block a user