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

@@ 183-211 (lines=29) @@
180
	 *
181
	 * @return float|int
182
	 */
183
	public function get_stripe_amount( $total, $currency = '' ) {
184
		if ( ! $currency ) {
185
			$currency = get_woocommerce_currency();
186
		}
187
		switch ( strtoupper( $currency ) ) {
188
			// Zero decimal currencies.
189
			case 'BIF' :
190
			case 'CLP' :
191
			case 'DJF' :
192
			case 'GNF' :
193
			case 'JPY' :
194
			case 'KMF' :
195
			case 'KRW' :
196
			case 'MGA' :
197
			case 'PYG' :
198
			case 'RWF' :
199
			case 'VND' :
200
			case 'VUV' :
201
			case 'XAF' :
202
			case 'XOF' :
203
			case 'XPF' :
204
				$total = absint( $total );
205
				break;
206
			default :
207
				$total = round( $total, 2 ) * 100; // In cents.
208
				break;
209
		}
210
		return $total;
211
	}
212
213
	/**
214
	 * Check if SSL is enabled and notify the user