Skip to content

Commit

Permalink
Merge pull request #79 from TheNorthMemory/v1.4
Browse files Browse the repository at this point in the history
bump to v1.4.3
  • Loading branch information
xy-peng authored Jan 4, 2022
2 parents 2478445 + 3a14654 commit d384eba
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 17 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# 变更历史

## [1.4.2](../../compare/v1.4.1...v1.4.2) - 2021-11-30
## [1.4.3](../../compare/v1.4.2...v1.4.3) - 2022-01-04

- 优化,严格限定初始化时`mchid`为字符串;
- 优化,严格限定`chain`接口函数入参为字符串;
- 优化`README`,增加`常见问题`示例说明`URL template`用法;

## [1.4.2](../../compare/v1.4.1...v1.4.2) - 2021-12-02

- 优化`Rsa::parse`代码逻辑,去除`is_resource`/`is_object`检测;
- 调整`Rsa::from[Pkcs8|Pkcs1|Spki]`加载语法糖实现,以`Rsa::from`为统一入口;
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

## 项目状态

当前版本为 `1.4.2` 测试版本。项目版本遵循 [语义化版本号](https://semver.org/lang/zh-CN/)。如果你使用的版本 `<=v1.3.2`,升级前请参考 [升级指南](UPGRADING.md)
当前版本为 `1.4.3` 测试版本。项目版本遵循 [语义化版本号](https://semver.org/lang/zh-CN/)。如果你使用的版本 `<=v1.3.2`,升级前请参考 [升级指南](UPGRADING.md)

为了向广大开发者提供更好的使用体验,微信支付诚挚邀请您将**使用微信支付 API v3 SDK**中的感受反馈给我们。本问卷可能会占用您不超过2分钟的时间,感谢您的支持。

Expand Down Expand Up @@ -555,7 +555,7 @@ AesGcm::decrypt($cert->ciphertext, $apiv3Key, $cert->nonce, $cert->associated_da

- **推荐写法** `->v3->marketing->favor->users->_openid_->coupons->post(['openid' => 'AbcdEF12345'])`
- `->v3->marketing->favor->users->{'{openid}'}->coupons->post(['openid' => 'AbcdEF12345'])`
- `->chain('{+myurl}'->post(['myurl' => 'v3/marketing/favor/users/AbcdEF12345/coupons'])`
- `->chain('{+myurl}')->post(['myurl' => 'v3/marketing/favor/users/AbcdEF12345/coupons'])`
- `->{'{+myurl}'}->post(['myurl' => 'v3/marketing/favor/users/AbcdEF12345/coupons'])`

## 联系我们
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wechatpay/wechatpay",
"version": "1.4.2",
"version": "1.4.3",
"description": "[A]Sync Chainable WeChatPay v2&v3's OpenAPI SDK for PHP",
"type": "library",
"keywords": [
Expand Down
6 changes: 3 additions & 3 deletions src/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static function factory(array $config = []): BuilderChainable

/**
* Compose the chainable `ClientDecorator` instance, most starter with the tree root point
* @param (string|int)[] $input
* @param string[] $input
* @param ?ClientDecoratorInterface $instance
*/
public function __construct(array $input = [], ?ClientDecoratorInterface $instance = null) {
Expand Down Expand Up @@ -112,7 +112,7 @@ protected function pathname(string $seperator = '/'): string
/**
* Only retrieve a copy array of the URI segments
*
* @return (string|int)[] - The URI segments array
* @return string[] - The URI segments array
*/
protected function simplized(): array
{
Expand All @@ -136,7 +136,7 @@ public function offsetGet($key): BuilderChainable
/**
* @inheritDoc
*/
public function chain($segment): BuilderChainable
public function chain(string $segment): BuilderChainable
{
return $this->offsetGet($segment);
}
Expand Down
4 changes: 2 additions & 2 deletions src/BuilderChainable.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ public function getDriver(): ClientDecoratorInterface;
/**
* Chainable the given `$segment` with the `ClientDecoratorInterface` instance
*
* @param string|int $segment - The sgement or `URI`
* @param string $segment - The sgement or `URI`
*/
public function chain($segment): BuilderChainable;
public function chain(string $segment): BuilderChainable;

/**
* Create and send an HTTP GET request.
Expand Down
2 changes: 1 addition & 1 deletion src/ClientDecoratorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface ClientDecoratorInterface
/**
* @var string - This library version
*/
public const VERSION = '1.4.2';
public const VERSION = '1.4.3';

/**
* @var string - The HTTP transfer `xml` based protocol
Expand Down
5 changes: 2 additions & 3 deletions src/ClientJsonTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use function abs;
use function intval;
use function is_string;
use function is_numeric;
use function is_resource;
use function is_object;
use function is_array;
Expand Down Expand Up @@ -43,7 +42,7 @@ trait ClientJsonTrait
protected static $defaults = [
'base_uri' => 'https://api.mch.weixin.qq.com/',
'headers' => [
'Accept' => 'application/json, text/plain, application/x-gzip',
'Accept' => 'application/json, text/plain, application/x-gzip, application/pdf, image/png, image/*;q=0.5',
'Content-Type' => 'application/json; charset=utf-8',
],
];
Expand Down Expand Up @@ -169,7 +168,7 @@ public static function verifier(array &$certs): callable
public static function jsonBased(array $config = []): Client
{
if (!(
isset($config['mchid']) && (is_string($config['mchid']) || is_numeric($config['mchid']))
isset($config['mchid']) && is_string($config['mchid'])
)) { throw new Exception\InvalidArgumentException(Exception\ERR_INIT_MCHID_IS_MANDATORY); }

if (!(
Expand Down
3 changes: 1 addition & 2 deletions src/Crypto/AesGcm.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use function substr;
use function strlen;
use function openssl_decrypt;
use function intval;

use const OPENSSL_RAW_DATA;

Expand Down Expand Up @@ -72,7 +71,7 @@ public static function decrypt(string $ciphertext, string $key, string $iv = '',
self::preCondition();

$ciphertext = base64_decode($ciphertext);
$authTag = substr($ciphertext, $tailLength = intval(-static::BLOCK_SIZE));
$authTag = substr($ciphertext, $tailLength = 0 - static::BLOCK_SIZE);
$tagLength = strlen($authTag);

/* Manually checking the length of the tag, because the `openssl_decrypt` was mentioned there, it's the caller's responsibility. */
Expand Down
2 changes: 1 addition & 1 deletion tests/ClientDecoratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public function testSelect(array $config): void
* @var string $contentType
*/
['Accept' => $accept, 'Content-Type' => $contentType] = $headers;
self::assertEquals('application/json, text/plain, application/x-gzip', $accept);
self::assertStringStartsWith('application/json, text/plain, application/x-gzip', $accept);
self::assertEquals('application/json; charset=utf-8', $contentType);

$stackDebugInfo = strval($stack);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace WeChatPay\Tests\OpenAPI\V2\Mmpaymkttransfers\Promotion;

use WeChatPay\Builder;
use WeChatPay\Formatter;
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Psr7\Response;
Expand Down

0 comments on commit d384eba

Please sign in to comment.