Code Duplication    Length = 8-8 lines in 2 locations

includes/abstracts/abstract-wc-stripe-payment-gateway.php 1 location

@@ 217-224 (lines=8) @@
214
		WC_Stripe_Helper::is_pre_30() ? update_post_meta( $order_id, '_stripe_charge_captured', $response->captured ? 'yes' : 'no' ) : $order->update_meta_data( '_stripe_charge_captured', $response->captured ? 'yes' : 'no' );
215
216
		// Store other data such as fees
217
		if ( isset( $response->balance_transaction ) && isset( $response->balance_transaction->fee ) ) {
218
			// Fees and Net needs to both come from Stripe to be accurate as the returned
219
			// values are in the local currency of the Stripe account, not from WC.
220
			$fee = ! empty( $response->balance_transaction->fee ) ? WC_Stripe_Helper::format_balance_fee( $response->balance_transaction, 'fee' ) : 0;
221
			$net = ! empty( $response->balance_transaction->net ) ? WC_Stripe_Helper::format_balance_fee( $response->balance_transaction, 'net' ) : 0;
222
			WC_Stripe_Helper::is_pre_30() ? update_post_meta( $order_id, self::META_NAME_FEE, $fee ) : $order->update_meta_data( self::META_NAME_FEE, $fee );
223
			WC_Stripe_Helper::is_pre_30() ? update_post_meta( $order_id, self::META_NAME_NET, $net ) : $order->update_meta_data( self::META_NAME_NET, $net );
224
		}
225
226
		if ( $response->captured ) {
227
			/**

includes/class-wc-stripe-order-handler.php 1 location

@@ 223-230 (lines=8) @@
220
					// Store other data such as fees
221
					WC_Stripe_Helper::is_pre_30() ? update_post_meta( $order_id, '_transaction_id', $result->id ) : $order->set_transaction_id( $result->id );
222
223
					if ( isset( $result->balance_transaction ) && isset( $result->balance_transaction->fee ) ) {
224
						// Fees and Net needs to both come from Stripe to be accurate as the returned
225
						// values are in the local currency of the Stripe account, not from WC.
226
						$fee = ! empty( $result->balance_transaction->fee ) ? WC_Stripe_Helper::format_balance_fee( $result->balance_transaction, 'fee' ) : 0;
227
						$net = ! empty( $result->balance_transaction->net ) ? WC_Stripe_Helper::format_balance_fee( $result->balance_transaction, 'net' ) : 0;
228
						WC_Stripe_Helper::is_pre_30() ? update_post_meta( $order_id, parent::META_NAME_FEE, $fee ) : $order->update_meta_data( parent::META_NAME_FEE, $fee );
229
						WC_Stripe_Helper::is_pre_30() ? update_post_meta( $order_id, parent::META_NAME_NET, $net ) : $order->update_meta_data( parent::META_NAME_NET, $net );
230
					}
231
232
					if ( is_callable( array( $order, 'save' ) ) ) {
233
						$order->save();