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

wp-graphql / wp-graphql-woocommerce / 5604143621

pending completion
5604143621

push

github

web-flow
chore: implement WPGraphQL Coding Standards (#769)

* chore: avoid magic constants [PHPCS]

* chore: change ruleset to wp-graphql-cs and lint

* devops: HPOS added back to CI with the release of WC 3.9

---------

Co-authored-by: Geoff Taylor <geoff@axistaylor.com>

562 of 562 new or added lines in 77 files covered. (100.0%)

10309 of 12440 relevant lines covered (82.87%)

53.98 hits per line

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

97.73
/includes/type/object/class-refund-type.php
1
<?php
2
/**
3
 * WPObject Type - Refund_Type
4
 *
5
 * Registers Refund WPObject type and queries
6
 *
7
 * @package WPGraphQL\WooCommerce\Type\WPObject
8
 * @since   0.0.1
9
 */
10

11
namespace WPGraphQL\WooCommerce\Type\WPObject;
12

13
use WPGraphQL\AppContext;
14

15
/**
16
 * Class Refund_Type
17
 */
18
class Refund_Type {
19
        /**
20
         * Register Refund type and queries to the WPGraphQL schema.
21
         *
22
         * @return void
23
         */
24
        public static function register() {
25
                register_graphql_object_type(
109✔
26
                        'Refund',
109✔
27
                        [
109✔
28
                                'description' => __( 'A refund object', 'wp-graphql-woocommerce' ),
109✔
29
                                'interfaces'  => [ 'Node' ],
109✔
30
                                'fields'      => [
109✔
31
                                        'id'         => [
109✔
32
                                                'type'        => [ 'non_null' => 'ID' ],
109✔
33
                                                'description' => __( 'The globally unique identifier for the refund', 'wp-graphql-woocommerce' ),
109✔
34
                                        ],
109✔
35
                                        'databaseId' => [
109✔
36
                                                'type'        => 'Int',
109✔
37
                                                'description' => __( 'The ID of the refund in the database', 'wp-graphql-woocommerce' ),
109✔
38
                                        ],
109✔
39
                                        'title'      => [
109✔
40
                                                'type'        => 'String',
109✔
41
                                                'description' => __( 'A title for the new post type', 'wp-graphql-woocommerce' ),
109✔
42
                                        ],
109✔
43
                                        'amount'     => [
109✔
44
                                                'type'        => 'Float',
109✔
45
                                                'description' => __( 'Refunded amount', 'wp-graphql-woocommerce' ),
109✔
46
                                        ],
109✔
47
                                        'reason'     => [
109✔
48
                                                'type'        => 'String',
109✔
49
                                                'description' => __( 'Reason for refund', 'wp-graphql-woocommerce' ),
109✔
50
                                        ],
109✔
51
                                        'refundedBy' => [
109✔
52
                                                'type'        => 'User',
109✔
53
                                                'description' => __( 'User who completed the refund', 'wp-graphql-woocommerce' ),
109✔
54
                                                'resolve'     => static function ( $source, array $args, AppContext $context ) {
109✔
55
                                                        $user_id = absint( $source->refunded_by_id );
1✔
56
                                                        if ( 0 !== $user_id ) {
1✔
57
                                                                return $context->get_loader( 'user' )->load( $user_id );
×
58
                                                        }
59
                                                        return null;
1✔
60
                                                },
109✔
61
                                        ],
109✔
62
                                        'date'       => [
109✔
63
                                                'type'        => 'String',
109✔
64
                                                'description' => __( 'The date of the refund', 'wp-graphql-woocommerce' ),
109✔
65
                                        ],
109✔
66

67
                                        'metaData'   => Meta_Data_Type::get_metadata_field_definition(),
109✔
68
                                ],
109✔
69
                        ]
109✔
70
                );
109✔
71
        }
72
}
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