function it_calculates_fee_for_given_payment_with_given_configuration(PaymentSubjectInterface $payment) { $payment->getAmount()->willReturn(1000); $this->calculate($payment, array('percent' => 20))->shouldReturn(200); }
/** * {@inheritdoc} */ public function calculate(PaymentSubjectInterface $payment, array $configuration) { return (int) round($configuration['percent'] / 100 * $payment->getAmount()); }