class-wc-payment-token-wcpay-link.php
1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
/**
* Class WC_Payment_Token_WCPay_Link
*
* @package WooCommerce\Payments
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* WooCommerce Stripe Link Payment Token.
*
* Representation of a payment token for Link.
*
* @class WC_Payment_Token_WCPay_Link
*/
class WC_Payment_Token_WCPay_Link extends WC_Payment_Token {
/**
* Class Constant so other code can be unambiguous.
*
* @type string
*/
const TYPE = 'wcpay_link';
/**
* The payment method type of this token.
*
* @var string
*/
protected $type = self::TYPE;
/**
* Stores Link payment token data.
*
* @var array
*/
protected $extra_data = [
'email' => '',
];
/**
* Get payment method type to display to user.
*
* @param string $deprecated Deprecated since WooCommerce 3.0.
* @return string
*/
public function get_display_name( $deprecated = '' ) {
$display = sprintf(
/* translators: customer email */
__( 'Stripe Link email %s', 'woocommerce-payments' ),
$this->get_email()
);
return $display;
}
/**
* Hook prefix.
*/
protected function get_hook_prefix() {
return 'woocommerce_payments_token_wcpay_link_get_';
}
/**
* Returns the customer email.
*
* @param string $context What the value is for. Valid values are view and edit.
*
* @return string Customer email.
*/
public function get_email( $context = 'view' ) {
return $this->get_prop( 'email', $context );
}
/**
* Set the customer email.
*
* @param string $email Customer email.
*/
public function set_email( $email ) {
$this->set_prop( 'email', $email );
}
}