: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* @copyright Copyright (c) 2016, Freemius, Inc.
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
if ( ! defined( 'ABSPATH' ) ) {
class FS_Payment extends FS_Entity {
* @author Leo Fajardo (@leorw)
* @var string One of the following: `usd`, `gbp`, `eur`.
public $bound_payment_id;
* @var string ISO 3166-1 alpha-2 - two-letter country code.
* @link http://www.wikiwand.com/en/ISO_3166-1_alpha-2
* @var float Actual Tax / VAT in $$$
* @var int Payment source.
const CURRENCY_USD = 'usd';
const CURRENCY_GBP = 'gbp';
const CURRENCY_EUR = 'eur';
* @param object|bool $payment
function __construct( $payment = false ) {
parent::__construct( $payment );
static function get_type() {
* @author Vova Feldman (@svovaf)
return ( parent::is_valid_id( $this->bound_payment_id ) && 0 > $this->gross );
* Checks if the payment was migrated from another platform.
* @author Vova Feldman (@svovaf)
return ( 0 != $this->source );
* Returns the gross in this format:
* `{symbol}{amount | 2 decimal digits} {currency | uppercase}`
* Examples: £9.99 GBP, -£9.99 GBP.
* @author Leo Fajardo (@leorw)
function formatted_gross()
( $this->gross < 0 ? '-' : '' ) .
number_format( abs( $this->gross ), 2, '.', ',' ) . ' ' .
strtoupper( $this->currency )
* A map between supported currencies with their symbols.
* @var array<string,string>
static $CURRENCY_2_SYMBOL;
* @author Leo Fajardo (@leorw)
private function get_symbol() {
if ( ! isset( self::$CURRENCY_2_SYMBOL ) ) {
self::$CURRENCY_2_SYMBOL = array(
self::CURRENCY_USD => '$',
self::CURRENCY_GBP => '£',
self::CURRENCY_EUR => '€',
return self::$CURRENCY_2_SYMBOL[ $this->currency ];