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

wp-graphql / wp-graphql-woocommerce / 28450585642

30 Jun 2026 02:06PM UTC coverage: 91.801%. Remained the same
28450585642

Pull #1019

github

web-flow
Merge f9d5287ec into e3cf94438
Pull Request #1019: fix: address WordPress.org plugin review (rename + prefixing + headers)

1330 of 1587 new or added lines in 201 files covered. (83.81%)

1 existing line in 1 file now uncovered.

18531 of 20186 relevant lines covered (91.8%)

153.15 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(
299✔
26
                        'PaymentToken',
299✔
27
                        [
299✔
28
                                'description' => static function () {
299✔
NEW
29
                                        return __( 'A payment token', 'graphql-for-ecommerce' );
×
30
                                },
299✔
31
                                'interfaces'  => [ 'PaymentTokenInterface' ],
299✔
32
                                'fields'      => [],
299✔
33
                        ]
299✔
34
                );
299✔
35
                register_graphql_object_type(
299✔
36
                        'PaymentTokenCC',
299✔
37
                        [
299✔
38
                                'description' => static function () {
299✔
39
                                        return __( 'A credit card payment token', 'graphql-for-ecommerce' );
2✔
40
                                },
299✔
41
                                'interfaces'  => [ 'PaymentTokenInterface' ],
299✔
42
                                'fields'      => Payment_Token_Interface::get_fields( self::get_credit_card_fields() ),
299✔
43
                        ]
299✔
44
                );
299✔
45

46
                register_graphql_object_type(
299✔
47
                        'PaymentTokenECheck',
299✔
48
                        [
299✔
49
                                'description' => static function () {
299✔
50
                                        return __( 'An electronic check payment token', 'graphql-for-ecommerce' );
2✔
51
                                },
299✔
52
                                'interfaces'  => [ 'PaymentTokenInterface' ],
299✔
53
                                'fields'      => Payment_Token_Interface::get_fields( self::get_e_check_fields() ),
299✔
54
                        ]
299✔
55
                );
299✔
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 [
299✔
65
                        'last4' => [
299✔
66
                                'type'        => 'Integer',
299✔
67
                                'description' => static function () {
299✔
68
                                        return __( 'Last 4 digits of the stored account number', 'graphql-for-ecommerce' );
2✔
69
                                },
299✔
70
                                'resolve'     => static function ( $source ) {
299✔
71
                                        return ! empty( $source->get_last4() ) ? $source->get_last4() : null;
2✔
72
                                },
299✔
73
                        ],
299✔
74
                ];
299✔
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 [
299✔
84
                        'cardType'    => [
299✔
85
                                'type'        => 'String',
299✔
86
                                'description' => static function () {
299✔
87
                                        return __( 'Card type (visa, mastercard, etc)', 'graphql-for-ecommerce' );
2✔
88
                                },
299✔
89
                                'resolve'     => static function ( $source ) {
299✔
90
                                        return ! empty( $source->get_card_type() ) ? $source->get_card_type() : null;
1✔
91
                                },
299✔
92
                        ],
299✔
93
                        'expiryYear'  => [
299✔
94
                                'type'        => 'String',
299✔
95
                                'description' => static function () {
299✔
96
                                        return __( 'Card\'s expiration year.', 'graphql-for-ecommerce' );
2✔
97
                                },
299✔
98
                                'resolve'     => static function ( $source ) {
299✔
99
                                        return ! empty( $source->get_expiry_year() ) ? $source->get_expiry_year() : null;
1✔
100
                                },
299✔
101
                        ],
299✔
102
                        'expiryMonth' => [
299✔
103
                                'type'        => 'String',
299✔
104
                                'description' => static function () {
299✔
105
                                        return __( 'Card\'s expiration month', 'graphql-for-ecommerce' );
2✔
106
                                },
299✔
107
                                'resolve'     => static function ( $source ) {
299✔
108
                                        return ! empty( $source->get_expiry_month() ) ? $source->get_expiry_month() : null;
1✔
109
                                },
299✔
110
                        ],
299✔
111
                        'last4'       => [
299✔
112
                                'type'        => 'Integer',
299✔
113
                                'description' => static function () {
299✔
114
                                        return __( 'Last 4 digits of the stored credit card number', 'graphql-for-ecommerce' );
2✔
115
                                },
299✔
116
                                'resolve'     => static function ( $source ) {
299✔
117
                                        return ! empty( $source->get_last4() ) ? $source->get_last4() : null;
2✔
118
                                },
299✔
119
                        ],
299✔
120
                ];
299✔
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