Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96616780
PhortuneProviderController.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
Sat, Dec 28, 23:46
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Dec 30, 23:46 (2 d)
Engine
blob
Format
Raw Data
Handle
23216280
Attached To
rPH Phabricator
PhortuneProviderController.php
View Options
<?php
final
class
PhortuneProviderController
extends
PhortuneController
{
private
$digest
;
private
$action
;
public
function
willProcessRequest
(
array
$data
)
{
$this
->
digest
=
$data
[
'digest'
];
$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
();
$user
=
$request
->
getUser
();
// NOTE: This use of digests to identify payment providers is because
// payment provider keys don't necessarily have restrictions on what they
// contain (so they might have stuff that's not safe to put in URIs), and
// using digests prevents errors with URI encoding.
$provider
=
PhortunePaymentProvider
::
getProviderByDigest
(
$this
->
digest
);
if
(!
$provider
)
{
throw
new
Exception
(
"Invalid payment provider digest!"
);
}
if
(!
$provider
->
canRespondToControllerAction
(
$this
->
getAction
()))
{
return
new
Aphront404Response
();
}
$response
=
$provider
->
processControllerRequest
(
$this
,
$request
);
if
(
$response
instanceof
AphrontResponse
)
{
return
$response
;
}
$title
=
'Phortune'
;
return
$this
->
buildApplicationPage
(
$response
,
array
(
'title'
=>
$title
,
'device'
=>
true
,
'dust'
=>
true
,
));
}
public
function
loadCart
(
$id
)
{
return
id
(
new
PhortuneCart
());
}
}
Event Timeline
Log In to Comment