| @@ -532,11 +532,9 @@ | ||
| 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 | - // 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(); | |
| 536 | + $input_data['currency'] = ! empty( $input_data['currency'] ) ? strtolower( $input_data['currency'] ) : strtolower( booktics_get_option( 'currency', 'USD' ) ); | |
| 539 | 537 | $order_model = new Order_Model( $db ); |
| 540 | 538 | |
| 541 | 539 | $input_timezone_string = $input_data['timezone'] ?? 'UTC'; |
| 542 | 540 | $input_timezone = Time_Zone_Handler::get_timezone_from_string( $input_timezone_string ); |
| @@ -677,10 +675,10 @@ | ||
| 677 | 675 | ( new Payment_Model( $db ) )->create( |
| 678 | 676 | array( |
| 679 | 677 | 'order_id' => $order_model->id, |
| 680 | 678 | 'customer_id' => $input_data['customer_id'], |
| 681 | - 'amount' => booktics_amount_to_minor_units( $order_model->total, $order_model->currency ), | |
| 682 | - 'currency' => $order_model->currency, | |
| 679 | + 'amount' => $input_data['total'] * 100, | |
| 680 | + 'currency' => $input_data['currency'] ?? booktics_get_option( 'currency', 'USD' ), | |
| 683 | 681 | 'intent_id' => $payment_intent['payment_intent'] ?? null, |
| 684 | 682 | 'transaction_id' => null, |
| 685 | 683 | 'payment_method' => $input_data['payment_method'], |
| 686 | 684 | 'status' => $payment_intent['status'] == 'success' ? 'completed' : 'pending', |