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

@@ 199-227 (lines=29) @@
196
	 *
197
	 * @return float|int
198
	 */
199
	public function get_stripe_amount( $total, $currency = '' ) {
200
		if ( ! $currency ) {
201
			$currency = get_woocommerce_currency();
202
		}
203
		switch ( strtoupper( $currency ) ) {
204
			// Zero decimal currencies.
205
			case 'BIF' :
206
			case 'CLP' :
207
			case 'DJF' :
208
			case 'GNF' :
209
			case 'JPY' :
210
			case 'KMF' :
211
			case 'KRW' :
212
			case 'MGA' :
213
			case 'PYG' :
214
			case 'RWF' :
215
			case 'VND' :
216
			case 'VUV' :
217
			case 'XAF' :
218
			case 'XOF' :
219
			case 'XPF' :
220
				$total = absint( $total );
221
				break;
222
			default :
223
				$total = round( $total, 2 ) * 100; // In cents.
224
				break;
225
		}
226
		return $total;
227
	}
228
229
	/**
230
	 * Check if SSL is enabled and notify the user