Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2896265
FundInitiativeRefundTransaction.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
2 KB
Referenced Files
None
Subscribers
None
FundInitiativeRefundTransaction.php
View Options
<?php
final
class
FundInitiativeRefundTransaction
extends
FundInitiativeTransactionType
{
const
TRANSACTIONTYPE
=
'fund:refund'
;
public
function
generateOldValue
(
$object
)
{
return
null
;
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$amount
=
$this
->
getMetadataValue
(
FundInitiativeTransaction
::
PROPERTY_AMOUNT
)
;
$amount
=
PhortuneCurrency
::
newFromString
(
$amount
)
;
$total
=
$object
->
getTotalAsCurrency
(
)
->
subtract
(
$amount
)
;
$object
->
setTotalAsCurrency
(
$total
)
;
}
public
function
applyExternalEffects
(
$object
,
$value
)
{
$backer
=
id
(
new
FundBackerQuery
(
)
)
->
setViewer
(
$this
->
getActor
(
)
)
->
withPHIDs
(
array
(
$value
)
)
->
executeOne
(
)
;
if
(
!
$backer
)
{
throw
new
Exception
(
pht
(
'Unable to load %s!'
,
'FundBacker'
)
)
;
}
$subx
=
array
(
)
;
$amount
=
$this
->
getMetadataValue
(
FundInitiativeTransaction
::
PROPERTY_AMOUNT
)
;
$subx
[
]
=
id
(
new
FundBackerTransaction
(
)
)
->
setTransactionType
(
FundBackerStatusTransaction
::
TRANSACTIONTYPE
)
->
setNewValue
(
$amount
)
;
$content_source
=
$this
->
getEditor
(
)
->
getContentSource
(
)
;
$editor
=
id
(
new
FundBackerEditor
(
)
)
->
setActor
(
$this
->
getActor
(
)
)
->
setContentSource
(
$content_source
)
->
setContinueOnMissingFields
(
true
)
->
setContinueOnNoEffect
(
true
)
;
$editor
->
applyTransactions
(
$backer
,
$subx
)
;
}
public
function
getTitle
(
)
{
$amount
=
$this
->
getMetadataValue
(
FundInitiativeTransaction
::
PROPERTY_AMOUNT
)
;
$amount
=
PhortuneCurrency
::
newFromString
(
$amount
)
;
$backer_phid
=
$this
->
getMetadataValue
(
FundInitiativeTransaction
::
PROPERTY_BACKER
)
;
return
pht
(
'%s refunded %s to %s.'
,
$this
->
renderAuthor
(
)
,
$amount
->
formatForDisplay
(
)
,
$this
->
renderHandle
(
$backer_phid
)
)
;
}
public
function
getTitleForFeed
(
)
{
$amount
=
$this
->
getMetadataValue
(
FundInitiativeTransaction
::
PROPERTY_AMOUNT
)
;
$amount
=
PhortuneCurrency
::
newFromString
(
$amount
)
;
$backer_phid
=
$this
->
getMetadataValue
(
FundInitiativeTransaction
::
PROPERTY_BACKER
)
;
return
pht
(
'%s refunded %s to %s for %s.'
,
$this
->
renderAuthor
(
)
,
$amount
->
formatForDisplay
(
)
,
$this
->
renderHandle
(
$backer_phid
)
,
$this
->
renderObject
(
)
)
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Jan 19 2025, 22:50 (6 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1129563
Default Alt Text
FundInitiativeRefundTransaction.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment