| @@ -79,24 +79,13 @@ | ||
| 79 | 79 | * @var int Payment source. |
| 80 | 80 | */ |
| 81 | 81 | public $source = 0; |
| 82 | 82 | |
| 83 | - /** | |
| 84 | - * Presentment payment information for customer-facing currency display. | |
| 85 | - * | |
| 86 | - * @var object|null | |
| 87 | - */ | |
| 88 | - public $presentment; | |
| 89 | - | |
| 90 | 83 | #endregion Properties |
| 91 | 84 | |
| 92 | 85 | const CURRENCY_USD = 'usd'; |
| 93 | 86 | const CURRENCY_GBP = 'gbp'; |
| 94 | 87 | const CURRENCY_EUR = 'eur'; |
| 95 | - const CURRENCY_ILS = 'ils'; | |
| 96 | - const CURRENCY_CAD = 'cad'; | |
| 97 | - const CURRENCY_AUD = 'aud'; | |
| 98 | - const CURRENCY_PLN = 'pln'; | |
| 99 | 88 | |
| 100 | 89 | /** |
| 101 | 90 | * @param object|bool $payment |
| 102 | 91 | */ |
| @@ -130,46 +119,8 @@ | ||
| 130 | 119 | return ( 0 != $this->source ); |
| 131 | 120 | } |
| 132 | 121 | |
| 133 | 122 | /** |
| 134 | - * @return bool | |
| 135 | - */ | |
| 136 | - private function has_presentment() | |
| 137 | - { | |
| 138 | - return is_object( $this->presentment ); | |
| 139 | - } | |
| 140 | - | |
| 141 | - /** | |
| 142 | - * @return float | |
| 143 | - */ | |
| 144 | - private function get_display_gross() | |
| 145 | - { | |
| 146 | - return $this->has_presentment() ? | |
| 147 | - (float) $this->presentment->gross : | |
| 148 | - (float) $this->gross; | |
| 149 | - } | |
| 150 | - | |
| 151 | - /** | |
| 152 | - * @return float | |
| 153 | - */ | |
| 154 | - private function get_display_vat() | |
| 155 | - { | |
| 156 | - return $this->has_presentment() ? | |
| 157 | - (float) $this->presentment->vat : | |
| 158 | - (float) $this->vat; | |
| 159 | - } | |
| 160 | - | |
| 161 | - /** | |
| 162 | - * @return string | |
| 163 | - */ | |
| 164 | - private function get_display_currency() | |
| 165 | - { | |
| 166 | - return $this->has_presentment() ? | |
| 167 | - $this->presentment->currency : | |
| 168 | - $this->currency; | |
| 169 | - } | |
| 170 | - | |
| 171 | - /** | |
| 172 | 123 | * Returns the gross in this format: |
| 173 | 124 | * `{symbol}{amount | 2 decimal digits} {currency | uppercase}` |
| 174 | 125 | * |
| 175 | 126 | * Examples: £9.99 GBP, -£9.99 GBP. |
| @@ -180,15 +131,13 @@ | ||
| 180 | 131 | * @return string |
| 181 | 132 | */ |
| 182 | 133 | function formatted_gross() |
| 183 | 134 | { |
| 184 | - $price = $this->get_display_gross() + $this->get_display_vat(); | |
| 185 | - | |
| 186 | 135 | return ( |
| 187 | - ( $price < 0 ? '-' : '' ) . | |
| 136 | + ( $this->gross < 0 ? '-' : '' ) . | |
| 188 | 137 | $this->get_symbol() . |
| 189 | - number_format( abs( $price ), 2, '.', ',' ) . ' ' . | |
| 190 | - strtoupper( $this->get_display_currency() ) | |
| 138 | + number_format( abs( $this->gross ), 2, '.', ',' ) . ' ' . | |
| 139 | + strtoupper( $this->currency ) | |
| 191 | 140 | ); |
| 192 | 141 | } |
| 193 | 142 | |
| 194 | 143 | /** |
| @@ -210,18 +159,10 @@ | ||
| 210 | 159 | self::$CURRENCY_2_SYMBOL = array( |
| 211 | 160 | self::CURRENCY_USD => '$', |
| 212 | 161 | self::CURRENCY_GBP => '£', |
| 213 | 162 | self::CURRENCY_EUR => '€', |
| 214 | - self::CURRENCY_ILS => '₪', | |
| 215 | - self::CURRENCY_CAD => '$', | |
| 216 | - self::CURRENCY_AUD => '$', | |
| 217 | - self::CURRENCY_PLN => 'zł', | |
| 218 | 163 | ); |
| 219 | 164 | } |
| 220 | 165 | |
| 221 | - $currency = $this->get_display_currency(); | |
| 222 | - | |
| 223 | - return isset( self::$CURRENCY_2_SYMBOL[ $currency ] ) | |
| 224 | - ? self::$CURRENCY_2_SYMBOL[ $currency ] | |
| 225 | - : strtoupper( $currency ) . ' '; | |
| 166 | + return self::$CURRENCY_2_SYMBOL[ $this->currency ]; | |
| 226 | 167 | } |
| 227 | - } | |
| 168 | + } | |