Toggle navigation
Toggle navigation
This project
Loading...
Sign in
OnePoem
/
OnePoem-Server
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
李帅
2022-12-21 22:01:03 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2997a99f542413d124fcf0a88158516dacc9af3f
2997a99f
1 parent
75b7e0ee
1.打印苹果日志
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletions
app/Payment/ApplePayment.php
app/Payment/ApplePayment.php
View file @
2997a99
...
...
@@ -33,6 +33,8 @@ class ApplePayment implements PaymentInterface
const
SANDBOX_URL
=
'https://sandbox.itunes.apple.com/verifyReceipt'
;
const
PASSWORD
=
'cbd66447ac8b463daf6d5498fec5f580'
;
public
function
__construct
()
{
...
...
@@ -55,8 +57,20 @@ class ApplePayment implements PaymentInterface
$client
=
new
Client
([
'headers'
=>
[
'Content-Type'
=>
'application/json'
]]);
try
{
$response
=
$client
->
post
(
self
::
IS_SANDBOX
?
self
::
SANDBOX_URL
:
self
::
VERIFY_URL
,
[
'json'
=>
[
'receipt-data'
=>
$token
,]])
->
getBody
()
->
getContents
();
[
'json'
=>
[
'receipt-data'
=>
$token
,
'password'
=>
self
::
PASSWORD
]])
->
getBody
()
->
getContents
();
$resp
=
json_decode
(
$response
,
true
);
Log
::
debug
(
$response
);
if
(
$resp
[
'status'
]
<=
21003
)
{
$newToken
=
str_replace
(
'+'
,
' '
,
$token
);
try
{
$response
=
$client
->
post
(
self
::
IS_SANDBOX
?
self
::
SANDBOX_URL
:
self
::
VERIFY_URL
,
[
'json'
=>
[
'receipt-data'
=>
$newToken
,
'password'
=>
self
::
PASSWORD
]])
->
getBody
()
->
getContents
();
Log
::
debug
(
'======== 替换+ ========'
);
Log
::
debug
(
$response
);
}
catch
(
GuzzleException
$exception
){
Log
::
error
(
$exception
->
getMessage
()
.
'Line:'
.
$exception
->
getLine
());
}
}
}
catch
(
GuzzleException
$exception
){
Log
::
error
(
$exception
->
getMessage
()
.
'Line:'
.
$exception
->
getLine
());
}
...
...
Please
register
or
login
to post a comment