Index: trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect.adapter.php |
— | — | @@ -1720,46 +1720,26 @@ |
1721 | 1721 | ); |
1722 | 1722 | return $languages; |
1723 | 1723 | } |
1724 | | - |
| 1724 | + |
1725 | 1725 | /** |
1726 | | - * Floor the amount |
| 1726 | + * Stage: amount |
1727 | 1727 | * |
1728 | | - * Some amounts for GlobalCollect cannot have cents. We will not round up. |
1729 | | - * |
1730 | 1728 | * For example: JPY 1000.05 get changed to 100005. This need to be 100000. |
1731 | 1729 | * For example: JPY 1000.95 get changed to 100095. This need to be 100000. |
1732 | 1730 | * |
1733 | | - * |
1734 | | - * @param string $value |
1735 | | - */ |
1736 | | - protected function floorAmount( $value ) { |
1737 | | - |
1738 | | - $value = substr( $value, 0, -2 ) . '00'; |
1739 | | - |
1740 | | - return $value; |
1741 | | - } |
1742 | | - |
1743 | | - /** |
1744 | | - * Stage: amount |
1745 | | - * |
1746 | 1731 | * @param string $type request|response |
1747 | 1732 | */ |
1748 | 1733 | protected function stage_amount( $type = 'request' ) { |
1749 | 1734 | switch ( $type ) { |
1750 | 1735 | case 'request': |
1751 | 1736 | |
1752 | | - $floor = false; |
1753 | | - |
1754 | | - if ( $this->staged_data['currency_code'] == 'JPY' ) { |
1755 | | - $floor = true; |
| 1737 | + // JPY cannot have cents. |
| 1738 | + $floorCurrencies = array ( 'JPY' ); |
| 1739 | + if ( in_array( $this->staged_data['currency_code'], $floorCurrencies ) ) { |
| 1740 | + $this->staged_data['amount'] = floor( $this->staged_data['amount'] ) * 100; |
1756 | 1741 | } |
1757 | 1742 | |
1758 | 1743 | $this->staged_data['amount'] = $this->staged_data['amount'] * 100; |
1759 | | - |
1760 | | - // Floor if required |
1761 | | - if ( $floor ) { |
1762 | | - $this->staged_data['amount'] = $this->floorAmount( $this->staged_data['amount'] ); |
1763 | | - } |
1764 | 1744 | |
1765 | 1745 | break; |
1766 | 1746 | case 'response': |