Code Duplication    Length = 29-29 lines in 2 locations

includes/legacy/class-wc-gateway-stripe.php 1 location

@@ 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

includes/class-wc-gateway-stripe.php 1 location

@@ 215-243 (lines=29) @@
212
	 *
213
	 * @return float|int
214
	 */
215
	public function get_stripe_amount( $total, $currency = '' ) {
216
		if ( ! $currency ) {
217
			$currency = get_woocommerce_currency();
218
		}
219
		switch ( strtoupper( $currency ) ) {
220
			// Zero decimal currencies.
221
			case 'BIF' :
222
			case 'CLP' :
223
			case 'DJF' :
224
			case 'GNF' :
225
			case 'JPY' :
226
			case 'KMF' :
227
			case 'KRW' :
228
			case 'MGA' :
229
			case 'PYG' :
230
			case 'RWF' :
231
			case 'VND' :
232
			case 'VUV' :
233
			case 'XAF' :
234
			case 'XOF' :
235
			case 'XPF' :
236
				$total = absint( $total );
237
				break;
238
			default :
239
				$total = round( $total, 2 ) * 100; // In cents.
240
				break;
241
		}
242
		return $total;
243
	}
244
245
	/**
246
	 * Check if SSL is enabled and notify the user