Skip to content

Commit d428c9b

Browse files
author
Success Go
authored
Merge pull request #172 from hogus2037/master
fixed alipay notify sign validate error
2 parents 71ed19f + e481a0c commit d428c9b

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

src/Common/Signer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Signer
1818
const KEY_TYPE_PUBLIC = 1;
1919
const KEY_TYPE_PRIVATE = 2;
2020

21-
protected $ignores = ['sign'];
21+
protected $ignores = ['sign', 'sign_type'];
2222

2323
protected $sort = true;
2424

tests/AopAppGatewayTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public function testCompletePurchaseNotify()
136136
}
137137

138138
$this->assertEquals(
139-
'{"total_amount":"0.01","buyer_id":"20882025611234567","trade_no":"201609232100100306021234567","refund_fee":"0.00","notify_time":"2016-09-23 19:12:33","subject":"test","sign_type":"RSA","notify_type":"trade_status_sync","out_trade_no":"2016092313071234567","gmt_close":"2016-09-23 19:08:10","trade_status":"TRADE_FINISHED","gmt_payment":"2016-09-23 19:08:10","sign":"Pj9CrLMvcQB5w1wN0ngelHCSonoe3j6zjYcZsU8kqsE3ZqLb9pHxVuStyztHCKB5\/gzRCVIrJpSjLw0XvuWeu3mz47LMLJo3vi+ODhZOGqFqWzlvSpsWuGSyIVWsVtl4b9gTdu0VzjUn+XpHkrdrZr7y517NvT8Deb1MtYVKasM=","gmt_create":"2016-09-23 19:08:09","app_id":"20151128001234567","seller_id":"20880114661234567","notify_id":"da3e56af64bcb163f167240dc0f781agge"}',
139+
'{"total_amount":"0.01","buyer_id":"20882025611234567","trade_no":"201609232100100306021234567","refund_fee":"0.00","notify_time":"2016-09-23 19:12:33","subject":"test","sign_type":"RSA","notify_type":"trade_status_sync","out_trade_no":"2016092313071234567","gmt_close":"2016-09-23 19:08:10","trade_status":"TRADE_FINISHED","gmt_payment":"2016-09-23 19:08:10","sign":"Xa2NyOsxOBjW\/q\/RUFZhii2epa4B3ka+2aGsG8knqkiCD8llXrTDm11QtGkSRVw\/hbfcgFPiTkuaKnaaDu\/UfypsVSHToy28PiH5xkBSSd6zHNZCP\/jvjzOa6GPf4tIpfYNVvjaRMRcbn+TRlOFtHOnMMubjsg7K52P+LCugZIA=","gmt_create":"2016-09-23 19:08:09","app_id":"20151128001234567","seller_id":"20880114661234567","notify_id":"da3e56af64bcb163f167240dc0f781agge"}',
140140
json_encode($response->data())
141141
);
142142

@@ -179,7 +179,7 @@ public function testCompletePurchaseNotifyWithInlineKey()
179179
}
180180

181181
$this->assertEquals(
182-
'{"total_amount":"0.01","buyer_id":"20882025611234567","trade_no":"201609232100100306021234567","refund_fee":"0.00","notify_time":"2016-09-23 19:12:33","subject":"test","sign_type":"RSA","notify_type":"trade_status_sync","out_trade_no":"2016092313071234567","gmt_close":"2016-09-23 19:08:10","trade_status":"TRADE_FINISHED","gmt_payment":"2016-09-23 19:08:10","sign":"Pj9CrLMvcQB5w1wN0ngelHCSonoe3j6zjYcZsU8kqsE3ZqLb9pHxVuStyztHCKB5\/gzRCVIrJpSjLw0XvuWeu3mz47LMLJo3vi+ODhZOGqFqWzlvSpsWuGSyIVWsVtl4b9gTdu0VzjUn+XpHkrdrZr7y517NvT8Deb1MtYVKasM=","gmt_create":"2016-09-23 19:08:09","app_id":"20151128001234567","seller_id":"20880114661234567","notify_id":"da3e56af64bcb163f167240dc0f781agge"}',
182+
'{"total_amount":"0.01","buyer_id":"20882025611234567","trade_no":"201609232100100306021234567","refund_fee":"0.00","notify_time":"2016-09-23 19:12:33","subject":"test","sign_type":"RSA","notify_type":"trade_status_sync","out_trade_no":"2016092313071234567","gmt_close":"2016-09-23 19:08:10","trade_status":"TRADE_FINISHED","gmt_payment":"2016-09-23 19:08:10","sign":"Xa2NyOsxOBjW\/q\/RUFZhii2epa4B3ka+2aGsG8knqkiCD8llXrTDm11QtGkSRVw\/hbfcgFPiTkuaKnaaDu\/UfypsVSHToy28PiH5xkBSSd6zHNZCP\/jvjzOa6GPf4tIpfYNVvjaRMRcbn+TRlOFtHOnMMubjsg7K52P+LCugZIA=","gmt_create":"2016-09-23 19:08:09","app_id":"20151128001234567","seller_id":"20880114661234567","notify_id":"da3e56af64bcb163f167240dc0f781agge"}',
183183
json_encode($response->data())
184184
);
185185

tests/AopF2FGatewayTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ public function testCompletePurchase()
227227
$response = $this->gateway->completePurchase(['params' => $data])->send();
228228

