@@ 256-263 (lines=8) @@ | ||
253 | // Store other data such as fees |
|
254 | WC_Stripe_Helper::is_pre_30() ? update_post_meta( $order_id, '_transaction_id', $result->id ) : $order->set_transaction_id( $result->id ); |
|
255 | ||
256 | if ( isset( $result->balance_transaction ) && isset( $result->balance_transaction->fee ) ) { |
|
257 | // Fees and Net needs to both come from Stripe to be accurate as the returned |
|
258 | // values are in the local currency of the Stripe account, not from WC. |
|
259 | $fee = ! empty( $result->balance_transaction->fee ) ? WC_Stripe_Helper::format_balance_fee( $result->balance_transaction, 'fee' ) : 0; |
|
260 | $net = ! empty( $result->balance_transaction->net ) ? WC_Stripe_Helper::format_balance_fee( $result->balance_transaction, 'net' ) : 0; |
|
261 | 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 ); |
|
262 | 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 ); |
|
263 | } |
|
264 | ||
265 | if ( is_callable( array( $order, 'save' ) ) ) { |
|
266 | $order->save(); |
@@ 267-274 (lines=8) @@ | ||
264 | WC_Stripe_Helper::is_pre_30() ? update_post_meta( $order_id, '_stripe_charge_captured', $captured ) : $order->update_meta_data( '_stripe_charge_captured', $captured ); |
|
265 | ||
266 | // Store other data such as fees |
|
267 | if ( isset( $response->balance_transaction ) && isset( $response->balance_transaction->fee ) ) { |
|
268 | // Fees and Net needs to both come from Stripe to be accurate as the returned |
|
269 | // values are in the local currency of the Stripe account, not from WC. |
|
270 | $fee = ! empty( $response->balance_transaction->fee ) ? WC_Stripe_Helper::format_balance_fee( $response->balance_transaction, 'fee' ) : 0; |
|
271 | $net = ! empty( $response->balance_transaction->net ) ? WC_Stripe_Helper::format_balance_fee( $response->balance_transaction, 'net' ) : 0; |
|
272 | 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 ); |
|
273 | 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 ); |
|
274 | } |
|
275 | ||
276 | if ( 'yes' === $captured ) { |
|
277 | /** |