Skip to content

Commit

Permalink
#24 add check for zero divisor
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubpolomsky committed Nov 6, 2017
1 parent f5c4e4d commit f6d7fe5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/code/community/Wirecard/CheckoutPage/Model/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,11 @@ public function initPayment() {
$bitem->setUnitGrossAmount( number_format( $order->getShippingInclTax(), $precision, '.', '' ) );
$bitem->setUnitNetAmount( number_format( $order->getShippingAmount(), $precision, '.', '' ) );
$bitem->setUnitTaxAmount( number_format( $order->getShippingTaxAmount(), $precision, '.', '' ) );
$bitem->setUnitTaxRate( ( ( $bitem->getUnitGrossAmount() / $bitem->getUnitNetAmount() ) - 1 ) * 100 );
if ( $bitem->getUnitNetAmount() > 0 ) {
$bitem->setUnitTaxRate( ( ( $bitem->getUnitGrossAmount() / $bitem->getUnitNetAmount() ) - 1 ) * 100 );
} else {
$bitem->setUnitTaxRate( 0 );
}
$bitem->setDescription( $order->getShippingDescription() );
$bitem->setName( 'shipping' );
$basket->addItem( $bitem );
Expand Down

0 comments on commit f6d7fe5

Please sign in to comment.