Example #1
0
function check_fiat_transfer_limit($uid, $amount)
{
    $withdrawn = fiat_transferred_today($uid);
    $limit = numstr_to_internal(MAXIMUM_DAILY_FIAT_TRANSFER);
    $available = gmp_sub($limit, $withdrawn);
    if (gmp_cmp($amount, $available) > 0) {
        throw new Problem(_('Daily limit exceeded'), sprintf(_('You can only transfer %s per day.'), internal_to_numstr($limit) . ' ' . CURRENCY));
    }
}
Example #2
0
        echo "<p>" . sprintf(_("Your voucher for %s is:"), "{$amount_disp} {$curr_type}") . "</p><p class='voucher'>{$voucher_code}</p>\n";
    } else {
        echo "<p>" . sprintf(_("Your request to withdraw %s has been submitted. Visit your %sprofile%s to check on the status of your request."), "{$amount_disp} {$curr_type}", "<a href='?page=profile'>", "</a>") . "</p>\n";
    }
    echo "</div>\n";
} else {
    ?>
    <div class='content_box'>
    <h3><?php 
    printf(_("Withdraw %s"), CURRENCY);
    ?>
</h3>
<?php 
    $balances = fetch_balances($is_logged_in);
    $fiat = $balances[CURRENCY];
    $transferred = fiat_transferred_today($is_logged_in);
    $limit = numstr_to_internal(MAXIMUM_DAILY_FIAT_TRANSFER);
    $available = gmp_sub($limit, $transferred);
    if (gmp_cmp($fiat, $available) > 0) {
        echo "    <p>" . sprintf(_("You can transfer up to %s each day"), internal_to_numstr($limit) . " " . CURRENCY) . " (", day_time_range_string(), ")</p>\n";
        if ($transferred) {
            echo "    <p>" . sprintf(_("You have transferred %s today"), internal_to_numstr($transferred) . " " . CURRENCY) . "\n";
            if (gmp_cmp($available, '0') > 0) {
                echo "    " . sprintf(_("and so can transfer up to %s more."), internal_to_numstr($available) . " " . CURRENCY);
            } else {
                echo "    " . _("and so cannot transfer any more until tomorrow.");
            }
            echo "</p>\n";
        }
    }
    if (gmp_cmp($fiat, '0') <= 0) {