Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F431321
PhortuneProviderActionController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PhortuneProviderActionController.php
View Options
<?php
final
class
PhortuneProviderActionController
extends
PhortuneController
{
private
$id
;
private
$action
;
public
function
willProcessRequest
(
array
$data
)
{
$this
->
id
=
$data
[
'id'
];
$this
->
setAction
(
$data
[
'action'
]);
}
public
function
setAction
(
$action
)
{
$this
->
action
=
$action
;
return
$this
;
}
public
function
getAction
()
{
return
$this
->
action
;
}
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$viewer
=
$request
->
getUser
();
$provider_config
=
id
(
new
PhortunePaymentProviderConfigQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$this
->
id
))
->
executeOne
();
if
(!
$provider_config
)
{
return
new
Aphront404Response
();
}
$provider
=
$provider_config
->
buildProvider
();
if
(!
$provider
->
canRespondToControllerAction
(
$this
->
getAction
()))
{
return
new
Aphront404Response
();
}
$response
=
$provider
->
processControllerRequest
(
$this
,
$request
);
if
(
$response
instanceof
AphrontResponse
)
{
return
$response
;
}
return
$this
->
buildApplicationPage
(
$response
,
array
(
'title'
=>
pht
(
'Phortune'
),
));
}
public
function
loadCart
(
$id
)
{
$request
=
$this
->
getRequest
();
$viewer
=
$request
->
getUser
();
return
id
(
new
PhortuneCartQuery
())
->
setViewer
(
$viewer
)
->
needPurchases
(
true
)
->
withIDs
(
array
(
$id
))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
executeOne
();
}
public
function
loadActiveCharge
(
PhortuneCart
$cart
)
{
$request
=
$this
->
getRequest
();
$viewer
=
$request
->
getUser
();
return
id
(
new
PhortuneChargeQuery
())
->
setViewer
(
$viewer
)
->
withCartPHIDs
(
array
(
$cart
->
getPHID
()))
->
withStatuses
(
array
(
PhortuneCharge
::
STATUS_CHARGING
,
))
->
executeOne
();
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 3, 12:16 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
60739
Default Alt Text
PhortuneProviderActionController.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment