| @@ 96-99 (lines=4) @@ | ||
| 93 | * @param object $order |
|
| 94 | */ |
|
| 95 | public function validate_minimum_order_amount( $order ) { |
|
| 96 | if ( $order->get_total() * 100 < WC_Stripe_Helper::get_minimum_amount() ) { |
|
| 97 | /* translators: 1) dollar amount */ |
|
| 98 | throw new WC_Stripe_Exception( 'Did not meet minimum amount', sprintf( __( 'Sorry, the minimum allowed order total is %1$s to use this payment method.', 'woocommerce-gateway-stripe' ), wc_price( WC_Stripe_Helper::get_minimum_amount() / 100 ) ) ); |
|
| 99 | } |
|
| 100 | } |
|
| 101 | ||
| 102 | /** |
|
| @@ 141-144 (lines=4) @@ | ||
| 138 | * @param bool initial_payment |
|
| 139 | */ |
|
| 140 | public function process_subscription_payment( $order = '', $amount = 0 ) { |
|
| 141 | if ( $amount * 100 < WC_Stripe_Helper::get_minimum_amount() ) { |
|
| 142 | /* translators: minimum amount */ |
|
| 143 | return new WP_Error( 'stripe_error', sprintf( __( 'Sorry, the minimum allowed order total is %1$s to use this payment method.', 'woocommerce-gateway-stripe' ), wc_price( WC_Stripe_Helper::get_minimum_amount() / 100 ) ) ); |
|
| 144 | } |
|
| 145 | ||
| 146 | $customer_id = WC_Stripe_Helper::is_pre_30() ? $order->customer_user : $order->get_customer_id(); |
|
| 147 | $order_id = WC_Stripe_Helper::is_pre_30() ? $order->id : $order->get_id(); |
|
| @@ 186-189 (lines=4) @@ | ||
| 183 | * @param bool initial_payment |
|
| 184 | */ |
|
| 185 | public function retry_subscription_payment( $order = '', $amount = 0 ) { |
|
| 186 | if ( $amount * 100 < WC_Stripe_Helper::get_minimum_amount() ) { |
|
| 187 | /* translators: minimum amount */ |
|
| 188 | return new WP_Error( 'stripe_error', sprintf( __( 'Sorry, the minimum allowed order total is %1$s to use this payment method.', 'woocommerce-gateway-stripe' ), wc_price( WC_Stripe_Helper::get_minimum_amount() / 100 ) ) ); |
|
| 189 | } |
|
| 190 | ||
| 191 | $customer_id = WC_Stripe_Helper::is_pre_30() ? $order->customer_user : $order->get_customer_id(); |
|
| 192 | $order_id = WC_Stripe_Helper::is_pre_30() ? $order->id : $order->get_id(); |
|
| @@ 484-487 (lines=4) @@ | ||
| 481 | try { |
|
| 482 | $order = wc_get_order( $order_id ); |
|
| 483 | ||
| 484 | if ( $order->get_total() * 100 < WC_Stripe_Helper::get_minimum_amount() ) { |
|
| 485 | /* translators: minimum amount */ |
|
| 486 | throw new Exception( sprintf( __( 'Sorry, the minimum allowed order total is %1$s to use this payment method.', 'woocommerce-gateway-stripe' ), wc_price( WC_Stripe_Helper::get_minimum_amount() / 100 ) ) ); |
|
| 487 | } |
|
| 488 | ||
| 489 | $source = $this->prepare_source( $this->create_source_object(), get_current_user_id(), true ); |
|
| 490 | ||
| @@ 141-144 (lines=4) @@ | ||
| 138 | * @param bool initial_payment |
|
| 139 | */ |
|
| 140 | public function process_subscription_payment( $order = '', $amount = 0 ) { |
|
| 141 | if ( $amount * 100 < WC_Stripe_Helper::get_minimum_amount() ) { |
|
| 142 | /* translators: minimum amount */ |
|
| 143 | return new WP_Error( 'stripe_error', sprintf( __( 'Sorry, the minimum allowed order total is %1$s to use this payment method.', 'woocommerce-gateway-stripe' ), wc_price( WC_Stripe_Helper::get_minimum_amount() / 100 ) ) ); |
|
| 144 | } |
|
| 145 | ||
| 146 | $customer_id = WC_Stripe_Helper::is_pre_30() ? $order->customer_user : $order->get_customer_id(); |
|
| 147 | $order_id = WC_Stripe_Helper::is_pre_30() ? $order->id : $order->get_id(); |
|
| @@ 424-427 (lines=4) @@ | ||
| 421 | try { |
|
| 422 | $order = wc_get_order( $order_id ); |
|
| 423 | ||
| 424 | if ( $order->get_total() * 100 < WC_Stripe_Helper::get_minimum_amount() ) { |
|
| 425 | /* translators: minimum amount */ |
|
| 426 | throw new Exception( sprintf( __( 'Sorry, the minimum allowed order total is %1$s to use this payment method.', 'woocommerce-gateway-stripe' ), wc_price( WC_Stripe_Helper::get_minimum_amount() / 100 ) ) ); |
|
| 427 | } |
|
| 428 | ||
| 429 | $source = $this->prepare_source( $this->create_source_object(), get_current_user_id(), true ); |
|
| 430 | ||