activities_helper.php
3 months ago
agent_helper.php
3 months ago
analytics_helper.php
4 months ago
auth_helper.php
3 months ago
blocks_helper.php
3 months ago
booking_helper.php
3 months ago
bricks_helper.php
3 months ago
bundles_helper.php
3 months ago
calendar_helper.php
3 months ago
carts_helper.php
3 months ago
connector_helper.php
3 months ago
csv_helper.php
3 months ago
customer_helper.php
3 months ago
customer_import_helper.php
3 months ago
database_helper.php
3 months ago
debug_helper.php
3 months ago
defaults_helper.php
3 months ago
elementor_helper.php
3 months ago
email_helper.php
3 months ago
encrypt_helper.php
3 months ago
events_helper.php
3 months ago
form_helper.php
3 months ago
icalendar_helper.php
3 months ago
image_helper.php
3 months ago
invoices_helper.php
3 months ago
license_helper.php
3 months ago
location_helper.php
3 months ago
marketing_systems_helper.php
3 months ago
meeting_systems_helper.php
3 months ago
menu_helper.php
3 months ago
meta_helper.php
3 months ago
migrations_helper.php
3 months ago
money_helper.php
3 months ago
notifications_helper.php
3 months ago
nps_survey_helper.php
3 months ago
order_intent_helper.php
3 months ago
orders_helper.php
3 months ago
otp_helper.php
3 months ago
pages_helper.php
3 months ago
params_helper.php
3 months ago
payments_helper.php
3 months ago
price_breakdown_helper.php
3 months ago
process_jobs_helper.php
3 months ago
processes_helper.php
3 months ago
replacer_helper.php
3 months ago
resource_helper.php
3 months ago
roles_helper.php
3 months ago
router_helper.php
3 months ago
service_helper.php
3 months ago
sessions_helper.php
3 months ago
settings_helper.php
3 months ago
short_links_systems_helper.php
3 months ago
shortcodes_helper.php
3 months ago
sms_helper.php
3 months ago
steps_helper.php
3 months ago
stripe_connect_helper.php
3 months ago
styles_helper.php
3 months ago
support_topics_helper.php
3 months ago
time_helper.php
3 months ago
timeline_helper.php
3 months ago
transaction_helper.php
3 months ago
transaction_intent_helper.php
3 months ago
util_helper.php
3 months ago
version_specific_updates_helper.php
3 months ago
whatsapp_helper.php
3 months ago
work_periods_helper.php
3 months ago
wp_datetime.php
3 months ago
wp_user_helper.php
3 months ago
transaction_helper.php
57 lines
| 1 | <?php |
| 2 | /* |
| 3 | * Copyright (c) 2024 LatePoint LLC. All rights reserved. |
| 4 | */ |
| 5 | |
| 6 | class OsTransactionHelper { |
| 7 | |
| 8 | |
| 9 | /** |
| 10 | * @param OsTransactionModel $transaction |
| 11 | * |
| 12 | * @return void |
| 13 | */ |
| 14 | public static function output_refund_button( OsTransactionModel $transaction ) { |
| 15 | if ( ! $transaction->can_refund() ) { |
| 16 | return; |
| 17 | } |
| 18 | |
| 19 | echo '<div class="transaction-refund-settings">'; |
| 20 | echo '<div class="refund-settings-heading"><div>' . esc_html__( 'Refund Amount', 'latepoint' ) . '</div><div class="refund-settings-close"><i class="latepoint-icon latepoint-icon-x"></i></div></div>'; |
| 21 | echo '<div class="refund-settings-fields">'; |
| 22 | $full_amount_label = sprintf( __( 'Full [%s]' ), OsMoneyHelper::format_price( ( $transaction->amount - $transaction->get_total_refunded_amount() ), true, false ) ); |
| 23 | echo OsFormHelper::select_field( |
| 24 | 'transaction_refund[portion]', |
| 25 | false, |
| 26 | [ |
| 27 | 'full' => $full_amount_label, |
| 28 | 'custom' => __( 'Custom', 'latepoint' ), |
| 29 | ], |
| 30 | 'full', |
| 31 | [ |
| 32 | 'class' => 'size-small refund-portion-selector', |
| 33 | 'theme' => 'simple', |
| 34 | ] |
| 35 | ); |
| 36 | echo '<div class="custom-charge-amount-wrapper" style="display: none;">'; |
| 37 | echo OsFormHelper::money_field( |
| 38 | 'transaction_refund[custom_amount]', |
| 39 | false, |
| 40 | ( $transaction->amount - $transaction->get_total_refunded_amount() ), |
| 41 | [ |
| 42 | 'class' => 'size-small', |
| 43 | 'theme' => 'simple', |
| 44 | ] |
| 45 | ); |
| 46 | echo OsFormHelper::hidden_field( 'transaction_refund[transaction_id]', $transaction->id ); |
| 47 | wp_nonce_field( 'refund_transaction_' . $transaction->id, '_wpnonce', false ); |
| 48 | echo '</div>'; |
| 49 | echo '<a href="#" class="latepoint-btn latepoint-btn-primary latepoint-btn-sm transaction-refund-submit-button" data-os-prompt="' . esc_attr__( 'Are you sure you want to refund this transaction?', 'latepoint' ) . '" data-route="' . esc_attr( OsRouterHelper::build_route_name( 'transactions', 'refund_transaction' ) ) . '">' . esc_html__( 'Submit', 'latepoint' ) . '</a>'; |
| 50 | echo '</div>'; |
| 51 | echo '</div>'; |
| 52 | echo '<div class="transaction-refund-button-w">'; |
| 53 | echo '<a href="#" class="latepoint-btn latepoint-btn-sm latepoint-btn-danger transaction-refund-settings-button" title="' . esc_attr__( 'Refund Transaction', 'latepoint' ) . '" >' . esc_html__( 'Issue a Refund', 'latepoint' ) . '</a>'; |
| 54 | echo '</div>'; |
| 55 | } |
| 56 | } |
| 57 |