wp-pay-gateways /
mollie
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Amount transformer. |
||
| 4 | * |
||
| 5 | * @author Pronamic <[email protected]> |
||
| 6 | * @copyright 2005-2021 Pronamic |
||
| 7 | * @license GPL-3.0-or-later |
||
| 8 | * @package Pronamic\WordPress\Pay\Gateways\Mollie |
||
| 9 | */ |
||
| 10 | |||
| 11 | namespace Pronamic\WordPress\Pay\Gateways\Mollie; |
||
| 12 | |||
| 13 | use Pronamic\WordPress\Money\Money; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Amount transformer |
||
| 17 | * |
||
| 18 | * @author Reüel van der Steege |
||
| 19 | * @version 2.1.0 |
||
| 20 | * @since 2.1.0 |
||
| 21 | */ |
||
| 22 | class AmountTransformer { |
||
| 23 | /** |
||
| 24 | * Transform Pronamic money to Mollie amount. |
||
| 25 | * |
||
| 26 | * @param Money $money Pronamic money to convert. |
||
| 27 | * @return Amount |
||
| 28 | * @throws \InvalidArgumentException Throws exception on invalid alphabetic currency code in given money object. |
||
| 29 | */ |
||
| 30 | 2 | public static function transform( Money $money ) { |
|
| 31 | 2 | $amount = new Amount( |
|
| 32 | $money->get_currency()->get_alphabetic_code(), |
||
| 33 | 2 | /** |
|
| 34 | * Make sure to send the right amount of decimals and omit the |
||
| 35 | * thousands separator. Non-string values are not accepted. |
||
| 36 | * |
||
| 37 | 2 | * @link https://docs.mollie.com/reference/v2/payments-api/create-payment |
|
| 38 | 2 | */ |
|
| 39 | 2 | $money->number_format( null, '.', '' ) |
|
|
0 ignored issues
–
show
|
|||
| 40 | ); |
||
| 41 | |||
| 42 | 2 | return $amount; |
|
| 43 | } |
||
| 44 | } |
||
| 45 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.