Compare commits

...

10 Commits

Author SHA1 Message Date
ch4o5
4d1b5d2ab7 chore(release): 1.0.0-alpha.12 2023-10-23 12:52:55 +00:00
李东云
8cb8f7eb9e ci: 修复内容为空的问题 2023-10-23 20:52:47 +08:00
ch4o5
c13fc7e800 chore(release): 1.0.0-alpha.11 2023-10-23 12:27:29 +00:00
李东云
8d6c0189a0 ci: 迁移到 Gitea Actions 2023-10-23 20:27:14 +08:00
ch4o5
dd690e228e chore(release): 1.0.0-alpha.10 2023-09-26 08:25:04 +00:00
李东云
46ecc8117c build(composer): 更新依赖 2023-09-26 16:24:54 +08:00
ch4o5
456294c1a4 chore(release): 1.0.0-alpha.9 2023-09-26 04:00:52 +00:00
李东云
a6898bb1a0 feat(stripe): 创建 session 接口增加了语言选项 2023-09-26 12:00:39 +08:00
ch4o5
999f3633a5 chore(release): 1.0.0-alpha.8 2023-09-22 10:23:09 +00:00
李东云
6431fc010f fix(order): 修复类型错误的问题 2023-09-22 18:22:59 +08:00
7 changed files with 3207 additions and 382 deletions

View File

@@ -0,0 +1,28 @@
name: Release development version to registry
on:
push:
tags:
- '**.**'
jobs:
Publish on Tagged:
runs-on: ubuntu-latest
steps:
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
- name: Check out repository code
uses: actions/checkout@v4
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
- name: List files in the repository
run: |
ls ${{ gitea.workspace }}
- name: Zip files in the repository
run: |
apt-get update
apt-get install zip
zip -r dist.zip *
- name: Publish to registry
run: |
curl --user ch4o5:4fd300672472e666014314c1c94c604c634165a9 \
--upload-file ./dist.zip \
https://nest.doylee.cn/api/packages/HDK/composer?version=${{ gitea.ref_name }}
- run: echo "🍏 This job's status is ${{ job.status }}."

View File

@@ -1,4 +1,39 @@
# 版本更新日志
## [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)
### 👷 Continuous Integration | CI 配置
* 迁移到 Gitea Actions ([8d6c018](http://124.126.16.154:8888/singularity/hdk-pay/commit/8d6c0189a0198d5d6e11e90cd8293107f414273c))
## [1.0.0-alpha.10](http://124.126.16.154:8888/singularity/hdk-pay/compare/v1.0.0-alpha.9...v1.0.0-alpha.10) (2023-09-26)
### 📦‍ Build System | 打包构建
* **composer:** 更新依赖 ([46ecc81](http://124.126.16.154:8888/singularity/hdk-pay/commit/46ecc8117ccb463ed498fa82e84bf41d9ebb752b))
## [1.0.0-alpha.9](http://124.126.16.154:8888/singularity/hdk-pay/compare/v1.0.0-alpha.8...v1.0.0-alpha.9) (2023-09-26)
### ✨ Features | 新功能
* **stripe:** 创建 session 接口增加了语言选项 ([a6898bb](http://124.126.16.154:8888/singularity/hdk-pay/commit/a6898bb1a097f3c66d3ef14f375725fdeaed4df5))
## [1.0.0-alpha.8](http://124.126.16.154:8888/singularity/hdk-pay/compare/v1.0.0-alpha.7...v1.0.0-alpha.8) (2023-09-22)
### 🐛 Bug Fixes | Bug 修复
* **order:** 修复类型错误的问题 ([6431fc0](http://124.126.16.154:8888/singularity/hdk-pay/commit/6431fc010fe3e989773b84506df62d3c8f7ffc81))
## [1.0.0-alpha.7](http://124.126.16.154:8888/singularity/hdk-pay/compare/v1.0.0-alpha.6...v1.0.0-alpha.7) (2023-09-22)

View File

@@ -31,12 +31,11 @@
"phpunit/phpunit": "^9.6.9",
"swoole/ide-helper": "^4.8.13"
},
"minimum-stability": "dev",
"minimum-stability": "alpha",
"prefer-stable": true,
"config": {
"optimize-autoloader": true,
"sort-packages": true,
"secure-http": false,
"allow-plugins": {
"pestphp/pest-plugin": true
}
@@ -54,14 +53,14 @@
"analyse": "phpstan analyse --memory-limit 300M -l 0 -c phpstan.neon ./app ./config"
},
"repositories": {
"lux-map": {
"nest": {
"type": "composer",
"url": "https://satis.luxcreo.cn/"
"url": "https://nest.doylee.cn/api/packages/HDK/composer"
},
"packagist": {
"type": "composer",
"url": "https://mirrors.cloud.tencent.com/composer/"
"url": "https://mirrors.aliyun.com/composer/"
}
},
"version": "1.0.0-alpha.7"
"version": "1.0.0-alpha.12"
}

3492
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -3,6 +3,7 @@
namespace Singularity\HDK\Pay\Resource;
use Hyperf\Resource\Json\JsonResource;
use Money\Currency;
use Money\Money;
use Singularity\HDK\Pay\Enum\OrderStatus;
@@ -45,7 +46,10 @@ class Order extends JsonResource
'orderNo' => $this->resource['orderNo'],
'transactionId' => $this->resource['transactionId'],
'goodsName' => $this->resource['goodsName'],
'amount' => new Money($this->resource['amount']['amount'], $this->resource['amount']['currency']),
'amount' => new Money(
$this->resource['amount']['amount'],
new Currency($this->resource['amount']['currency'])
),
'state' => OrderStatus::from($this->resource['state']),
'uid' => $this->resource['uid'],
'payment' => $this->resource['payment'],

View File

@@ -15,9 +15,11 @@ 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;
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;
@@ -70,14 +72,15 @@ final class StripeRpc
int $goodsId,
string $goodsName,
array $goodsDetail,
?int $service = null
?Languages $locale = null,
?int $service = null,
): Order {
$response = $this->requestService->requestPost(
url: '/rpc/v1/stripe/order',
data: [
'service' => $service ?? config('payment.sp_id'),
'amount' => $money->getAmount(),
'currency' => $money->getCurrency(),
'currency' => (string)$money->getCurrency(),
'uid' => $uid,
'goodsDetail' => array_replace(
$goodsDetail,
@@ -87,6 +90,12 @@ final class StripeRpc
]
),
],
options: [
'headers' => [
Header::CONTENT_TYPE => 'application/json',
Header::ACCEPT_LANGUAGE => $locale?->value ?? config('translation.locale')
]
]
);
$content = $response->getBody()->getContents();

View File

@@ -11,6 +11,7 @@
/** @var StripeRpc $service */
use Money\Money;
use Singularity\HDK\Core\I18n\Enum\Languages;
use Singularity\HDK\Pay\Resource\Order;
use Singularity\HDK\Pay\Resource\StripeConfiguration;
use Singularity\HDK\Pay\Sdk\StripeRpc;
@@ -21,9 +22,10 @@ test('能够正常创建 Stripe 订单', function () {
$order = $service->createSession(
money: Money::USD(51),
uid: uniqid('NAT_'),
goodsId: 3,
goodsId: 1,
goodsName: 'HDK-Pay Test',
goodsDetail: [],
locale: Languages::EN,
service: 1
);
expect($order)->toBeInstanceOf(Order::class);