Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97573646
PhortuneCartAcceptController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Jan 5, 09:40
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Jan 7, 09:40 (2 d)
Engine
blob
Format
Raw Data
Handle
23429544
Attached To
rPH Phabricator
PhortuneCartAcceptController.php
View Options
<?php
final
class
PhortuneCartAcceptController
extends
PhortuneCartController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$id
=
$request
->
getURIData
(
'id'
);
// You must control the merchant to accept orders.
$authority
=
$this
->
loadMerchantAuthority
();
if
(!
$authority
)
{
return
new
Aphront404Response
();
}
$cart
=
id
(
new
PhortuneCartQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$id
))
->
withMerchantPHIDs
(
array
(
$authority
->
getPHID
()))
->
needPurchases
(
true
)
->
executeOne
();
if
(!
$cart
)
{
return
new
Aphront404Response
();
}
$cancel_uri
=
$cart
->
getDetailURI
(
$authority
);
if
(
$cart
->
getStatus
()
!==
PhortuneCart
::
STATUS_REVIEW
)
{
return
$this
->
newDialog
()
->
setTitle
(
pht
(
'Order Not in Review'
))
->
appendParagraph
(
pht
(
'This order does not need manual review, so you can not '
.
'accept it.'
))
->
addCancelButton
(
$cancel_uri
);
}
if
(
$request
->
isFormPost
())
{
$cart
->
didReviewCart
();
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$cancel_uri
);
}
return
$this
->
newDialog
()
->
setTitle
(
pht
(
'Accept Order?'
))
->
appendParagraph
(
pht
(
'This order has been flagged for manual review. You should review '
.
'it carefully before accepting it.'
))
->
addCancelButton
(
$cancel_uri
)
->
addSubmitButton
(
pht
(
'Accept Order'
));
}
}
Event Timeline
Log In to Comment