| @@ 55-73 (lines=19) @@ | ||
| 52 | * @param object $order |
|
| 53 | * @return string $amount |
|
| 54 | */ |
|
| 55 | public static function get_stripe_fee( $order = null ) { |
|
| 56 | if ( is_null( $order ) ) { |
|
| 57 | return false; |
|
| 58 | } |
|
| 59 | ||
| 60 | $amount = $order->get_meta( self::META_NAME_FEE, true ); |
|
| 61 | ||
| 62 | // If not found let's check for legacy name. |
|
| 63 | if ( empty( $amount ) ) { |
|
| 64 | $amount = $order->get_meta( self::LEGACY_META_NAME_FEE, true ); |
|
| 65 | ||
| 66 | // If found update to new name. |
|
| 67 | if ( $amount ) { |
|
| 68 | self::update_stripe_fee( $order, $amount ); |
|
| 69 | } |
|
| 70 | } |
|
| 71 | ||
| 72 | return $amount; |
|
| 73 | } |
|
| 74 | ||
| 75 | /** |
|
| 76 | * Updates the Stripe fee for order. |
|
| @@ 114-132 (lines=19) @@ | ||
| 111 | * @param object $order |
|
| 112 | * @return string $amount |
|
| 113 | */ |
|
| 114 | public static function get_stripe_net( $order = null ) { |
|
| 115 | if ( is_null( $order ) ) { |
|
| 116 | return false; |
|
| 117 | } |
|
| 118 | ||
| 119 | $amount = $order->get_meta( self::META_NAME_NET, true ); |
|
| 120 | ||
| 121 | // If not found let's check for legacy name. |
|
| 122 | if ( empty( $amount ) ) { |
|
| 123 | $amount = $order->get_meta( self::LEGACY_META_NAME_NET, true ); |
|
| 124 | ||
| 125 | // If found update to new name. |
|
| 126 | if ( $amount ) { |
|
| 127 | self::update_stripe_net( $order, $amount ); |
|
| 128 | } |
|
| 129 | } |
|
| 130 | ||
| 131 | return $amount; |
|
| 132 | } |
|
| 133 | ||
| 134 | /** |
|
| 135 | * Updates the Stripe net for order. |
|