Code Duplication    Length = 8-8 lines in 2 locations

woocommerce-gateway-stripe.php 1 location

@@ 325-332 (lines=8) @@
322
					// Store other data such as fees
323
					update_post_meta( $order->id, 'Stripe Payment ID', $result->id );
324
325
					if ( isset( $result->balance_transaction ) && isset( $result->balance_transaction->fee ) ) {
326
						// Fees and Net needs to both come from Stripe to be accurate as the returned
327
						// values are in the local currency of the Stripe account, not from WC.
328
						$fee = ! empty( $result->balance_transaction->fee ) ? number_format( $result->balance_transaction->fee / 100, 2, '.', '' ) : 0;
329
						$net = ! empty( $result->balance_transaction->net ) ? number_format( $result->balance_transaction->net / 100, 2, '.', '' ) : 0;
330
						update_post_meta( $order->id, 'Stripe Fee', $fee );
331
						update_post_meta( $order->id, 'Net Revenue From Stripe', $net );
332
					}
333
				}
334
			}
335
		}

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

@@ 647-654 (lines=8) @@
644
		update_post_meta( $order->id, '_stripe_charge_captured', $response->captured ? 'yes' : 'no' );
645
646
		// Store other data such as fees
647
		if ( isset( $response->balance_transaction ) && isset( $response->balance_transaction->fee ) ) {
648
			// Fees and Net needs to both come from Stripe to be accurate as the returned
649
			// values are in the local currency of the Stripe account, not from WC.
650
			$fee = ! empty( $response->balance_transaction->fee ) ? number_format( $response->balance_transaction->fee / 100, 2, '.', '' ) : 0;
651
			$net = ! empty( $response->balance_transaction->net ) ? number_format( $response->balance_transaction->net / 100, 2, '.', '' ) : 0;
652
			update_post_meta( $order->id, 'Stripe Fee', $fee );
653
			update_post_meta( $order->id, 'Net Revenue From Stripe', $net );
654
		}
655
656
		if ( $response->captured ) {
657
			$order->payment_complete( $response->id );