PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.16
Yatra – Travel Booking & Tour Operator Software v3.0.16
3.0.16 3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 All 84 releases
yatra / app / PaymentGateways / Hooks / PaymentHooks.php

PaymentHooks.php in Yatra – Travel Booking & Tour Operator Software 3.0.16, at app/PaymentGateways/Hooks/PaymentHooks.php

102 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Payment Hooks
4 *
5 * @package Yatra\PaymentGateways\Hooks
6 * @since 2.0.0
7 */
8
9 namespace Yatra\PaymentGateways\Hooks;
10
11 defined('ABSPATH') || exit;
12
13 /**
14 * Payment Hooks class.
15 */
16 class PaymentHooks {
17
18 /**
19 * Initialize hooks
20 */
21 public static function init() {
22 // Action hooks
23 add_action('yatra_before_payment_processing', [__CLASS__, 'before_payment_processing'], 10, 3);
24 add_action('yatra_after_payment_processing', [__CLASS__, 'after_payment_processing'], 10, 3);
25 add_action('yatra_payment_success', [__CLASS__, 'payment_success'], 10, 3);
26 add_action('yatra_payment_failed', [__CLASS__, 'payment_failed'], 10, 3);
27 add_action('yatra_payment_processing', [__CLASS__, 'payment_processing'], 10, 3);
28
29 // Filter hooks
30 add_filter('yatra_payment_gateways', [__CLASS__, 'register_gateways'], 10, 1);
31 add_filter('yatra_payment_parameters', [__CLASS__, 'filter_payment_parameters'], 10, 3);
32 add_filter('yatra_payment_redirect_url', [__CLASS__, 'filter_redirect_url'], 10, 3);
33 add_filter('yatra_payment_confirmation_message', [__CLASS__, 'filter_confirmation_message'], 10, 3);
34 }
35
36 /**
37 * Before payment processing hook
38 */
39 public static function before_payment_processing($gateway_id, $payment_data, $booking_id) {
40 do_action('yatra_before_payment_processing', $gateway_id, $payment_data, $booking_id);
41 }
42
43 /**
44 * After payment processing hook
45 */
46 public static function after_payment_processing($gateway_id, $result, $booking_id) {
47 do_action('yatra_after_payment_processing', $gateway_id, $result, $booking_id);
48 }
49
50 /**
51 * Payment success hook
52 */
53 public static function payment_success($gateway_id, $payment_data, $booking_id) {
54 do_action('yatra_payment_success', $gateway_id, $payment_data, $booking_id);
55 }
56
57 /**
58 * Payment failed hook
59 */
60 public static function payment_failed($gateway_id, $payment_data, $booking_id) {
61 do_action('yatra_payment_failed', $gateway_id, $payment_data, $booking_id);
62 }
63
64 /**
65 * Payment processing hook
66 */
67 public static function payment_processing($gateway_id, $payment_data, $booking_id) {
68 do_action('yatra_payment_processing', $gateway_id, $payment_data, $booking_id);
69 }
70
71 /**
72 * Register payment gateways
73 */
74 public static function register_gateways($gateways) {
75 return apply_filters('yatra_payment_gateways', $gateways);
76 }
77
78 /**
79 * Filter payment parameters
80 */
81 public static function filter_payment_parameters($params, $gateway_id, $booking_id) {
82 return apply_filters('yatra_payment_parameters', $params, $gateway_id, $booking_id);
83 }
84
85 /**
86 * Filter redirect URL
87 */
88 public static function filter_redirect_url($url, $gateway_id, $booking_id) {
89 return apply_filters('yatra_payment_redirect_url', $url, $gateway_id, $booking_id);
90 }
91
92 /**
93 * Filter confirmation message
94 */
95 public static function filter_confirmation_message($message, $gateway_id, $booking_id) {
96 return apply_filters('yatra_payment_confirmation_message', $message, $gateway_id, $booking_id);
97 }
98 }
99
100 // Initialize payment hooks
101 PaymentHooks::init();
102