pike13 0.1.0.beta → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +67 -116
- data/README.md +1222 -315
- data/lib/pike13/api/v2/account.rb +19 -0
- data/lib/pike13/api/v2/desk/booking.rb +10 -0
- data/lib/pike13/api/v2/desk/business.rb +2 -1
- data/lib/pike13/api/v2/desk/event_occurrence.rb +2 -2
- data/lib/pike13/api/v2/desk/person.rb +5 -3
- data/lib/pike13/api/v2/desk/plan.rb +2 -2
- data/lib/pike13/api/v2/desk/plan_product.rb +2 -2
- data/lib/pike13/api/v2/desk/service.rb +2 -2
- data/lib/pike13/api/v2/desk/visit.rb +2 -2
- data/lib/pike13/api/v2/front/branding.rb +2 -1
- data/lib/pike13/api/v2/front/business.rb +2 -1
- data/lib/pike13/api/v2/front/event_occurrence.rb +2 -2
- data/lib/pike13/api/v2/front/plan_product.rb +2 -2
- data/lib/pike13/api/v2/front/service.rb +2 -2
- data/lib/pike13/api/v2/front/visit.rb +2 -2
- data/lib/pike13/api/v3/desk/base.rb +46 -0
- data/lib/pike13/api/v3/desk/clients.rb +180 -0
- data/lib/pike13/api/v3/desk/enrollments.rb +203 -0
- data/lib/pike13/api/v3/desk/event_occurrence_staff_members.rb +170 -0
- data/lib/pike13/api/v3/desk/event_occurrences.rb +154 -0
- data/lib/pike13/api/v3/desk/invoice_item_transactions.rb +189 -0
- data/lib/pike13/api/v3/desk/invoice_items.rb +193 -0
- data/lib/pike13/api/v3/desk/invoices.rb +167 -0
- data/lib/pike13/api/v3/desk/monthly_business_metrics.rb +151 -0
- data/lib/pike13/api/v3/desk/pays.rb +128 -0
- data/lib/pike13/api/v3/desk/person_plans.rb +265 -0
- data/lib/pike13/api/v3/desk/staff_members.rb +127 -0
- data/lib/pike13/api/v3/desk/transactions.rb +169 -0
- data/lib/pike13/http_client.rb +4 -1
- data/lib/pike13/http_client_v3.rb +101 -0
- data/lib/pike13/validators.rb +136 -0
- data/lib/pike13/version.rb +1 -1
- data/lib/pike13.rb +26 -7
- metadata +17 -2
- data/lib/pike13/api/v2/account/me.rb +0 -20
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pike13
|
|
4
|
+
module API
|
|
5
|
+
module V3
|
|
6
|
+
module Desk
|
|
7
|
+
# Event Occurrence Staff Members resource
|
|
8
|
+
# Details of event occurrences by staff member (instructor, trainer, or organizer)
|
|
9
|
+
# If multiple staff members exist for an event occurrence, a record displays for each
|
|
10
|
+
#
|
|
11
|
+
# @example Basic query
|
|
12
|
+
# Pike13::Reporting::EventOccurrenceStaffMembers.query(
|
|
13
|
+
# fields: ['event_occurrence_id', 'full_name', 'event_name', 'service_date', 'enrollment_count']
|
|
14
|
+
# )
|
|
15
|
+
#
|
|
16
|
+
# @example Query by staff member
|
|
17
|
+
# Pike13::Reporting::EventOccurrenceStaffMembers.query(
|
|
18
|
+
# fields: ['full_name', 'event_name', 'service_date', 'completed_enrollment_count', 'role'],
|
|
19
|
+
# filter: ['eq', 'person_id', 12345]
|
|
20
|
+
# )
|
|
21
|
+
#
|
|
22
|
+
# @example Group by staff member
|
|
23
|
+
# Pike13::Reporting::EventOccurrenceStaffMembers.query(
|
|
24
|
+
# fields: ['event_occurrence_count', 'total_enrollment_count', 'total_completed_enrollment_count'],
|
|
25
|
+
# group: 'full_name'
|
|
26
|
+
# )
|
|
27
|
+
class EventOccurrenceStaffMembers < Base
|
|
28
|
+
class << self
|
|
29
|
+
# Execute an event occurrence staff members query
|
|
30
|
+
#
|
|
31
|
+
# @param fields [Array<String>] Fields to return (detail or summary fields)
|
|
32
|
+
# @param filter [Array, nil] Filter criteria (optional)
|
|
33
|
+
# @param group [String, nil] Grouping field (optional)
|
|
34
|
+
# @param sort [Array<String>, nil] Sort order (optional)
|
|
35
|
+
# @param page [Hash, nil] Pagination options (optional)
|
|
36
|
+
# @param total_count [Boolean] Whether to return total count (optional)
|
|
37
|
+
# @return [Hash] Query result with rows, fields, and metadata
|
|
38
|
+
#
|
|
39
|
+
# @see https://developer.pike13.com/docs/api/v3/reports/event-occurrence-staff-members
|
|
40
|
+
def query(fields:, filter: nil, group: nil, sort: nil, page: nil, total_count: nil)
|
|
41
|
+
query_params = { fields: fields }
|
|
42
|
+
query_params[:filter] = filter if filter
|
|
43
|
+
query_params[:group] = group if group
|
|
44
|
+
query_params[:sort] = sort if sort
|
|
45
|
+
query_params[:page] = page if page
|
|
46
|
+
query_params[:total_count] = total_count if total_count
|
|
47
|
+
|
|
48
|
+
super("event_occurrence_staff_members", query_params)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Available detail fields (when not grouping)
|
|
52
|
+
DETAIL_FIELDS = %w[
|
|
53
|
+
address
|
|
54
|
+
attendance_completed
|
|
55
|
+
business_id
|
|
56
|
+
business_name
|
|
57
|
+
business_subdomain
|
|
58
|
+
capacity
|
|
59
|
+
city
|
|
60
|
+
completed_enrollment_count
|
|
61
|
+
completed_unpaid_count
|
|
62
|
+
country_code
|
|
63
|
+
currency_code
|
|
64
|
+
duration_in_hours
|
|
65
|
+
duration_in_minutes
|
|
66
|
+
email
|
|
67
|
+
end_at
|
|
68
|
+
enrollment_count
|
|
69
|
+
event_id
|
|
70
|
+
event_name
|
|
71
|
+
event_occurrence_id
|
|
72
|
+
expired_enrollment_count
|
|
73
|
+
franchise_id
|
|
74
|
+
full_name
|
|
75
|
+
home_location_id
|
|
76
|
+
home_location_name
|
|
77
|
+
is_waitlist_count
|
|
78
|
+
key
|
|
79
|
+
late_canceled_enrollment_count
|
|
80
|
+
noshowed_enrollment_count
|
|
81
|
+
paid_count
|
|
82
|
+
person_id
|
|
83
|
+
phone
|
|
84
|
+
postal_code
|
|
85
|
+
registered_enrollment_count
|
|
86
|
+
removed_enrollment_count
|
|
87
|
+
reserved_enrollment_count
|
|
88
|
+
role
|
|
89
|
+
service_category
|
|
90
|
+
service_date
|
|
91
|
+
service_day
|
|
92
|
+
service_id
|
|
93
|
+
service_location_id
|
|
94
|
+
service_location_name
|
|
95
|
+
service_name
|
|
96
|
+
service_state
|
|
97
|
+
service_time
|
|
98
|
+
service_type
|
|
99
|
+
start_at
|
|
100
|
+
state_code
|
|
101
|
+
street_address
|
|
102
|
+
street_address2
|
|
103
|
+
visit_count
|
|
104
|
+
waiting_enrollment_count
|
|
105
|
+
waitlist_to_visit_count
|
|
106
|
+
].freeze
|
|
107
|
+
|
|
108
|
+
# Available summary fields (when grouping)
|
|
109
|
+
SUMMARY_FIELDS = %w[
|
|
110
|
+
attendance_completed_count
|
|
111
|
+
business_id_summary
|
|
112
|
+
business_subdomain_summary
|
|
113
|
+
event_count
|
|
114
|
+
event_occurrence_count
|
|
115
|
+
person_count
|
|
116
|
+
service_count
|
|
117
|
+
total_capacity
|
|
118
|
+
total_completed_enrollment_count
|
|
119
|
+
total_completed_unpaid_count
|
|
120
|
+
total_count
|
|
121
|
+
total_duration_in_hours
|
|
122
|
+
total_duration_in_minutes
|
|
123
|
+
total_enrollment_count
|
|
124
|
+
total_expired_enrollment_count
|
|
125
|
+
total_is_waitlist_count
|
|
126
|
+
total_late_canceled_enrollment_count
|
|
127
|
+
total_noshowed_enrollment_count
|
|
128
|
+
total_paid_count
|
|
129
|
+
total_registered_enrollment_count
|
|
130
|
+
total_removed_enrollment_count
|
|
131
|
+
total_reserved_enrollment_count
|
|
132
|
+
total_visit_count
|
|
133
|
+
total_waiting_enrollment_count
|
|
134
|
+
total_waitlist_to_visit_count
|
|
135
|
+
].freeze
|
|
136
|
+
|
|
137
|
+
# Available grouping fields
|
|
138
|
+
GROUPINGS = %w[
|
|
139
|
+
attendance_completed
|
|
140
|
+
business_id
|
|
141
|
+
business_name
|
|
142
|
+
business_subdomain
|
|
143
|
+
event_id
|
|
144
|
+
event_name
|
|
145
|
+
event_occurrence_id
|
|
146
|
+
full_name
|
|
147
|
+
person_id
|
|
148
|
+
role
|
|
149
|
+
service_category
|
|
150
|
+
service_date
|
|
151
|
+
service_day
|
|
152
|
+
service_id
|
|
153
|
+
service_location_id
|
|
154
|
+
service_location_name
|
|
155
|
+
service_month_start_date
|
|
156
|
+
service_name
|
|
157
|
+
service_quarter_start_date
|
|
158
|
+
service_state
|
|
159
|
+
service_time
|
|
160
|
+
service_type
|
|
161
|
+
service_week_mon_start_date
|
|
162
|
+
service_week_sun_start_date
|
|
163
|
+
service_year_start_date
|
|
164
|
+
].freeze
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
end
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pike13
|
|
4
|
+
module API
|
|
5
|
+
module V3
|
|
6
|
+
module Desk
|
|
7
|
+
# Event Occurrences resource
|
|
8
|
+
# Data about scheduled instances of services (e.g., "Group Workout from 9am-10am on 2024/09/01")
|
|
9
|
+
#
|
|
10
|
+
# @example Basic query
|
|
11
|
+
# Pike13::Reporting::EventOccurrences.query(
|
|
12
|
+
# fields: ['event_occurrence_id', 'event_name', 'service_date', 'enrollment_count', 'capacity']
|
|
13
|
+
# )
|
|
14
|
+
#
|
|
15
|
+
# @example Query high attendance classes
|
|
16
|
+
# Pike13::Reporting::EventOccurrences.query(
|
|
17
|
+
# fields: ['event_name', 'service_date', 'completed_enrollment_count', 'capacity'],
|
|
18
|
+
# filter: ['gt', 'completed_enrollment_count', 15],
|
|
19
|
+
# sort: ['completed_enrollment_count-']
|
|
20
|
+
# )
|
|
21
|
+
#
|
|
22
|
+
# @example Group by service name
|
|
23
|
+
# Pike13::Reporting::EventOccurrences.query(
|
|
24
|
+
# fields: ['total_enrollment_count', 'total_completed_enrollment_count', 'total_noshowed_enrollment_count'],
|
|
25
|
+
# group: 'service_name'
|
|
26
|
+
# )
|
|
27
|
+
class EventOccurrences < Base
|
|
28
|
+
class << self
|
|
29
|
+
# Execute an event occurrences query
|
|
30
|
+
#
|
|
31
|
+
# @param fields [Array<String>] Fields to return (detail or summary fields)
|
|
32
|
+
# @param filter [Array, nil] Filter criteria (optional)
|
|
33
|
+
# @param group [String, nil] Grouping field (optional)
|
|
34
|
+
# @param sort [Array<String>, nil] Sort order (optional)
|
|
35
|
+
# @param page [Hash, nil] Pagination options (optional)
|
|
36
|
+
# @param total_count [Boolean] Whether to return total count (optional)
|
|
37
|
+
# @return [Hash] Query result with rows, fields, and metadata
|
|
38
|
+
#
|
|
39
|
+
# @see https://developer.pike13.com/docs/api/v3/reports/event-occurrences
|
|
40
|
+
def query(fields:, filter: nil, group: nil, sort: nil, page: nil, total_count: nil)
|
|
41
|
+
query_params = { fields: fields }
|
|
42
|
+
query_params[:filter] = filter if filter
|
|
43
|
+
query_params[:group] = group if group
|
|
44
|
+
query_params[:sort] = sort if sort
|
|
45
|
+
query_params[:page] = page if page
|
|
46
|
+
query_params[:total_count] = total_count if total_count
|
|
47
|
+
|
|
48
|
+
super("event_occurrences", query_params)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Available detail fields (when not grouping)
|
|
52
|
+
DETAIL_FIELDS = %w[
|
|
53
|
+
attendance_completed
|
|
54
|
+
business_id
|
|
55
|
+
business_name
|
|
56
|
+
business_subdomain
|
|
57
|
+
capacity
|
|
58
|
+
completed_enrollment_count
|
|
59
|
+
completed_unpaid_count
|
|
60
|
+
currency_code
|
|
61
|
+
duration_in_hours
|
|
62
|
+
duration_in_minutes
|
|
63
|
+
end_at
|
|
64
|
+
enrollment_count
|
|
65
|
+
event_id
|
|
66
|
+
event_name
|
|
67
|
+
event_occurrence_id
|
|
68
|
+
expired_enrollment_count
|
|
69
|
+
franchise_id
|
|
70
|
+
instructor_names
|
|
71
|
+
is_waitlist_count
|
|
72
|
+
key
|
|
73
|
+
late_canceled_enrollment_count
|
|
74
|
+
noshowed_enrollment_count
|
|
75
|
+
paid_count
|
|
76
|
+
registered_enrollment_count
|
|
77
|
+
removed_enrollment_count
|
|
78
|
+
reserved_enrollment_count
|
|
79
|
+
service_category
|
|
80
|
+
service_date
|
|
81
|
+
service_day
|
|
82
|
+
service_id
|
|
83
|
+
service_location_id
|
|
84
|
+
service_location_name
|
|
85
|
+
service_name
|
|
86
|
+
service_state
|
|
87
|
+
service_time
|
|
88
|
+
service_type
|
|
89
|
+
start_at
|
|
90
|
+
visit_count
|
|
91
|
+
waiting_enrollment_count
|
|
92
|
+
waitlist_to_visit_count
|
|
93
|
+
].freeze
|
|
94
|
+
|
|
95
|
+
# Available summary fields (when grouping)
|
|
96
|
+
SUMMARY_FIELDS = %w[
|
|
97
|
+
attendance_completed_count
|
|
98
|
+
business_id_summary
|
|
99
|
+
business_subdomain_summary
|
|
100
|
+
event_count
|
|
101
|
+
event_occurrence_count
|
|
102
|
+
service_count
|
|
103
|
+
total_capacity
|
|
104
|
+
total_completed_enrollment_count
|
|
105
|
+
total_completed_unpaid_count
|
|
106
|
+
total_count
|
|
107
|
+
total_duration_in_hours
|
|
108
|
+
total_duration_in_minutes
|
|
109
|
+
total_enrollment_count
|
|
110
|
+
total_expired_enrollment_count
|
|
111
|
+
total_is_waitlist_count
|
|
112
|
+
total_late_canceled_enrollment_count
|
|
113
|
+
total_noshowed_enrollment_count
|
|
114
|
+
total_paid_count
|
|
115
|
+
total_registered_enrollment_count
|
|
116
|
+
total_removed_enrollment_count
|
|
117
|
+
total_reserved_enrollment_count
|
|
118
|
+
total_visit_count
|
|
119
|
+
total_waiting_enrollment_count
|
|
120
|
+
total_waitlist_to_visit_count
|
|
121
|
+
].freeze
|
|
122
|
+
|
|
123
|
+
# Available grouping fields
|
|
124
|
+
GROUPINGS = %w[
|
|
125
|
+
attendance_completed
|
|
126
|
+
business_id
|
|
127
|
+
business_name
|
|
128
|
+
business_subdomain
|
|
129
|
+
event_id
|
|
130
|
+
event_name
|
|
131
|
+
event_occurrence_id
|
|
132
|
+
instructor_names
|
|
133
|
+
service_category
|
|
134
|
+
service_date
|
|
135
|
+
service_day
|
|
136
|
+
service_id
|
|
137
|
+
service_location_id
|
|
138
|
+
service_location_name
|
|
139
|
+
service_month_start_date
|
|
140
|
+
service_name
|
|
141
|
+
service_quarter_start_date
|
|
142
|
+
service_state
|
|
143
|
+
service_time
|
|
144
|
+
service_type
|
|
145
|
+
service_week_mon_start_date
|
|
146
|
+
service_week_sun_start_date
|
|
147
|
+
service_year_start_date
|
|
148
|
+
].freeze
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
end
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pike13
|
|
4
|
+
module API
|
|
5
|
+
module V3
|
|
6
|
+
module Desk
|
|
7
|
+
# Invoice Item Transactions resource
|
|
8
|
+
# Item-level details of transactions (payments and refunds)
|
|
9
|
+
# Payments and refunds are performed against the invoice, not the invoice item
|
|
10
|
+
#
|
|
11
|
+
# @example Basic query
|
|
12
|
+
# Pike13::Reporting::InvoiceItemTransactions.query(
|
|
13
|
+
# fields: ['transaction_id', 'invoice_number', 'transaction_type', 'transaction_amount', 'transaction_state']
|
|
14
|
+
# )
|
|
15
|
+
#
|
|
16
|
+
# @example Query by payment method
|
|
17
|
+
# Pike13::Reporting::InvoiceItemTransactions.query(
|
|
18
|
+
# fields: ['transaction_date', 'payment_method', 'transaction_amount', 'invoice_payer_name'],
|
|
19
|
+
# filter: ['eq', 'payment_method', 'creditcard']
|
|
20
|
+
# )
|
|
21
|
+
#
|
|
22
|
+
# @example Group by payment method
|
|
23
|
+
# Pike13::Reporting::InvoiceItemTransactions.query(
|
|
24
|
+
# fields: ['transaction_count', 'total_net_paid_amount', 'settled_count'],
|
|
25
|
+
# group: 'payment_method'
|
|
26
|
+
# )
|
|
27
|
+
class InvoiceItemTransactions < Base
|
|
28
|
+
class << self
|
|
29
|
+
# Execute an invoice item transactions query
|
|
30
|
+
#
|
|
31
|
+
# @param fields [Array<String>] Fields to return (detail or summary fields)
|
|
32
|
+
# @param filter [Array, nil] Filter criteria (optional)
|
|
33
|
+
# @param group [String, nil] Grouping field (optional)
|
|
34
|
+
# @param sort [Array<String>, nil] Sort order (optional)
|
|
35
|
+
# @param page [Hash, nil] Pagination options (optional)
|
|
36
|
+
# @param total_count [Boolean] Whether to return total count (optional)
|
|
37
|
+
# @return [Hash] Query result with rows, fields, and metadata
|
|
38
|
+
#
|
|
39
|
+
# @see https://developer.pike13.com/docs/api/v3/reports/invoice-item-transactions
|
|
40
|
+
def query(fields:, filter: nil, group: nil, sort: nil, page: nil, total_count: nil)
|
|
41
|
+
query_params = { fields: fields }
|
|
42
|
+
query_params[:filter] = filter if filter
|
|
43
|
+
query_params[:group] = group if group
|
|
44
|
+
query_params[:sort] = sort if sort
|
|
45
|
+
query_params[:page] = page if page
|
|
46
|
+
query_params[:total_count] = total_count if total_count
|
|
47
|
+
|
|
48
|
+
super("invoice_item_transactions", query_params)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Available detail fields (when not grouping)
|
|
52
|
+
DETAIL_FIELDS = %w[
|
|
53
|
+
business_id
|
|
54
|
+
business_name
|
|
55
|
+
business_subdomain
|
|
56
|
+
commission_recipient_name
|
|
57
|
+
created_by_name
|
|
58
|
+
credit_card_name
|
|
59
|
+
currency_code
|
|
60
|
+
error_message
|
|
61
|
+
external_payment_name
|
|
62
|
+
failed_at
|
|
63
|
+
failed_date
|
|
64
|
+
franchise_id
|
|
65
|
+
grants_membership
|
|
66
|
+
invoice_autobill
|
|
67
|
+
invoice_due_date
|
|
68
|
+
invoice_id
|
|
69
|
+
invoice_item_id
|
|
70
|
+
invoice_number
|
|
71
|
+
invoice_payer_email
|
|
72
|
+
invoice_payer_home_location
|
|
73
|
+
invoice_payer_id
|
|
74
|
+
invoice_payer_name
|
|
75
|
+
invoice_payer_phone
|
|
76
|
+
invoice_payer_primary_staff_name_at_sale
|
|
77
|
+
invoice_state
|
|
78
|
+
key
|
|
79
|
+
net_paid_amount
|
|
80
|
+
net_paid_revenue_amount
|
|
81
|
+
net_paid_tax_amount
|
|
82
|
+
payment_method
|
|
83
|
+
payment_method_detail
|
|
84
|
+
payment_transaction_id
|
|
85
|
+
payments_amount
|
|
86
|
+
plan_id
|
|
87
|
+
processing_method
|
|
88
|
+
processor_transaction_id
|
|
89
|
+
product_id
|
|
90
|
+
product_name
|
|
91
|
+
product_name_at_sale
|
|
92
|
+
product_type
|
|
93
|
+
refunds_amount
|
|
94
|
+
revenue_category
|
|
95
|
+
sale_location_name
|
|
96
|
+
transaction_amount
|
|
97
|
+
transaction_at
|
|
98
|
+
transaction_autopay
|
|
99
|
+
transaction_date
|
|
100
|
+
transaction_id
|
|
101
|
+
transaction_state
|
|
102
|
+
transaction_type
|
|
103
|
+
voided_at
|
|
104
|
+
].freeze
|
|
105
|
+
|
|
106
|
+
# Available summary fields (when grouping)
|
|
107
|
+
SUMMARY_FIELDS = %w[
|
|
108
|
+
business_id_summary
|
|
109
|
+
business_subdomain_summary
|
|
110
|
+
failed_count
|
|
111
|
+
grants_membership_count
|
|
112
|
+
invoice_count
|
|
113
|
+
invoice_item_count
|
|
114
|
+
settled_count
|
|
115
|
+
total_count
|
|
116
|
+
total_net_ach_paid_amount
|
|
117
|
+
total_net_american_express_paid_amount
|
|
118
|
+
total_net_amex_processing_paid_amount
|
|
119
|
+
total_net_cash_paid_amount
|
|
120
|
+
total_net_check_paid_amount
|
|
121
|
+
total_net_credit_paid_amount
|
|
122
|
+
total_net_discover_paid_amount
|
|
123
|
+
total_net_external_paid_amount
|
|
124
|
+
total_net_global_pay_processing_paid_amount
|
|
125
|
+
total_net_mastercard_paid_amount
|
|
126
|
+
total_net_other_credit_card_paid_amount
|
|
127
|
+
total_net_other_processing_paid_amount
|
|
128
|
+
total_net_paid_amount
|
|
129
|
+
total_net_paid_revenue_amount
|
|
130
|
+
total_net_paid_tax_amount
|
|
131
|
+
total_net_visa_paid_amount
|
|
132
|
+
total_payments_amount
|
|
133
|
+
total_refunds_amount
|
|
134
|
+
transaction_autopay_count
|
|
135
|
+
transaction_count
|
|
136
|
+
].freeze
|
|
137
|
+
|
|
138
|
+
# Available grouping fields
|
|
139
|
+
GROUPINGS = %w[
|
|
140
|
+
business_id
|
|
141
|
+
business_name
|
|
142
|
+
business_subdomain
|
|
143
|
+
commission_recipient_name
|
|
144
|
+
created_by_name
|
|
145
|
+
credit_card_name
|
|
146
|
+
external_payment_name
|
|
147
|
+
failed_date
|
|
148
|
+
failed_month_start_date
|
|
149
|
+
failed_quarter_start_date
|
|
150
|
+
failed_week_mon_start_date
|
|
151
|
+
failed_week_sun_start_date
|
|
152
|
+
failed_year_start_date
|
|
153
|
+
grants_membership
|
|
154
|
+
invoice_autobill
|
|
155
|
+
invoice_due_date
|
|
156
|
+
invoice_id
|
|
157
|
+
invoice_item_id
|
|
158
|
+
invoice_number
|
|
159
|
+
invoice_payer_home_location
|
|
160
|
+
invoice_payer_id
|
|
161
|
+
invoice_payer_name
|
|
162
|
+
invoice_payer_primary_staff_name_at_sale
|
|
163
|
+
invoice_state
|
|
164
|
+
payment_method
|
|
165
|
+
plan_id
|
|
166
|
+
processing_method
|
|
167
|
+
product_id
|
|
168
|
+
product_name
|
|
169
|
+
product_name_at_sale
|
|
170
|
+
product_type
|
|
171
|
+
revenue_category
|
|
172
|
+
sale_location_name
|
|
173
|
+
transaction_autopay
|
|
174
|
+
transaction_date
|
|
175
|
+
transaction_id
|
|
176
|
+
transaction_month_start_date
|
|
177
|
+
transaction_quarter_start_date
|
|
178
|
+
transaction_state
|
|
179
|
+
transaction_type
|
|
180
|
+
transaction_week_mon_start_date
|
|
181
|
+
transaction_week_sun_start_date
|
|
182
|
+
transaction_year_start_date
|
|
183
|
+
].freeze
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
end
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pike13
|
|
4
|
+
module API
|
|
5
|
+
module V3
|
|
6
|
+
module Desk
|
|
7
|
+
# Invoice Items resource
|
|
8
|
+
# Item-level details of invoices
|
|
9
|
+
#
|
|
10
|
+
# @example Basic query
|
|
11
|
+
# Pike13::Reporting::InvoiceItems.query(
|
|
12
|
+
# fields: ['invoice_item_id', 'invoice_number', 'product_name', 'expected_amount', 'invoice_state']
|
|
13
|
+
# )
|
|
14
|
+
#
|
|
15
|
+
# @example Query by product type
|
|
16
|
+
# Pike13::Reporting::InvoiceItems.query(
|
|
17
|
+
# fields: ['product_name', 'product_type', 'expected_amount', 'net_paid_amount'],
|
|
18
|
+
# filter: ['eq', 'product_type', 'recurring']
|
|
19
|
+
# )
|
|
20
|
+
#
|
|
21
|
+
# @example Group by product
|
|
22
|
+
# Pike13::Reporting::InvoiceItems.query(
|
|
23
|
+
# fields: ['invoice_item_count', 'total_expected_amount', 'total_net_paid_amount'],
|
|
24
|
+
# group: 'product_name'
|
|
25
|
+
# )
|
|
26
|
+
class InvoiceItems < Base
|
|
27
|
+
class << self
|
|
28
|
+
# Execute an invoice items query
|
|
29
|
+
#
|
|
30
|
+
# @param fields [Array<String>] Fields to return (detail or summary fields)
|
|
31
|
+
# @param filter [Array, nil] Filter criteria (optional)
|
|
32
|
+
# @param group [String, nil] Grouping field (optional)
|
|
33
|
+
# @param sort [Array<String>, nil] Sort order (optional)
|
|
34
|
+
# @param page [Hash, nil] Pagination options (optional)
|
|
35
|
+
# @param total_count [Boolean] Whether to return total count (optional)
|
|
36
|
+
# @return [Hash] Query result with rows, fields, and metadata
|
|
37
|
+
#
|
|
38
|
+
# @see https://developer.pike13.com/docs/api/v3/reports/invoice-items
|
|
39
|
+
def query(fields:, filter: nil, group: nil, sort: nil, page: nil, total_count: nil)
|
|
40
|
+
query_params = { fields: fields }
|
|
41
|
+
query_params[:filter] = filter if filter
|
|
42
|
+
query_params[:group] = group if group
|
|
43
|
+
query_params[:sort] = sort if sort
|
|
44
|
+
query_params[:page] = page if page
|
|
45
|
+
query_params[:total_count] = total_count if total_count
|
|
46
|
+
|
|
47
|
+
super("invoice_items", query_params)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Available detail fields (when not grouping)
|
|
51
|
+
DETAIL_FIELDS = %w[
|
|
52
|
+
adjustments_amount
|
|
53
|
+
business_id
|
|
54
|
+
business_name
|
|
55
|
+
business_subdomain
|
|
56
|
+
closed_at
|
|
57
|
+
closed_date
|
|
58
|
+
commission_recipient_name
|
|
59
|
+
coupon_code
|
|
60
|
+
coupons_amount
|
|
61
|
+
created_by_client
|
|
62
|
+
created_by_name
|
|
63
|
+
currency_code
|
|
64
|
+
days_since_invoice_due
|
|
65
|
+
discount_type
|
|
66
|
+
discounts_amount
|
|
67
|
+
expected_amount
|
|
68
|
+
expected_revenue_amount
|
|
69
|
+
expected_tax_amount
|
|
70
|
+
failed_transactions
|
|
71
|
+
franchise_id
|
|
72
|
+
grants_membership
|
|
73
|
+
gross_amount
|
|
74
|
+
invoice_autobill
|
|
75
|
+
invoice_due_date
|
|
76
|
+
invoice_id
|
|
77
|
+
invoice_item_id
|
|
78
|
+
invoice_number
|
|
79
|
+
invoice_payer_email
|
|
80
|
+
invoice_payer_home_location
|
|
81
|
+
invoice_payer_id
|
|
82
|
+
invoice_payer_name
|
|
83
|
+
invoice_payer_phone
|
|
84
|
+
invoice_payer_primary_staff_name_at_sale
|
|
85
|
+
invoice_state
|
|
86
|
+
issued_at
|
|
87
|
+
issued_date
|
|
88
|
+
key
|
|
89
|
+
net_paid_amount
|
|
90
|
+
net_paid_revenue_amount
|
|
91
|
+
net_paid_tax_amount
|
|
92
|
+
outstanding_amount
|
|
93
|
+
outstanding_revenue_amount
|
|
94
|
+
outstanding_tax_amount
|
|
95
|
+
payments_amount
|
|
96
|
+
plan_id
|
|
97
|
+
product_id
|
|
98
|
+
product_name
|
|
99
|
+
product_name_at_sale
|
|
100
|
+
product_type
|
|
101
|
+
purchase_order_number
|
|
102
|
+
purchase_request_cancel_reason
|
|
103
|
+
purchase_request_message
|
|
104
|
+
purchase_request_state
|
|
105
|
+
recipient_names
|
|
106
|
+
refunded_transactions
|
|
107
|
+
refunds_amount
|
|
108
|
+
retail_add_ons
|
|
109
|
+
retail_options
|
|
110
|
+
revenue_category
|
|
111
|
+
sale_location_name
|
|
112
|
+
tax_types
|
|
113
|
+
tax_types_extended
|
|
114
|
+
voided_transactions
|
|
115
|
+
].freeze
|
|
116
|
+
|
|
117
|
+
# Available summary fields (when grouping)
|
|
118
|
+
SUMMARY_FIELDS = %w[
|
|
119
|
+
business_id_summary
|
|
120
|
+
business_subdomain_summary
|
|
121
|
+
grants_membership_count
|
|
122
|
+
invoice_count
|
|
123
|
+
invoice_item_count
|
|
124
|
+
total_adjustments_amount
|
|
125
|
+
total_count
|
|
126
|
+
total_coupons_amount
|
|
127
|
+
total_discounts_amount
|
|
128
|
+
total_expected_amount
|
|
129
|
+
total_expected_revenue_amount
|
|
130
|
+
total_expected_tax_amount
|
|
131
|
+
total_gross_amount
|
|
132
|
+
total_net_paid_amount
|
|
133
|
+
total_net_paid_revenue_amount
|
|
134
|
+
total_net_paid_tax_amount
|
|
135
|
+
total_outstanding_amount
|
|
136
|
+
total_outstanding_revenue_amount
|
|
137
|
+
total_outstanding_tax_amount
|
|
138
|
+
total_payments_amount
|
|
139
|
+
total_refunds_amount
|
|
140
|
+
].freeze
|
|
141
|
+
|
|
142
|
+
# Available grouping fields
|
|
143
|
+
GROUPINGS = %w[
|
|
144
|
+
business_id
|
|
145
|
+
business_name
|
|
146
|
+
business_subdomain
|
|
147
|
+
closed_date
|
|
148
|
+
closed_month_start_date
|
|
149
|
+
closed_quarter_start_date
|
|
150
|
+
closed_week_mon_start_date
|
|
151
|
+
closed_week_sun_start_date
|
|
152
|
+
closed_year_start_date
|
|
153
|
+
commission_recipient_name
|
|
154
|
+
coupon_code
|
|
155
|
+
created_by_client
|
|
156
|
+
created_by_name
|
|
157
|
+
discount_type
|
|
158
|
+
due_month_start_date
|
|
159
|
+
due_quarter_start_date
|
|
160
|
+
due_week_mon_start_date
|
|
161
|
+
due_week_sun_start_date
|
|
162
|
+
due_year_start_date
|
|
163
|
+
grants_membership
|
|
164
|
+
invoice_autobill
|
|
165
|
+
invoice_due_date
|
|
166
|
+
invoice_id
|
|
167
|
+
invoice_number
|
|
168
|
+
invoice_payer_home_location
|
|
169
|
+
invoice_payer_id
|
|
170
|
+
invoice_payer_name
|
|
171
|
+
invoice_payer_primary_staff_name_at_sale
|
|
172
|
+
invoice_state
|
|
173
|
+
issued_date
|
|
174
|
+
issued_month_start_date
|
|
175
|
+
issued_quarter_start_date
|
|
176
|
+
issued_week_mon_start_date
|
|
177
|
+
issued_week_sun_start_date
|
|
178
|
+
issued_year_start_date
|
|
179
|
+
plan_id
|
|
180
|
+
product_id
|
|
181
|
+
product_name
|
|
182
|
+
product_name_at_sale
|
|
183
|
+
product_type
|
|
184
|
+
purchase_request_state
|
|
185
|
+
revenue_category
|
|
186
|
+
sale_location_name
|
|
187
|
+
].freeze
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
end
|