PluginProbe
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More / 2.3.2
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More v2.3.2
2.4.1 2.4.0 2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.2 2.2.1 2.2.0 2.1.2 2.1.1 trunk 0.0.1 0.0.2 0.0.3 0.0.4 0.0.5 0.0.6 0.0.7 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 All 68 releases
better-payment / includes / Admin / views / better-payment-transaction-view.php

better-payment-transaction-view.php in Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More 2.3.2, at includes/Admin/views/better-payment-transaction-view.php

286 lines 24.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * Transaction details page
4 * All undefined vars comes from 'render_better_payment_admin_pages' method
5 * $bp_admin_all_transactions : contains all values
6 */
7
8 use Better_Payment\Lite\Classes\Helper;
9
10 ?>
11
12 <div class="better-payment">
13
14 <?php if (is_object($bp_admin_transaction)) : ?>
15 <section class="transaction-details-wrapper content">
16
17 <!-- Hidden Fields Start -->
18 <div class="hidden-fields">
19 <input type="hidden" name="transaction_details_id" value="<?php echo esc_attr($bp_admin_transaction->id); ?>">
20 </div>
21 <!-- Hidden Fields End -->
22
23
24 <div class="template__wrapper background__grey">
25 <header class="pb30">
26 <div class="bp-container">
27 <div class="bp-row">
28 <div class="bp-col">
29 <div class="logo">
30 <a href="javascript:void(0)"><img src="<?php echo esc_url(BETTER_PAYMENT_ASSETS . '/img/logo.svg'); ?>" alt="Better Payment logo"></a>
31 </div>
32 </div>
33 </div>
34 </div>
35 </header>
36
37 <div class="bp-container">
38 <div class="bp-row">
39 <div class="bp-col">
40 <div class="page__title mb30">
41 <span><a class="single-transaction-view-back-btn" href="<?php echo esc_url(admin_url("admin.php?page=better-payment-transactions")); ?>"><i class="bp-icon bp-left-arrow-lite single-transaction-view"></i></a> <?php esc_html_e('Back to Transactions', 'better-payment'); ?></span>
42 </div>
43 </div>
44 </div>
45 </div>
46
47 <div class="bp-container">
48 <div class="bp-row">
49 <div class="bp-col-lg-8 bp-col md-mb30">
50 <div class="transaction__info__wrap">
51 <?php
52 $form_fields_info = maybe_unserialize($bp_admin_transaction->form_fields_info);
53
54 $td_first_name = (isset($form_fields_info['primary_first_name']) && $form_fields_info['primary_first_name']) ? $form_fields_info['primary_first_name'] : esc_html__('', 'better-payment');
55 $td_last_name = (isset($form_fields_info['primary_last_name']) && $form_fields_info['primary_last_name']) ? $form_fields_info['primary_last_name'] : esc_html__('', 'better-payment');
56
57 if(empty($td_first_name)){
58 $td_first_name = (isset($form_fields_info['first_name']) && $form_fields_info['first_name']) ? $form_fields_info['first_name'] : esc_html__('', 'better-payment');
59 }
60
61 if(empty($td_last_name)){
62 $td_last_name = (isset($form_fields_info['last_name']) && $form_fields_info['last_name']) ? $form_fields_info['last_name'] : esc_html__('', 'better-payment');
63 }
64
65 $td_email = (isset($form_fields_info['primary_email']) && $form_fields_info['primary_email']) ? $form_fields_info['primary_email'] : esc_html__('', 'better-payment');
66 if(empty($td_email)){
67 $td_email = (isset($form_fields_info['email']) && $form_fields_info['email']) ? $form_fields_info['email'] : esc_html__('', 'better-payment');
68 }
69 $td_amount = floatval( $bp_admin_transaction->amount ) . ' ' . $bp_admin_transaction->currency;
70 $td_amount_numer = floatval( $bp_admin_transaction->amount );
71 $td_amount_quantity = ! empty( $form_fields_info['amount_quantity'] ) ? intval( $form_fields_info['amount_quantity'] ) : 0;
72 $is_woo_layout = ! empty( $form_fields_info['is_woo_layout'] ) ? 1 : 0;
73 $is_fluentcart_layout = ! empty( $form_fields_info['is_fluentcart_layout'] ) ? 1 : 0;
74 $allowed_sources = ['paypal', 'stripe', 'paystack'];
75 $td_source_image_url = BETTER_PAYMENT_ASSETS . '/img/stripe.svg';
76 $td_source_image_alt = 'Stripe';
77
78 $is_coupon_applied = ! empty( $form_fields_info['is_coupon_applied'] ) ? 1 : 0;
79 if ( $is_coupon_applied ) {
80 $paid_amount_diff = ! empty( $form_fields_info['paid_amount_diff'] ) ? floatval( $form_fields_info['paid_amount_diff'] ) : 0;
81 $exact_paid_amount = ! empty( $form_fields_info['exact_paid_amount'] ) ? floatval( $form_fields_info['exact_paid_amount'] ) : 0;
82 $coupon_code = ! empty( $form_fields_info['stripe_coupon_code'] ) ? $form_fields_info['stripe_coupon_code'] : '';
83 }
84
85 if( in_array( strtolower( $bp_admin_transaction->source ), $allowed_sources ) ){
86 $td_source_image_url = strtolower( $bp_admin_transaction->source ) == 'paypal' ? BETTER_PAYMENT_ASSETS . '/img/paypal.png' : BETTER_PAYMENT_ASSETS . "/img/{$bp_admin_transaction->source}.svg";
87 $td_source_image_alt = strtolower( $bp_admin_transaction->source ) == 'paypal' ? 'PayPal' : ucfirst( strtolower( $bp_admin_transaction->source ) );
88 }
89
90 $td_status = $bp_admin_transaction->status ? $bp_admin_transaction->status : esc_html__('N/A', 'better-payment');
91
92 $bp_transaction_status_for_color = $bp_admin_transaction->status ? sanitize_text_field($bp_admin_transaction->status) : '';
93 $bp_helper_obj = new Helper();
94 $td_status_btn_color = $bp_helper_obj->get_color_by_transaction_status($bp_transaction_status_for_color, 'v2');
95 $td_status_btn_text_v2 = $bp_helper_obj->get_type_by_transaction_status($bp_transaction_status_for_color, 'v2');
96
97 //Additional fields:
98 $td_order_id = $bp_admin_transaction->order_id;
99 $td_payment_date = wp_date(get_option('date_format').' '.get_option('time_format'), strtotime($bp_admin_transaction->payment_date));
100 $td_referer = $bp_admin_transaction->referer;
101 $td_obj_id = $bp_admin_transaction->obj_id;
102 $td_campaign_id = '';
103 if( isset($bp_admin_transaction->campaign_id) && $bp_admin_transaction->campaign_id ) {
104 $td_campaign_id = $bp_admin_transaction->campaign_id;
105 $td_campaign_id = substr($td_campaign_id, strrpos($td_campaign_id, '_') + 1);
106 }
107
108 //Show widget name and page url
109 $referer_content_form_name = esc_html__('N/A', 'better-payment');
110 $referer_content_page_title = esc_html__('N/A', 'better-payment');
111 $referer_content_page_link = esc_html__('#', 'better-payment');
112
113 if(!empty($bp_transaction_referer_content)){
114 $referer_content_form_name = !empty($bp_transaction_referer_content['form_name']) ? $bp_transaction_referer_content['form_name'] : $referer_content_form_name;
115 $referer_content_form_name = $td_referer != 'elementor-form' && !empty($bp_transaction_referer_content['better_payment_form_title']) ? $bp_transaction_referer_content['better_payment_form_title'] : $referer_content_form_name;
116
117 $referer_content_page_title = !empty($referer_page_id) ? get_the_title( $referer_page_id ) : $referer_content_page_title;
118 $referer_content_page_link = !empty($referer_page_id) ? get_permalink( $referer_page_id ) : $referer_content_page_link;
119 }
120
121 $td_products = [];
122 $detailed_product_info = maybe_unserialize( $form_fields_info['detailed_product_info'] ?? [] );
123 $td_products = array_merge( $detailed_product_info['woo_products'] ?? [], $detailed_product_info['fluentcart_products'] ?? [] );
124 ?>
125 <div class="transaction__info">
126 <div class="info__header">
127 <h4 class="title"><i class="bp-icon bp-info"></i> <?php esc_html_e('Basic Information', 'better-payment'); ?></h4>
128 </div>
129 <ul class="informations">
130 <?php
131 $bp_transaction_id = sanitize_text_field($bp_admin_transaction->transaction_id);
132 $bp_txn_counter = 1;
133 ?>
134 <li><span><?php esc_html_e('Name:', 'better-payment'); ?></span> <?php echo esc_html($td_first_name) . ' ' . esc_html($td_last_name); ?> </li>
135 <li>
136 <span><?php esc_html_e('Email Address:', 'better-payment'); ?></span>
137 <span id="bp_email_copy_clipboard_input_<?php echo esc_html($bp_txn_counter); ?>"><?php echo esc_html($td_email); ?></span>
138 <span id="bp_email_copy_clipboard_<?php echo esc_attr($bp_txn_counter); ?>" class="bp-icon bp-copy-square bp-email-copy-clipboard" title="<?php esc_html_e('Copy', 'better-payment'); ?>" data-bp_txn_counter="<?php echo esc_attr($bp_txn_counter); ?>" ></span>
139 <span id="bp_email_copy_clipboard_info_<?php echo esc_attr($bp_txn_counter); ?>" class="bp-email-copy-clipboard-info is-hidden" data-bp_txn_counter="<?php echo esc_attr($bp_txn_counter); ?>" >Copied!</span>
140 </li>
141 <?php if( $is_coupon_applied ) : ?>
142 <li><span><?php esc_html_e('Subtotal:', 'better-payment'); ?></span> <?php echo esc_html( $paid_amount_diff + $exact_paid_amount ) . ' ' . esc_html( $bp_admin_transaction->currency ); ?> </li>
143 <li><span><?php esc_html_e('Discount:', 'better-payment'); ?></span> <?php echo esc_html( $paid_amount_diff ) . ' ' . esc_html( $bp_admin_transaction->currency ); ?> </li>
144 <li><span><?php esc_html_e('Coupon Code:', 'better-payment'); ?></span> <?php echo esc_html( $coupon_code ) ?> </li>
145 <?php endif; ?>
146 <?php if ( ! empty( $td_amount_quantity ) && ! $is_woo_layout ) : ?>
147 <li><span><?php esc_html_e('Single Amount:', 'better-payment'); ?></span> <?php echo esc_html( floatval( $td_amount_numer / $td_amount_quantity ) ) . ' ' . esc_html( $bp_admin_transaction->currency ); ?> </li>
148 <li><span><?php esc_html_e('Quantity:', 'better-payment'); ?></span> <?php echo esc_html( $td_amount_quantity ) ?> </li>
149 <li><span><?php esc_html_e('Total Amount:', 'better-payment'); ?></span> <?php echo esc_html( $td_amount ) ?> </li>
150 <?php else : ?>
151 <li><span><?php esc_html_e('Amount:', 'better-payment'); ?></span> <?php echo esc_html( $td_amount ) ?> </li>
152 <?php endif; ?>
153 <li>
154
155 <?php if( !empty($bp_transaction_id) ) : ?>
156 <span><?php esc_html_e('Transaction ID:', 'better-payment'); ?></span>
157
158 <span id="bp_copy_clipboard_input_<?php echo esc_attr($bp_txn_counter); ?>"><?php echo esc_html($bp_transaction_id); ?></span>
159
160 <span id="bp_copy_clipboard_<?php echo esc_attr($bp_txn_counter); ?>" class="bp-icon bp-copy-square bp-copy-clipboard" title="<?php esc_html_e('Copy', 'better-payment'); ?>" data-bp_txn_counter="<?php echo esc_attr($bp_txn_counter); ?>" ></span>
161
162 <span id="bp_copy_clipboard_info_<?php echo esc_attr($bp_txn_counter); ?>" class="bp-copy-clipboard-info is-hidden" data-bp_txn_counter="<?php echo esc_attr($bp_txn_counter); ?>" >Copied!</span>
163
164 <?php endif; ?>
165 </li>
166 <li class="source"><span><?php esc_html_e('Source:', 'better-payment'); ?></span> <img src="<?php echo esc_url($td_source_image_url) ?>" title="<?php echo esc_attr( $td_source_image_alt ); ?>" alt="<?php echo esc_attr( $td_source_image_alt ); ?>"></li>
167 <li>
168 <span><?php esc_html_e('Status:', 'better-payment'); ?></span> <span style="color:#fff; padding:5px 15px; border-radius: 20px;background: <?php echo esc_attr($td_status_btn_color); ?>"> <?php echo esc_html(ucwords($td_status_btn_text_v2)); //$td_status ?> </span>
169
170 <?php if(
171 strtolower($td_status) !== 'completed'
172 && strtolower($td_status) !== 'paid'
173 && strtolower($td_status) !== 'success'
174 && strtolower($td_status) !== 'refunded'
175 && strtolower($td_status) !== 'failed'
176 ){ ?>
177 <a href="#" class="button button--sm view-button bp-mark-as-completed" data-id="<?php echo esc_attr($bp_admin_transaction->id); ?>"><?php esc_html_e('Mark as Completed', 'better-payment'); ?></a>
178 <?php } ?>
179 </li>
180 </ul>
181 </div>
182 <div class="transaction__info">
183 <div class="info__header">
184 <h4 class="title"><i class="bp-icon bp-info"></i> <?php esc_html_e('Additional Information', 'better-payment'); ?></h4>
185 </div>
186 <ul class="informations">
187 <li><span><?php esc_html_e('Order ID:', 'better-payment'); ?></span> <?php echo esc_html($td_order_id) ?></li>
188 <li><span><?php esc_html_e('Payment Date:', 'better-payment'); ?></span> <?php echo esc_html($td_payment_date) ?></li>
189 <li><span><?php esc_html_e('Referer Page:', 'better-payment'); ?></span> <a target="_blank" class="color__themeColor" href="<?php echo esc_url($referer_content_page_link) ?>"><?php echo esc_html($referer_content_page_title); ?></a> </li>
190 <li class="is-hidden"><span><?php esc_html_e('Referer Widget:', 'better-payment'); ?></span> <?php echo esc_html($referer_content_form_name) ?></li>
191 <?php if( !empty($td_campaign_id) ) : ?>
192 <li><span><?php esc_html_e('Campaign ID:', 'better-payment'); ?></span> <?php echo esc_html($td_campaign_id) ?></li>
193 <?php endif; ?>
194 </ul>
195 </div>
196
197 <?php if( ! empty( $is_woo_layout ) || ! empty( $is_fluentcart_layout ) ) : ?>
198 <div class="transaction__info">
199 <div class="info__header">
200 <h4 class="title"><i class="bp-icon bp-info"></i> <?php esc_html_e('Product Information', 'better-payment'); ?></h4>
201 </div>
202 <ul class="informations">
203 <?php if( ! empty( $td_products ) ) : ?>
204 <?php foreach( $td_products as $product_info ) : ?>
205 <li>
206 <a target="_blank" href="<?php echo esc_url( $product_info['permalink'] ); ?>"><?php echo esc_html( $product_info['name'] ); ?></a> - <?php echo esc_html( $product_info['price'] ) . ' ' . esc_html( $bp_admin_transaction->currency ); ?> x <?php echo esc_html( $product_info['quantity'] ); ?> = <?php echo esc_html( $product_info['total_price'] ) . ' ' . esc_html( $bp_admin_transaction->currency ); ?></li>
207 <?php endforeach; ?>
208 <?php endif; ?>
209 </ul>
210 </div>
211 <?php endif; ?>
212
213 <?php do_action('better_payment/admin/transaction_subscription_content', $bp_admin_transaction); ?>
214 </div>
215 </div>
216 <div class="bp-col-lg-4 bp-col">
217 <div class="payment__info">
218 <div class="payment__getway">
219 <h4 class="title"><i class="bp-icon bp-card"></i> <?php esc_html_e('Payment Gateway', 'better-payment'); ?></h4>
220 <div class="pay__by">
221 <?php $paid_via_paypal_selected = strtolower( $bp_admin_transaction->source ) == 'paypal' ? 'paid_via_selected' : ''; ?>
222 <?php $paid_via_stripe_selected = strtolower( $bp_admin_transaction->source ) == 'stripe' ? 'paid_via_selected' : ''; ?>
223 <?php $paid_via_paystack_selected = strtolower( $bp_admin_transaction->source ) == 'paystack' ? 'paid_via_selected' : ''; ?>
224
225 <?php if(strtolower( $bp_admin_transaction->source ) == 'paypal'): ?>
226 <label class="<?php echo esc_attr($paid_via_paypal_selected); ?>">
227 <?php esc_html_e('Payment Method:', 'better-payment'); ?>
228 <input type="radio" name="payment__getway" <?php echo strtolower( $bp_admin_transaction->source ) == 'paypal' ? 'checked' : ''; ?> >
229 <span><img src="<?php echo esc_url(BETTER_PAYMENT_ASSETS . '/img/paypal.png'); ?>" title="<?php echo esc_attr( $td_source_image_alt ); ?>" alt="<?php echo esc_attr( $td_source_image_alt ); ?>"></span>
230 </label>
231
232 <?php elseif( strtolower( $bp_admin_transaction->source ) == 'paystack' ): ?>
233 <label class="<?php echo esc_attr($paid_via_paystack_selected); ?>">
234 <?php esc_html_e('Payment Method:', 'better-payment'); ?>
235 <input type="radio" name="payment__getway" <?php echo strtolower( $bp_admin_transaction->source ) == 'paystack' ? 'checked' : ''; ?> >
236 <span><img src="<?php echo esc_url(BETTER_PAYMENT_ASSETS . '/img/paystack.svg'); ?>" title="<?php echo esc_attr( $td_source_image_alt ); ?>" alt="<?php echo esc_attr( $td_source_image_alt ); ?>"></span>
237 </label>
238
239 <?php else : ?>
240 <label class="<?php echo esc_attr($paid_via_stripe_selected) ?>">
241 <?php esc_html_e('Payment Method:', 'better-payment'); ?>
242 <input type="radio" name="payment__getway" <?php echo strtolower( $bp_admin_transaction->source ) == 'stripe' ? 'checked' : ''; ?>>
243 <span><img src="<?php echo esc_url(BETTER_PAYMENT_ASSETS . '/img/stripe.svg'); ?>" title="<?php echo esc_attr( $td_source_image_alt ); ?>" alt="<?php echo esc_attr( $td_source_image_alt ); ?>"></span>
244 </label>
245 <?php endif; ?>
246 </div>
247 <?php $bp_txn_counter = 2; ?>
248 <p class="single-transaction-id-copy-wrap">
249 <?php esc_html_e('Transaction ID:', 'better-payment'); ?>
250 <span id="bp_copy_clipboard_input_<?php echo esc_attr($bp_txn_counter); ?>" class="bp-text-black"><?php echo esc_html($bp_transaction_id); ?></span>
251 <span id="bp_copy_clipboard_<?php echo esc_attr($bp_txn_counter); ?>" class="bp-icon bp-copy-square bp-copy-clipboard has-text-black-fix" title="<?php esc_html_e('Copy', 'better-payment'); ?>" data-bp_txn_counter="<?php echo esc_attr($bp_txn_counter); ?>" ></span>
252 <span id="bp_copy_clipboard_info_<?php echo esc_attr($bp_txn_counter); ?>" class="bp-copy-clipboard-info is-hidden" data-bp_txn_counter="<?php echo esc_attr($bp_txn_counter); ?>" >Copied!</span>
253 </p>
254 </div>
255 <div class="email__activity">
256 <h4 class="title"><i class="bp-icon bp-wave"></i> <?php esc_html_e('Email Activity', 'better-payment'); ?></h4>
257 <ul class="activity__list">
258 <li>
259 <div class="content">
260 <i class="bp-icon bp-mail"></i>
261 <h5><?php esc_html_e('Email sent to', 'better-payment'); ?> <?php echo esc_html($td_email); ?></h5>
262 <p><?php echo esc_html($td_payment_date) ?></p>
263 </div>
264 <div class="action">
265 </div>
266 </li>
267 </ul>
268 </div>
269 <?php if ( ! $this->pro_enabled ) : ?>
270 <p class="p-4"><a class="width-100 height-auto" target="_blank" href="//wpdeveloper.com/in/upgrade-better-payment-pro"><img width="100%" src="<?php echo esc_url(BETTER_PAYMENT_ASSETS . '/img/refund-banner.svg'); ?>" alt="refund-banner"></a></p>
271 <p class="p-4"><a class="width-100 height-auto" target="_blank" href="//wpdeveloper.com/in/upgrade-better-payment-pro"><img width="100%" src="<?php echo esc_url(BETTER_PAYMENT_ASSETS . '/img/receipt-banner.svg'); ?>" alt="receipt-banner"></a></p>
272 <?php endif; ?>
273 <?php do_action('better_payment/admin/transaction_refund_content', $bp_admin_transaction); ?>
274 <?php do_action('better_payment/admin/transaction_receipt_content', $bp_admin_transaction); ?>
275 </div>
276 </div>
277 </div>
278 </div>
279 </div>
280 </section>
281
282 <?php else : ?>
283 <p><?php echo esc_html__('No records found!', 'better-payment'); ?></p>
284 <?php endif; ?>
285
286 </div>