activities_helper.php
1 year ago
agent_helper.php
1 year ago
auth_helper.php
9 months ago
blocks_helper.php
1 year ago
booking_helper.php
1 year ago
bricks_helper.php
1 year ago
bundles_helper.php
1 year ago
calendar_helper.php
9 months ago
carts_helper.php
1 year ago
connector_helper.php
1 year ago
csv_helper.php
9 months ago
customer_helper.php
9 months ago
customer_import_helper.php
9 months ago
database_helper.php
9 months ago
debug_helper.php
1 year ago
defaults_helper.php
1 year ago
elementor_helper.php
1 year ago
email_helper.php
9 months ago
encrypt_helper.php
1 year ago
events_helper.php
1 year ago
form_helper.php
9 months ago
icalendar_helper.php
1 year ago
image_helper.php
1 year ago
invoices_helper.php
9 months ago
license_helper.php
1 year ago
location_helper.php
1 year ago
marketing_systems_helper.php
1 year ago
meeting_systems_helper.php
1 year ago
menu_helper.php
9 months ago
meta_helper.php
1 year ago
migrations_helper.php
1 year ago
money_helper.php
1 year ago
notifications_helper.php
9 months ago
order_intent_helper.php
9 months ago
orders_helper.php
1 year ago
otp_helper.php
9 months ago
pages_helper.php
1 year ago
params_helper.php
1 year ago
payments_helper.php
1 year ago
price_breakdown_helper.php
1 year ago
process_jobs_helper.php
1 year ago
processes_helper.php
1 year ago
replacer_helper.php
1 year ago
resource_helper.php
1 year ago
roles_helper.php
9 months ago
router_helper.php
1 year ago
service_helper.php
1 year ago
sessions_helper.php
1 year ago
settings_helper.php
9 months ago
short_links_systems_helper.php
9 months ago
shortcodes_helper.php
9 months ago
sms_helper.php
1 year ago
steps_helper.php
9 months ago
stripe_connect_helper.php
9 months ago
styles_helper.php
9 months ago
support_topics_helper.php
1 year ago
time_helper.php
9 months ago
timeline_helper.php
9 months ago
transaction_helper.php
1 year ago
transaction_intent_helper.php
1 year ago
util_helper.php
9 months ago
version_specific_updates_helper.php
9 months ago
whatsapp_helper.php
1 year ago
work_periods_helper.php
1 year ago
wp_datetime.php
1 year ago
wp_user_helper.php
1 year ago
transaction_helper.php
39 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()) return; |
| 16 | |
| 17 | echo '<div class="transaction-refund-settings">'; |
| 18 | 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>'; |
| 19 | echo '<div class="refund-settings-fields">'; |
| 20 | $full_amount_label = sprintf( __( 'Full [%s]' ), OsMoneyHelper::format_price( ( $transaction->amount - $transaction->get_total_refunded_amount() ), true, false ) ); |
| 21 | echo OsFormHelper::select_field( 'transaction_refund[portion]', false, [ |
| 22 | 'full' => $full_amount_label, |
| 23 | 'custom' => __( 'Custom', 'latepoint' ) |
| 24 | ], 'full', [ 'class' => 'size-small refund-portion-selector', 'theme' => 'simple' ] ); |
| 25 | echo '<div class="custom-charge-amount-wrapper" style="display: none;">'; |
| 26 | echo OsFormHelper::money_field( 'transaction_refund[custom_amount]', false, ( $transaction->amount - $transaction->get_total_refunded_amount() ), [ |
| 27 | 'class' => 'size-small', |
| 28 | 'theme' => 'simple' |
| 29 | ] ); |
| 30 | echo OsFormHelper::hidden_field( 'transaction_refund[transaction_id]', $transaction->id ); |
| 31 | echo '</div>'; |
| 32 | 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>'; |
| 33 | echo '</div>'; |
| 34 | echo '</div>'; |
| 35 | echo '<div class="transaction-refund-button-w">'; |
| 36 | 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>'; |
| 37 | echo '</div>'; |
| 38 | } |
| 39 | } |