229229
$this->assertEquals(
230-
'{"gmt_payment":"2015-06-11 22:33:59","notify_id":"42af7baacd1d3746cf7b56752b91edcj34","seller_email":"[email protected]","notify_type":"trade_status_sync","sign":"cJfsQ18JD4CfM1x9MlXY+dO1Q4L647giOmVQvtDJ+4QgpxFL7mEcU8InkAySWxr\/fRXuy8+FMtowYoN2Pmy7z3WcaX0qC5u8rr5hiidnKq\/m4\/7Tt6v5T4xDnYde6GWRchexsTFpMEFDVYs3Hy\/7ga+1Fgvs4bt0borNcjKNJNQ=","trade_no":"2015061121001004400068549373","out_trade_no":"21repl2ac2eOutTradeNo322","gmt_create":"2015-06-11 22:33:46","seller_id":"2088211521646673","notify_time":"2015-06-11 22:34:03","subject":"FACE_TO_FACE_PAYMENT_PRECREATE\u4e2d\u6587","trade_status":"TRADE_SUCCESS","sign_type":"RSA"}',
230+
'{"gmt_payment":"2015-06-11 22:33:59","notify_id":"42af7baacd1d3746cf7b56752b91edcj34","seller_email":"[email protected]","notify_type":"trade_status_sync","sign":"T4JCUXoO5sK\/7UjupKEfsSQnjDnw\/1aSJnC6s53SYJyqdjFl+1Lt8dWdNuuXl5yX39leQsYzmk2CDwZx6F\/YIQWCo1LHZME3DYMqH\/F5wT5uiSUk2KYsYbLluW9pi7YHtBXRWKB6jtnn73DWWbC2sN3tDky9KySPizL5jQ1Cd0I=","trade_no":"2015061121001004400068549373","out_trade_no":"21repl2ac2eOutTradeNo322","gmt_create":"2015-06-11 22:33:46","seller_id":"2088211521646673","notify_time":"2015-06-11 22:34:03","subject":"FACE_TO_FACE_PAYMENT_PRECREATE\u4e2d\u6587","trade_status":"TRADE_SUCCESS","sign_type":"RSA"}',
231231
json_encode($response->data())
232232
);
233233

@@ -265,7 +265,7 @@ public function testCompleteRefund()
265265
$response = $this->gateway->completeRefund(['params' => $data])->send();
266266

267267
$this->assertEquals(
268-
'{"gmt_payment":"2015-06-11 22:33:59","notify_id":"42af7baacd1d3746cf7b56752b91edcj34","seller_email":"[email protected]","notify_type":"trade_status_sync","sign":"cJfsQ18JD4CfM1x9MlXY+dO1Q4L647giOmVQvtDJ+4QgpxFL7mEcU8InkAySWxr\/fRXuy8+FMtowYoN2Pmy7z3WcaX0qC5u8rr5hiidnKq\/m4\/7Tt6v5T4xDnYde6GWRchexsTFpMEFDVYs3Hy\/7ga+1Fgvs4bt0borNcjKNJNQ=","trade_no":"2015061121001004400068549373","out_trade_no":"21repl2ac2eOutTradeNo322","gmt_create":"2015-06-11 22:33:46","seller_id":"2088211521646673","notify_time":"2015-06-11 22:34:03","subject":"FACE_TO_FACE_PAYMENT_PRECREATE\u4e2d\u6587","trade_status":"TRADE_SUCCESS","sign_type":"RSA"}',
268+
'{"gmt_payment":"2015-06-11 22:33:59","notify_id":"42af7baacd1d3746cf7b56752b91edcj34","seller_email":"[email protected]","notify_type":"trade_status_sync","sign":"T4JCUXoO5sK\/7UjupKEfsSQnjDnw\/1aSJnC6s53SYJyqdjFl+1Lt8dWdNuuXl5yX39leQsYzmk2CDwZx6F\/YIQWCo1LHZME3DYMqH\/F5wT5uiSUk2KYsYbLluW9pi7YHtBXRWKB6jtnn73DWWbC2sN3tDky9KySPizL5jQ1Cd0I=","trade_no":"2015061121001004400068549373","out_trade_no":"21repl2ac2eOutTradeNo322","gmt_create":"2015-06-11 22:33:46","seller_id":"2088211521646673","notify_time":"2015-06-11 22:34:03","subject":"FACE_TO_FACE_PAYMENT_PRECREATE\u4e2d\u6587","trade_status":"TRADE_SUCCESS","sign_type":"RSA"}',
269269
json_encode($response->data())
270270
);
271271

tests/Common/SignerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function testSort()
6161

6262
public function testIgnore()
6363
{
64-
$this->assertSame(['sign'], (new Signer())->getIgnores());
64+
$this->assertSame(['sign', 'sign_type'], (new Signer())->getIgnores());
6565

6666
$params1 = [
6767
'aaa' => '111',

tests/LegacyAppGatewayTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ public function testCreateOrder()
5353
* @var LegacyAppPurchaseResponse $response
5454
*/
5555
$response = $this->gateway->purchase($this->options)->send();
56-
$this->assertEquals('29e66f48d681c68d70164028aeb22b33', md5($response->getOrderString()));
56+
$this->assertEquals('e16fdd8098c197201986cd9c3a8fb276', md5($response->getOrderString()));
5757
}
5858
}

0 commit comments

Comments
 (0)