Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92971940
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
Mon, Nov 25, 06:37
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Nov 27, 06:37 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
22548393
Attached To
rPH Phabricator
PhortunePaymentMethodDisableController.php
View Options
<?php
final
class
PhortunePaymentMethodDisableController
extends
PhortuneController
{
public
function
handleRequest
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
();
$method_id
=
$request
->
getURIData
(
'id'
);
$method
=
id
(
new
PhortunePaymentMethodQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$method_id
))
->
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_id
=
$account
->
getID
();
$account_uri
=
$this
->
getApplicationURI
(
"/account/billing/{$account_id}/"
);
if
(
$request
->
isFormPost
())
{
// TODO: ApplicationTransactions!!!!
$method
->
setStatus
(
PhortunePaymentMethod
::
STATUS_DISABLED
)
->
save
();
return
id
(
new
AphrontRedirectResponse
())->
setURI
(
$account_uri
);
}
return
$this
->
newDialog
()
->
setTitle
(
pht
(
'Remove Payment Method'
))
->
appendParagraph
(
pht
(
'Remove the payment method "%s" from your account?'
,
phutil_tag
(
'strong'
,
array
(),
$method
->
getFullDisplayName
())))
->
appendParagraph
(
pht
(
'You will no longer be able to make payments using this payment '
.
'method.'
))
->
addCancelButton
(
$account_uri
)
->
addSubmitButton
(
pht
(
'Remove Payment Method'
));
}
}
Event Timeline
Log In to Comment