| @@ 244-263 (lines=20) @@ | ||
| 241 | * @param object $order |
|
| 242 | * @return mixed |
|
| 243 | */ |
|
| 244 | public function create_source( $order ) { |
|
| 245 | $currency = WC_Stripe_Helper::is_pre_30() ? $order->get_order_currency() : $order->get_currency(); |
|
| 246 | $order_id = WC_Stripe_Helper::is_pre_30() ? $order->id : $order->get_id(); |
|
| 247 | $return_url = $this->get_stripe_return_url( $order ); |
|
| 248 | $post_data = array(); |
|
| 249 | $post_data['amount'] = WC_Stripe_Helper::get_stripe_amount( $order->get_total(), $currency ); |
|
| 250 | $post_data['currency'] = strtolower( $currency ); |
|
| 251 | $post_data['type'] = 'bancontact'; |
|
| 252 | $post_data['owner'] = $this->get_owner_details( $order ); |
|
| 253 | $post_data['redirect'] = array( 'return_url' => $return_url ); |
|
| 254 | $post_data['bancontact'] = array( 'preferred_language' => substr( get_locale(), 0, 2 ) ); |
|
| 255 | ||
| 256 | if ( ! empty( $this->statement_descriptor ) ) { |
|
| 257 | $post_data['statement_descriptor'] = WC_Stripe_Helper::clean_statement_descriptor( $this->statement_descriptor ); |
|
| 258 | } |
|
| 259 | ||
| 260 | WC_Stripe_Logger::log( 'Info: Begin creating Bancontact source' ); |
|
| 261 | ||
| 262 | return WC_Stripe_API::request( apply_filters( 'wc_stripe_bancontact_source', $post_data, $order ), 'sources' ); |
|
| 263 | } |
|
| 264 | ||
| 265 | /** |
|
| 266 | * Process the payment |
|
| @@ 244-266 (lines=23) @@ | ||
| 241 | * @param object $order |
|
| 242 | * @return mixed |
|
| 243 | */ |
|
| 244 | public function create_source( $order ) { |
|
| 245 | $currency = WC_Stripe_Helper::is_pre_30() ? $order->get_order_currency() : $order->get_currency(); |
|
| 246 | $bank_country = WC_Stripe_Helper::is_pre_30() ? $order->billing_country : $order->get_billing_country(); |
|
| 247 | $return_url = $this->get_stripe_return_url( $order ); |
|
| 248 | $post_data = array(); |
|
| 249 | $post_data['amount'] = WC_Stripe_Helper::get_stripe_amount( $order->get_total(), $currency ); |
|
| 250 | $post_data['currency'] = strtolower( $currency ); |
|
| 251 | $post_data['type'] = 'sofort'; |
|
| 252 | $post_data['owner'] = $this->get_owner_details( $order ); |
|
| 253 | $post_data['redirect'] = array( 'return_url' => $return_url ); |
|
| 254 | $post_data['sofort'] = array( |
|
| 255 | 'country' => $bank_country, |
|
| 256 | 'preferred_language' => substr( get_locale(), 0, 2 ), |
|
| 257 | ); |
|
| 258 | ||
| 259 | if ( ! empty( $this->statement_descriptor ) ) { |
|
| 260 | $post_data['statement_descriptor'] = WC_Stripe_Helper::clean_statement_descriptor( $this->statement_descriptor ); |
|
| 261 | } |
|
| 262 | ||
| 263 | WC_Stripe_Logger::log( 'Info: Begin creating SOFORT source' ); |
|
| 264 | ||
| 265 | return WC_Stripe_API::request( apply_filters( 'wc_stripe_sofort_source', $post_data, $order ), 'sources' ); |
|
| 266 | } |
|
| 267 | ||
| 268 | /** |
|
| 269 | * Process the payment |
|