Пример #1
0
 public function createTransactionForReason(Member $transferOwner, $reason, $advertisedMemberId, $when, PropelPDO $con)
 {
     $amount = Transaction::getAmountForReason($reason);
     $transferOwner->addOutstandingTotal($amount, $this->getCurrency());
     $transaction = $this->addAmount($amount);
     $transaction->setReason($reason);
     $transaction->setRelatedId($advertisedMemberId);
     $transaction->setDate($when);
     $transaction->save($con);
     return $transaction;
 }
Пример #2
0
 public function createTransactionForReason(Member $transferOwner, $reason, $advertisedMemberId, $when, PropelPDO $con)
 {
     if ($reason === Transaction::REASON_CUSTOM_BONUS_LEVEL) {
         $amount = $transferOwner->getBonusLevel();
     } else {
         $amount = Transaction::getAmountForReason($reason);
     }
     $transferOwner->addOutstandingTotal($amount, $this->getCurrency());
     $transaction = $this->addAmount($amount);
     $transaction->setReason($reason);
     $transaction->setRelatedId($advertisedMemberId);
     $transaction->setDate($when);
     $transaction->save($con);
     return $transaction;
 }
Пример #3
0
 public function add($reason, $quantity = 1)
 {
     $this->total += Transaction::getAmountForReason($reason) * $quantity;
     return $this;
 }
Пример #4
0
 public static function getLocalizedTRA($transactinoReason)
 {
     return Localizer::numFormat(\Transaction::getAmountForReason($transactinoReason), 0);
 }
Пример #5
0
 public function testVariant12()
 {
     /**
      * OL - Neues Mitglied
      * 22$
      * ------------------------------------------*/
     /* Setup
        ---------------------------------------------*/
     DbEntityHelper::setCon(self::$propelCon);
     list(list($IT, $VL, $OL, $PM, $VS2, $VS1), list($trfIT, $trfVL, $trfOL, $trfPM, $trfVS2, $trfVS1), ) = DbEntityHelper::setUpBonusMembers(true, ['VL' => false]);
     $new = DbEntityHelper::createSignupMember($OL);
     $trfIT += Transaction::getAmountForReason(Transaction::REASON_IT_BONUS);
     // $trfVL += Transaction::getAmountForReason(Transaction::REASON_VL_BONUS);
     $trfOL += Transaction::getAmountForReason(Transaction::REASON_OL_BONUS) + Transaction::getAmountForReason(Transaction::REASON_PM_BONUS) + Transaction::getAmountForReason(Transaction::REASON_ADVERTISED_LVL2);
     // $trfPM += Transaction::getAmountForReason(Transaction::REASON_PM_BONUS);
     // $trfVS2 += Transaction::getAmountForReason(Transaction::REASON_ADVERTISED_INDIRECT);
     // $trfVS1 += Transaction::getAmountForReason(Transaction::REASON_ADVERTISED_LVL1);
     $this->assertTransferTotal($trfIT, $IT);
     // $this->assertTransferTotal($trfVL, $VL);
     $this->assertTransferTotal($trfOL, $OL);
     $this->assertTransferTotal($trfPM, $PM);
     $this->assertTransferTotal($trfVS2, $VS2);
     $this->assertTransferTotal($trfVS1, $VS1);
 }