PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.21
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.21
1.10.22 1.10.21 1.10.20 1.10.19 1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 1.10.1 1.10.0 1.9.17 All 166 releases
← All changes | includes/Payments/Gateway_Contract.php +34 -0 1.10.6 → 1.10.21 View file →
@@ -18,8 +18,42 @@
18 18 * Shared helper for the POS payment-gateway contract.
19 19 */
20 20 class Gateway_Contract {
21 21 /**
22 + * Human-readable gateway name for POS and settings display.
23 + *
24 + * Falls back from the public title to the admin method title to the id,
25 + * because some gateways never assign a public title.
26 + *
27 + * @param WC_Payment_Gateway $gateway Gateway object.
28 + */
29 + public function get_display_title( WC_Payment_Gateway $gateway ): string {
30 + foreach ( array( $gateway->get_title(), $gateway->method_title ) as $title ) {
31 + if ( is_string( $title ) && '' !== trim( $title ) ) {
32 + return $title;
33 + }
34 + }
35 +
36 + return (string) $gateway->id;
37 + }
38 +
39 + /**
40 + * Gateway description for POS and settings display, falling back to the
41 + * admin method description.
42 + *
43 + * @param WC_Payment_Gateway $gateway Gateway object.
44 + */
45 + public function get_display_description( WC_Payment_Gateway $gateway ): string {
46 + foreach ( array( $gateway->get_description(), $gateway->method_description ) as $description ) {
47 + if ( is_string( $description ) && '' !== trim( $description ) ) {
48 + return $description;
49 + }
50 + }
51 +
52 + return '';
53 + }
54 +
55 + /**
22 56 * Infer POS type for a gateway.
23 57 *
24 58 * @param WC_Payment_Gateway $gateway Gateway object.
25 59 * @param WP_REST_Request $request Request object.