PluginProbe
Booktics – Appointment Booking Calendar for Service Businesses / 1.0.29
Booktics – Appointment Booking Calendar for Service Businesses v1.0.29
1.0.29 1.0.28 1.0.27 1.0.26 1.0.25 1.0.24 1.0.23 1.0.22 1.0.21 1.0.20 1.0.19 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.2 1.0.3 All 31 releases
← All changes | core/order/controllers/order-controller.php +5 -3 1.0.26 → 1.0.29 View file →
@@ -532,9 +532,11 @@
532 532 *
533 533 * @return array [Order_Model $order_model, array $appointments]
534 534 */
535 535 private function create_order_and_appointments( $input_data, $db ) {
536 - $input_data['currency'] = ! empty( $input_data['currency'] ) ? strtolower( $input_data['currency'] ) : strtolower( booktics_get_option( 'currency', 'USD' ) );
536 + // The total is priced server side in the store currency, so the order is
537 + // too. A buyer-sent currency would relabel 100 USD as 100 KRW at Stripe.
538 + $input_data['currency'] = booktics_get_store_currency();
537 539 $order_model = new Order_Model( $db );
538 540
539 541 $input_timezone_string = $input_data['timezone'] ?? 'UTC';
540 542 $input_timezone = Time_Zone_Handler::get_timezone_from_string( $input_timezone_string );
@@ -675,10 +677,10 @@
675 677 ( new Payment_Model( $db ) )->create(
676 678 array(
677 679 'order_id' => $order_model->id,
678 680 'customer_id' => $input_data['customer_id'],
679 - 'amount' => $input_data['total'] * 100,
680 - 'currency' => $input_data['currency'] ?? booktics_get_option( 'currency', 'USD' ),
681 + 'amount' => booktics_amount_to_minor_units( $order_model->total, $order_model->currency ),
682 + 'currency' => $order_model->currency,
681 683 'intent_id' => $payment_intent['payment_intent'] ?? null,
682 684 'transaction_id' => null,
683 685 'payment_method' => $input_data['payment_method'],
684 686 'status' => $payment_intent['status'] == 'success' ? 'completed' : 'pending',