• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

wp-graphql / wp-graphql-woocommerce / 27386231983

12 Jun 2026 12:25AM UTC coverage: 91.791%. Remained the same
27386231983

Pull #1019

github

web-flow
Merge 46a421a18 into 01876f534
Pull Request #1019: fix: address WordPress.org plugin review (rename + prefixing + headers)

1327 of 1584 new or added lines in 200 files covered. (83.78%)

1 existing line in 1 file now uncovered.

18505 of 20160 relevant lines covered (91.79%)

151.6 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

98.73
/includes/type/object/class-payment-token-types.php
1
<?php
2
/**
3
 * WPObject Type - Payment_Token_Types
4
 *
5
 * Registers PaymentToken Interface child types.
6
 *
7
 * @package WPGraphQL\WooCommerce\Type\WPObject
8
 * @since   0.12.4
9
 */
10

11
namespace WPGraphQL\WooCommerce\Type\WPObject;
12

13
use WPGraphQL\WooCommerce\Type\WPInterface\Payment_Token_Interface;
14

15
/**
16
 * Class Payment_Token_Types
17
 */
18
class Payment_Token_Types {
19
        /**
20
         * Registers types
21
         *
22
         * @return void
23
         */
24
        public static function register() {
25
                register_graphql_object_type(
296✔
26
                        'PaymentToken',
296✔
27
                        [
296✔
28
                                'description' => static function () {
296✔
NEW
29
                                        return __( 'A payment token', 'graphql-for-ecommerce' );
×
30
                                },
296✔
31
                                'interfaces'  => [ 'PaymentTokenInterface' ],
296✔
32
                                'fields'      => [],
296✔
33
                        ]
296✔
34
                );
296✔
35
                register_graphql_object_type(
296✔
36
                        'PaymentTokenCC',
296✔
37
                        [
296✔
38
                                'description' => static function () {
296✔
39
                                        return __( 'A credit card payment token', 'graphql-for-ecommerce' );
2✔
40
                                },
296✔
41
                                'interfaces'  => [ 'PaymentTokenInterface' ],
296✔
42
                                'fields'      => Payment_Token_Interface::get_fields( self::get_credit_card_fields() ),
296✔
43
                        ]
296✔
44
                );
296✔
45

46
                register_graphql_object_type(
296✔
47
                        'PaymentTokenECheck',
296✔
48
                        [
296✔
49
                                'description' => static function () {
296✔
50
                                        return __( 'An electronic check payment token', 'graphql-for-ecommerce' );
2✔
51
                                },
296✔
52
                                'interfaces'  => [ 'PaymentTokenInterface' ],
296✔
53
                                'fields'      => Payment_Token_Interface::get_fields( self::get_e_check_fields() ),
296✔
54
                        ]
296✔
55
                );
296✔
56
        }
57

58
        /**
59
         * Returns field definitions for PaymentTokenECheck  type.
60
         *
61
         * @return array
62
         */
63
        public static function get_e_check_fields() {
64
                return [
296✔
65
                        'last4' => [
296✔
66
                                'type'        => 'Integer',
296✔
67
                                'description' => static function () {
296✔
68
                                        return __( 'Last 4 digits of the stored account number', 'graphql-for-ecommerce' );
2✔
69
                                },
296✔
70
                                'resolve'     => static function ( $source ) {
296✔
71
                                        return ! empty( $source->get_last4() ) ? $source->get_last4() : null;
2✔
72
                                },
296✔
73
                        ],
296✔
74
                ];
296✔
75
        }
76

77
        /**
78
         * Returns field definitions for PaymentTokenCC type.
79
         *
80
         * @return array
81
         */
82
        public static function get_credit_card_fields() {
83
                return [
296✔
84
                        'cardType'    => [
296✔
85
                                'type'        => 'String',
296✔
86
                                'description' => static function () {
296✔
87
                                        return __( 'Card type (visa, mastercard, etc)', 'graphql-for-ecommerce' );
2✔
88
                                },
296✔
89
                                'resolve'     => static function ( $source ) {
296✔
90
                                        return ! empty( $source->get_card_type() ) ? $source->get_card_type() : null;
1✔
91
                                },
296✔
92
                        ],
296✔
93
                        'expiryYear'  => [
296✔
94
                                'type'        => 'String',
296✔
95
                                'description' => static function () {
296✔
96
                                        return __( 'Card\'s expiration year.', 'graphql-for-ecommerce' );
2✔
97
                                },
296✔
98
                                'resolve'     => static function ( $source ) {
296✔
99
                                        return ! empty( $source->get_expiry_year() ) ? $source->get_expiry_year() : null;
1✔
100
                                },
296✔
101
                        ],
296✔
102
                        'expiryMonth' => [
296✔
103
                                'type'        => 'String',
296✔
104
                                'description' => static function () {
296✔
105
                                        return __( 'Card\'s expiration month', 'graphql-for-ecommerce' );
2✔
106
                                },
296✔
107
                                'resolve'     => static function ( $source ) {
296✔
108
                                        return ! empty( $source->get_expiry_month() ) ? $source->get_expiry_month() : null;
1✔
109
                                },
296✔
110
                        ],
296✔
111
                        'last4'       => [
296✔
112
                                'type'        => 'Integer',
296✔
113
                                'description' => static function () {
296✔
114
                                        return __( 'Last 4 digits of the stored credit card number', 'graphql-for-ecommerce' );
2✔
115
                                },
296✔
116
                                'resolve'     => static function ( $source ) {
296✔
117
                                        return ! empty( $source->get_last4() ) ? $source->get_last4() : null;
2✔
118
                                },
296✔
119
                        ],
296✔
120
                ];
296✔
121
        }
122
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc