blob: e22f6201df7463f80bc4c4a8e1d93666d4e0a34c [file] [log] [blame]
swissChilif0cbdc32023-01-05 17:21:38 -05001<?php
2
3if ( ! defined( 'ABSPATH' ) ) {
4 exit; // Exit if accessed directly
5}
6
7// phpcs:disable WordPress.Files.FileName
8
9/**
10 * WooCommerce Stripe Link Payment Token.
11 *
12 * Representation of a payment token for Link.
13 *
14 * @class WC_Payment_Token_Link
15 */
16class WC_Payment_Token_Link extends WC_Payment_Token {
17
18 /**
19 * Stores payment type.
20 *
21 * @var string
22 */
23 protected $type = 'link';
24
25 /**
26 * Stores Link payment token data.
27 *
28 * @var array
29 */
30 protected $extra_data = [
31 'email' => '',
32 ];
33
34 /**
35 * Get type to display to user.
36 *
37 * @param string $deprecated Deprecated since WooCommerce 3.0
38 * @return string
39 */
40 public function get_display_name( $deprecated = '' ) {
41 $display = sprintf(
42 /* translators: customer email */
43 __( 'Stripe Link email %s', 'woocommerce-gateway-stripe' ),
44 $this->get_email()
45 );
46
47 return $display;
48 }
49
50 /**
51 * Hook prefix
52 */
53 protected function get_hook_prefix() {
54 return 'woocommerce_payment_token_link_get_';
55 }
56
57 /**
58 * Set Stripe payment method type.
59 *
60 * @param string $type Payment method type.
61 */
62 public function set_payment_method_type( $type ) {
63 $this->set_prop( 'payment_method_type', $type );
64 }
65
66 /**
67 * Returns Stripe payment method type.
68 *
69 * @param string $context What the value is for. Valid values are view and edit.
70 * @return string $payment_method_type
71 */
72 public function get_payment_method_type( $context = 'view' ) {
73 return $this->get_prop( 'payment_method_type', $context );
74 }
75
76 /**
77 * Returns the customer email.
78 *
79 * @param string $context What the value is for. Valid values are view and edit.
80 *
81 * @return string Customer email.
82 */
83 public function get_email( $context = 'view' ) {
84 return $this->get_prop( 'email', $context );
85 }
86
87 /**
88 * Set the customer email.
89 *
90 * @param string $email Customer email.
91 */
92 public function set_email( $email ) {
93 $this->set_prop( 'email', $email );
94 }
95}