/** * @param PlanDefinition $definition * @param Money $amountToPay * @param PlanParameters $parameters * @internal param string $planCode * @return \Ice\PaymentPlan\PaymentPlan */ public function getPlan(PlanDefinition $definition, Money $amountToPay, PlanParameters $parameters) { if ($parameters->hasParameter('bursary_total_deduction') && ($bursaryTotalDeduction = intval($parameters->get('bursary_total_deduction'))) > 0) { $absoluteBursaryTotal = Money::GBP($bursaryTotalDeduction); $amountBeforeBursary = $amountToPay->add($absoluteBursaryTotal); $planWithoutBursary = $this->childCalculator->getPlan($definition, $amountBeforeBursary, $parameters); return $this->subtractBursaryFromPlan($planWithoutBursary, $absoluteBursaryTotal); } return $this->childCalculator->getPlan($definition, $amountToPay, $parameters); }
/** * @expectedException Money\InvalidArgumentException */ public function testDifferentCurrenciesCannotBeAdded() { $m1 = new Money(100, new Currency('EUR')); $m2 = new Money(100, new Currency('USD')); $m1->add($m2); }
public function addToAmount(Money $money) { return new static($this->amount->add($money), $this->dueDate); }
/** * @expectedException InvalidArgumentException */ public function testDifferentCurrenciesCannotBeAdded() { $m1 = new Money(100, CurrencyProxy::determine('EUR')); $m2 = new Money(100, CurrencyProxy::determine('USD')); $m1->add($m2); }
/** * @param Money $amount * * @throws \InvalidArgumentException * * @return Money */ public function add(Money $amount) : Money { return new self($this->money->add($amount->wrapped())); }
/** * Increase this account current balance * * @param Money $amount */ public function deposit(Money $amount) { $this->balance = $this->balance->add($amount); }