Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F106011883
PhortunePaymentMethodDisableController.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
Fri, Mar 21, 12:35
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Mar 23, 12:35 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
25074955
Attached To
rPH Phabricator
PhortunePaymentMethodDisableController.php
View Options
<?php
final
class
PhortunePaymentMethodDisableController
extends
PhortuneController
{
private
$methodID
;
public
function
willProcessRequest
(
array
$data
)
{
$this
->
methodID
=
$data
[
'id'
];
}
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
$viewer
=
$request
->
getUser
();
$method
=
id
(
new
PhortunePaymentMethodQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$this
->
methodID
))
->
requireCapabilities
(
array
(
PhabricatorPolicyCapability
::
CAN_VIEW
,
PhabricatorPolicyCapability
::
CAN_EDIT
,
))
->
executeOne
();
if
(!
$method
)
{
return
new
Aphront404Response
();
}
if
(
$method
->
getStatus
()
==
PhortunePaymentMethod
::
STATUS_DISABLED
)
{
return
new
Aphront400Response
();
}
$account
=
$method
->
getAccount
();
$account_uri
=
$this
->
getApplicationURI
(
$account
->
getID
().
'/'
);
if
(
$request
->
isFormPost
())
{
// TODO: ApplicationTransactions!
$method
->
setStatus
(
PhortunePaymentMethod
::
STATUS_DISABLED
)
->
save
();
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$account_uri
);
}
return
$this
->
newDialog
()
->
setTitle
(
pht
(
'Disable Payment Method?'
))
->
setShortTitle
(
pht
(
'Disable Payment Method'
))
->
appendParagraph
(
pht
(
'Disable the payment method "%s"?'
,
phutil_tag
(
'strong'
,
array
(),
$method
->
getFullDisplayName
())))
->
appendParagraph
(
pht
(
'You will no longer be able to make payments using this payment '
.
'method. Disabled payment methods can not be reactivated.'
))
->
addCancelButton
(
$account_uri
)
->
addSubmitButton
(
pht
(
'Disable Payment Method'
));
}
}
Event Timeline
Log In to Comment