You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
736 B
PHP
21 lines
736 B
PHP
<?php
|
|
|
|
require dirname(__DIR__) . '/vendor/autoload.php';
|
|
|
|
use App\Services\Payment\PaymentFxAmount;
|
|
|
|
if (PaymentFxAmount::quotedUnits('USD/CNY', 7200, '7.20') !== 51840
|
|
|| PaymentFxAmount::quotedUnits('USDT/USD', 7200, '0.9980') !== 72144289
|
|
|| PaymentFxAmount::quotedUnits('USD/CNY', 100, '6.555') !== 656
|
|
|| PaymentFxAmount::extraUsdCents('USD/CNY', 720, '7.20') !== 100) {
|
|
throw new RuntimeException('FX quotes did not match the approved monetary examples.');
|
|
}
|
|
|
|
try {
|
|
PaymentFxAmount::quotedUnits('USDT/USD', 999999999, '0.000000000001');
|
|
throw new LogicException('A token quote outside the integer range was accepted.');
|
|
} catch (InvalidArgumentException) {
|
|
}
|
|
|
|
echo "Payment FX amount examples passed.\n";
|