本文整理汇总了PHP中Member::getCurrentTransferBundle方法的典型用法代码示例。如果您正苦于以下问题:PHP Member::getCurrentTransferBundle方法的具体用法?PHP Member::getCurrentTransferBundle怎么用?PHP Member::getCurrentTransferBundle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Member
的用法示例。
在下文中一共展示了Member::getCurrentTransferBundle方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: payAdvertisingFor
/**
* Distribute provisions for member signup.
*
* ATTENTION: This method does NOT save changes to $advertisedMember. The
* caller is required to save this object!
*
* @param Member $advertisedMember
* @param PropelPDO $con
*/
public function payAdvertisingFor(\Member $referrer, \Tbmt\MemberFee $memberFee, \Member $advertisedMember, $currency, $when, \PropelPDO $con)
{
$advertisedMemberId = $advertisedMember->getId();
$transfer = $referrer->getCurrentTransferBundle($currency, $con);
if ($referrer->getFundsLevel() === \Member::FUNDS_LEVEL1) {
// @see resources/snowball.txt - processes - P1
$transaction = $transfer->createTransactionForReason($referrer, \Transaction::REASON_ADVERTISED_LVL1, $advertisedMemberId, $when, $con);
$memberFee->subtract($transaction->getAmount(), \Transaction::REASON_ADVERTISED_LVL1);
$parent = $referrer->getMemberRelatedByParentId($con);
if ($parent) {
$parentTransfer = $parent->getCurrentTransferBundle($currency, $con);
$parentTransaction = $parentTransfer->createTransactionForReason($parent, \Transaction::REASON_ADVERTISED_INDIRECT, $advertisedMemberId, $when, $con);
$memberFee->subtract($parentTransaction->getAmount(), \Transaction::REASON_ADVERTISED_INDIRECT);
$parentTransfer->save($con);
$parent->save($con);
}
} else {
// if ( $this->getFundsLevel() >= Member::FUNDS_LEVEL2 ) {
// @see resources/snowball.txt - processes - P3
$transaction = $transfer->createTransactionForReason($referrer, \Transaction::REASON_ADVERTISED_LVL2, $advertisedMemberId, $when, $con);
$memberFee->subtract($transaction->getAmount(), \Transaction::REASON_ADVERTISED_LVL2);
}
$transfer->save($con);
\MemberBonusIds::payBonuses($memberFee, $advertisedMember, $currency, $when, $con);
}
示例2: payAdvertisingFor
/**
* Distribute provisions for member signup.
*
* ATTENTION: This method does NOT save changes to $advertisedMember. The
* caller is required to save this object!
*
* @param Member $advertisedMember
* @param PropelPDO $con
*/
public function payAdvertisingFor(\Member $referrer, \Tbmt\MemberFee $memberFee, \Member $advertisedMember, $currency, $when, $freeFromInvitation, \PropelPDO $con)
{
$advertisedMemberId = $advertisedMember->getId();
$transfer = $referrer->getCurrentTransferBundle($currency, $con);
$transaction = $transfer->createTransactionForReason($referrer, \Transaction::REASON_ADVERTISED_LVL1, $advertisedMemberId, $when, $con);
$memberFee->subtract($transaction->getAmount(), \Transaction::REASON_ADVERTISED_LVL1);
$transfer->save($con);
\MemberBonusIds::payBonuses($memberFee, $advertisedMember, $currency, $when, $con);
}
示例3: activity_createBonusTransaction
public static function activity_createBonusTransaction(Member $login, Member $recipient, array $data, PropelPDO $con)
{
$currentTransfer = $recipient->getCurrentTransferBundle(self::$BASE_CURRENCY, $con);
$when = time();
$amount = $data['amount'];
$recipient->addOutstandingTotal($amount, self::$BASE_CURRENCY);
$transaction = $currentTransfer->addAmount($amount)->setReason(Transaction::REASON_CUSTOM_BONUS)->setPurpose($data['purpose'])->setRelatedId($login->getId())->setDate($when)->save($con);
$currentTransfer->save($con);
$recipient->save($con);
}
示例4: createBonusTransaction
public static function createBonusTransaction(Member $login, Member $recipient, array $data, PropelPDO $con)
{
$currentTransfer = $recipient->getCurrentTransferBundle(self::$BASE_CURRENCY, $con);
$when = time();
if (!$con->beginTransaction()) {
throw new Exception('Could not begin transaction');
}
try {
$amount = $data['amount'];
$recipient->addOutstandingTotal($amount, self::$BASE_CURRENCY);
$transaction = $currentTransfer->addAmount($amount)->setReason(Transaction::REASON_CUSTOM_BONUS)->setPurpose($data['purpose'])->setRelatedId($login->getId())->setDate($when)->save($con);
$currentTransfer->save($con);
$recipient->save($con);
if (!$con->commit()) {
throw new Exception('Could not commit transaction');
}
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
}
示例5: getCurrentTransferBundle
public static function getCurrentTransferBundle(Member $member)
{
return $member->getCurrentTransferBundle(self::$currency, self::$con);
}
示例6: doPay
private static function doPay(\Tbmt\MemberFee $memberFee, $transfer, Member $member, $reason, $relatedId, $currency, $when, PropelPDO $con)
{
if ($transfer === null) {
$transfer = $member->getCurrentTransferBundle($currency, $con);
}
$transaction = $transfer->createTransactionForReason($member, $reason, $relatedId, $when, $con);
$memberFee->subtract($transaction->getAmount(), $reason);
return $transfer;
}