PluginProbe
Yatra – Travel Booking & Tour Operator Software / trunk
Yatra – Travel Booking & Tour Operator Software vtrunk
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 2.0.10 2.0.11 All 82 releases
yatra / app / PaymentGateways / PaymentGatewayInterface.php

PaymentGatewayInterface.php in Yatra – Travel Booking & Tour Operator Software trunk, at app/PaymentGateways/PaymentGatewayInterface.php

146 lines 3.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Yatra\PaymentGateways;
6
7 /**
8 * Payment Gateway Interface
9 * All payment gateways must implement this interface
10 */
11 interface PaymentGatewayInterface
12 {
13 /**
14 * Get gateway unique ID
15 */
16 public function getId(): string;
17
18 /**
19 * Get gateway display title
20 */
21 public function getTitle(): string;
22
23 /**
24 * Get gateway description
25 */
26 public function getDescription(): string;
27
28 /**
29 * Get gateway icon URL
30 */
31 public function getIcon(): string;
32
33 /**
34 * Check if gateway is available/configured
35 */
36 public function isAvailable(): bool;
37
38 /**
39 * Whether required credentials/settings are present for live checkout (enabled is checked separately).
40 */
41 public function isProperlyConfigured(): bool;
42
43 /**
44 * Check if this is an offline payment method
45 */
46 public function isOffline(): bool;
47
48 /**
49 * Get sandbox/test mode documentation URL
50 */
51 public function getSandboxUrl(): string;
52
53 /**
54 * Get supported features
55 * @return array e.g., ['credit_card', 'refunds', 'recurring', 'tokenization']
56 */
57 public function getSupports(): array;
58
59 /**
60 * Get configuration fields for admin settings
61 * @return array Field definitions
62 */
63 public function getConfigFields(): array;
64
65 /**
66 * Get current configuration values
67 */
68 public function getConfig(): array;
69
70 /**
71 * Save configuration
72 */
73 public function saveConfig(array $config): bool;
74
75 /**
76 * Process payment
77 * @param array $paymentData Payment details
78 * @return array Result with success status and data
79 */
80 public function processPayment(array $paymentData): array;
81
82 /**
83 * Handle webhook/callback
84 */
85 public function handleWebhook(array $data): array;
86
87 /**
88 * Verify payment
89 */
90 public function verifyPayment(string $transactionId): array;
91
92 /**
93 * Process refund
94 */
95 public function processRefund(string $transactionId, float $amount): array;
96
97 /**
98 * Check if gateway supports tokenization (saving payment methods)
99 */
100 public function supportsTokenization(): bool;
101
102 /**
103 * Check if gateway supports recurring/scheduled payments
104 */
105 public function supportsRecurring(): bool;
106
107 /**
108 * Create a customer in the gateway (for storing payment methods)
109 * @param array $customerData Customer details
110 * @return array Result with customer_id
111 */
112 public function createCustomer(array $customerData): array;
113
114 /**
115 * Save payment method for future charges
116 * @param string $customerId Gateway customer ID
117 * @param array $paymentMethodData Payment method details
118 * @return array Result with payment_method_id/token
119 */
120 public function savePaymentMethod(string $customerId, array $paymentMethodData): array;
121
122 /**
123 * Charge a saved payment method
124 * @param string $customerId Gateway customer ID
125 * @param string $paymentMethodId Saved payment method ID
126 * @param array $paymentData Payment details (amount, currency, etc.)
127 * @return array Result with transaction details
128 */
129 public function chargePaymentMethod(string $customerId, string $paymentMethodId, array $paymentData): array;
130
131 /**
132 * Delete a saved payment method
133 * @param string $paymentMethodId Payment method ID to delete
134 * @return array Result
135 */
136 public function deletePaymentMethod(string $paymentMethodId): array;
137
138 /**
139 * Get customer's saved payment methods
140 * @param string $customerId Gateway customer ID
141 * @return array List of saved payment methods
142 */
143 public function getPaymentMethods(string $customerId): array;
144 }
145
146