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

wp-graphql / wp-graphql-woocommerce / 27452430870

13 Jun 2026 01:26AM UTC coverage: 91.8%. Remained the same
27452430870

Pull #1019

github

web-flow
Merge f03617ca3 into 2ce9424e1
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.

18528 of 20183 relevant lines covered (91.8%)

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

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

© 2026 Coveralls, Inc