| @@ 107-135 (lines=29) @@ | ||
| 104 | * Get Stripe amount to pay |
|
| 105 | * @return float |
|
| 106 | */ |
|
| 107 | public function get_stripe_amount( $total, $currency = '' ) { |
|
| 108 | if ( ! $currency ) { |
|
| 109 | $currency = get_woocommerce_currency(); |
|
| 110 | } |
|
| 111 | switch ( strtoupper( $currency ) ) { |
|
| 112 | // Zero decimal currencies |
|
| 113 | case 'BIF' : |
|
| 114 | case 'CLP' : |
|
| 115 | case 'DJF' : |
|
| 116 | case 'GNF' : |
|
| 117 | case 'JPY' : |
|
| 118 | case 'KMF' : |
|
| 119 | case 'KRW' : |
|
| 120 | case 'MGA' : |
|
| 121 | case 'PYG' : |
|
| 122 | case 'RWF' : |
|
| 123 | case 'VND' : |
|
| 124 | case 'VUV' : |
|
| 125 | case 'XAF' : |
|
| 126 | case 'XOF' : |
|
| 127 | case 'XPF' : |
|
| 128 | $total = absint( $total ); |
|
| 129 | break; |
|
| 130 | default : |
|
| 131 | $total = round( $total, 2 ) * 100; // In cents |
|
| 132 | break; |
|
| 133 | } |
|
| 134 | return $total; |
|
| 135 | } |
|
| 136 | ||
| 137 | /** |
|
| 138 | * Check if SSL is enabled and notify the user |
|
| @@ 226-254 (lines=29) @@ | ||
| 223 | * |
|
| 224 | * @return float|int |
|
| 225 | */ |
|
| 226 | public function get_stripe_amount( $total, $currency = '' ) { |
|
| 227 | if ( ! $currency ) { |
|
| 228 | $currency = get_woocommerce_currency(); |
|
| 229 | } |
|
| 230 | switch ( strtoupper( $currency ) ) { |
|
| 231 | // Zero decimal currencies. |
|
| 232 | case 'BIF' : |
|
| 233 | case 'CLP' : |
|
| 234 | case 'DJF' : |
|
| 235 | case 'GNF' : |
|
| 236 | case 'JPY' : |
|
| 237 | case 'KMF' : |
|
| 238 | case 'KRW' : |
|
| 239 | case 'MGA' : |
|
| 240 | case 'PYG' : |
|
| 241 | case 'RWF' : |
|
| 242 | case 'VND' : |
|
| 243 | case 'VUV' : |
|
| 244 | case 'XAF' : |
|
| 245 | case 'XOF' : |
|
| 246 | case 'XPF' : |
|
| 247 | $total = absint( $total ); |
|
| 248 | break; |
|
| 249 | default : |
|
| 250 | $total = round( $total, 2 ) * 100; // In cents. |
|
| 251 | break; |
|
| 252 | } |
|
| 253 | return $total; |
|
| 254 | } |
|
| 255 | ||
| 256 | /** |
|
| 257 | * Initializes Apple Pay process on settings page. |
|