Code Duplication    Length = 8-8 lines in 2 locations

woocommerce-gateway-stripe.php 1 location

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

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

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