Code Duplication    Length = 8-8 lines in 2 locations

woocommerce-gateway-stripe.php 1 location

@@ 476-483 (lines=8) @@
473
						// Store other data such as fees
474
						update_post_meta( $order_id, 'Stripe Payment ID', $result->id );
475
476
						if ( isset( $result->balance_transaction ) && isset( $result->balance_transaction->fee ) ) {
477
							// Fees and Net needs to both come from Stripe to be accurate as the returned
478
							// values are in the local currency of the Stripe account, not from WC.
479
							$fee = ! empty( $result->balance_transaction->fee ) ? self::format_number( $result->balance_transaction, 'fee' ) : 0;
480
							$net = ! empty( $result->balance_transaction->net ) ? self::format_number( $result->balance_transaction, 'net' ) : 0;
481
							update_post_meta( $order_id, 'Stripe Fee', $fee );
482
							update_post_meta( $order_id, 'Net Revenue From Stripe', $net );
483
						}
484
					}
485
				}
486
			}

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

@@ 858-865 (lines=8) @@
855
		update_post_meta( $order_id, '_stripe_charge_captured', $response->captured ? 'yes' : 'no' );
856
857
		// Store other data such as fees
858
		if ( isset( $response->balance_transaction ) && isset( $response->balance_transaction->fee ) ) {
859
			// Fees and Net needs to both come from Stripe to be accurate as the returned
860
			// values are in the local currency of the Stripe account, not from WC.
861
			$fee = ! empty( $response->balance_transaction->fee ) ? WC_Stripe::format_number( $response->balance_transaction, 'fee' ) : 0;
862
			$net = ! empty( $response->balance_transaction->net ) ? WC_Stripe::format_number( $response->balance_transaction, 'net' ) : 0;
863
			update_post_meta( $order_id, 'Stripe Fee', $fee );
864
			update_post_meta( $order_id, 'Net Revenue From Stripe', $net );
865
		}
866
867
		if ( $response->captured ) {
868
			$order->payment_complete( $response->id );