-
Notifications
You must be signed in to change notification settings - Fork 1
/
refunds.go
793 lines (714 loc) · 26.1 KB
/
refunds.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
// This file was auto-generated by Fern from our API Definition.
package square
import (
json "encoding/json"
fmt "fmt"
internal "github.com/square/square-go-sdk/internal"
)
type RefundPaymentRequest struct {
// A unique string that identifies this `RefundPayment` request. The key can be any valid string
//
// but must be unique for every `RefundPayment` request.
//
// Keys are limited to a max of 45 characters - however, the number of allowed characters might be
// less than 45, if multi-byte characters are used.
//
// For more information, see [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency).
IdempotencyKey string `json:"idempotency_key" url:"-"`
// The amount of money to refund.
//
// This amount cannot be more than the `total_money` value of the payment minus the total
// amount of all previously completed refunds for this payment.
//
// This amount must be specified in the smallest denomination of the applicable currency
// (for example, US dollar amounts are specified in cents). For more information, see
// [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
//
// The currency code must match the currency associated with the business
// that is charging the card.
AmountMoney *Money `json:"amount_money,omitempty" url:"-"`
// The amount of money the developer contributes to help cover the refunded amount.
// This amount is specified in the smallest denomination of the applicable currency (for example,
// US dollar amounts are specified in cents).
//
// The value cannot be more than the `amount_money`.
//
// You can specify this parameter in a refund request only if the same parameter was also included
// when taking the payment. This is part of the application fee scenario the API supports. For more
// information, see [Take Payments and Collect Fees](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees).
//
// To set this field, `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required.
// For more information, see [Permissions](https://developer.squareup.com/docs/payments-api/take-payments-and-collect-fees#permissions).
AppFeeMoney *Money `json:"app_fee_money,omitempty" url:"-"`
// The unique ID of the payment being refunded.
// Required when unlinked=false, otherwise must not be set.
PaymentID *string `json:"payment_id,omitempty" url:"-"`
// The ID indicating where funds will be refunded to. Required for unlinked refunds. For more
// information, see [Process an Unlinked Refund](https://developer.squareup.com/docs/refunds-api/unlinked-refunds).
//
// For refunds linked to Square payments, `destination_id` is usually omitted; in this case, funds
// will be returned to the original payment source. The field may be specified in order to request
// a cross-method refund to a gift card. For more information,
// see [Cross-method refunds to gift cards](https://developer.squareup.com/docs/payments-api/refund-payments#cross-method-refunds-to-gift-cards).
DestinationID *string `json:"destination_id,omitempty" url:"-"`
// Indicates that the refund is not linked to a Square payment.
// If set to true, `destination_id` and `location_id` must be supplied while `payment_id` must not
// be provided.
Unlinked *bool `json:"unlinked,omitempty" url:"-"`
// The location ID associated with the unlinked refund.
// Required for requests specifying `unlinked=true`.
// Otherwise, if included when `unlinked=false`, will throw an error.
LocationID *string `json:"location_id,omitempty" url:"-"`
// The [Customer](entity:Customer) ID of the customer associated with the refund.
// This is required if the `destination_id` refers to a card on file created using the Cards
// API. Only allowed when `unlinked=true`.
CustomerID *string `json:"customer_id,omitempty" url:"-"`
// A description of the reason for the refund.
Reason *string `json:"reason,omitempty" url:"-"`
// Used for optimistic concurrency. This opaque token identifies the current `Payment`
//
// version that the caller expects. If the server has a different version of the Payment,
// the update fails and a response with a VERSION_MISMATCH error is returned.
// If the versions match, or the field is not provided, the refund proceeds as normal.
PaymentVersionToken *string `json:"payment_version_token,omitempty" url:"-"`
// An optional [TeamMember](entity:TeamMember) ID to associate with this refund.
TeamMemberID *string `json:"team_member_id,omitempty" url:"-"`
// Additional details required when recording an unlinked cash refund (`destination_id` is CASH).
CashDetails *DestinationDetailsCashRefundDetails `json:"cash_details,omitempty" url:"-"`
// Additional details required when recording an unlinked external refund
// (`destination_id` is EXTERNAL).
ExternalDetails *DestinationDetailsExternalRefundDetails `json:"external_details,omitempty" url:"-"`
}
type RefundsGetRequest struct {
// The unique ID for the desired `PaymentRefund`.
RefundID string `json:"-" url:"-"`
}
type RefundsListRequest struct {
// Indicates the start of the time range to retrieve each `PaymentRefund` for, in RFC 3339
// format. The range is determined using the `created_at` field for each `PaymentRefund`.
//
// Default: The current time minus one year.
BeginTime *string `json:"-" url:"begin_time,omitempty"`
// Indicates the end of the time range to retrieve each `PaymentRefund` for, in RFC 3339
// format. The range is determined using the `created_at` field for each `PaymentRefund`.
//
// Default: The current time.
EndTime *string `json:"-" url:"end_time,omitempty"`
// The order in which results are listed by `PaymentRefund.created_at`:
// - `ASC` - Oldest to newest.
// - `DESC` - Newest to oldest (default).
SortOrder *string `json:"-" url:"sort_order,omitempty"`
// A pagination cursor returned by a previous call to this endpoint.
// Provide this cursor to retrieve the next set of results for the original query.
//
// For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
Cursor *string `json:"-" url:"cursor,omitempty"`
// Limit results to the location supplied. By default, results are returned
// for all locations associated with the seller.
LocationID *string `json:"-" url:"location_id,omitempty"`
// If provided, only refunds with the given status are returned.
// For a list of refund status values, see [PaymentRefund](entity:PaymentRefund).
//
// Default: If omitted, refunds are returned regardless of their status.
Status *string `json:"-" url:"status,omitempty"`
// If provided, only returns refunds whose payments have the indicated source type.
// Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `CASH`, and `EXTERNAL`.
// For information about these payment source types, see
// [Take Payments](https://developer.squareup.com/docs/payments-api/take-payments).
//
// Default: If omitted, refunds are returned regardless of the source type.
SourceType *string `json:"-" url:"source_type,omitempty"`
// The maximum number of results to be returned in a single page.
//
// It is possible to receive fewer results than the specified limit on a given page.
//
// If the supplied value is greater than 100, no more than 100 results are returned.
//
// Default: 100
Limit *int `json:"-" url:"limit,omitempty"`
}
// Details about a refund's destination.
type DestinationDetails struct {
// Details about a card refund. Only populated if the destination_type is `CARD`.
CardDetails *DestinationDetailsCardRefundDetails `json:"card_details,omitempty" url:"card_details,omitempty"`
// Details about a cash refund. Only populated if the destination_type is `CASH`.
CashDetails *DestinationDetailsCashRefundDetails `json:"cash_details,omitempty" url:"cash_details,omitempty"`
// Details about an external refund. Only populated if the destination_type is `EXTERNAL`.
ExternalDetails *DestinationDetailsExternalRefundDetails `json:"external_details,omitempty" url:"external_details,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (d *DestinationDetails) GetCardDetails() *DestinationDetailsCardRefundDetails {
if d == nil {
return nil
}
return d.CardDetails
}
func (d *DestinationDetails) GetCashDetails() *DestinationDetailsCashRefundDetails {
if d == nil {
return nil
}
return d.CashDetails
}
func (d *DestinationDetails) GetExternalDetails() *DestinationDetailsExternalRefundDetails {
if d == nil {
return nil
}
return d.ExternalDetails
}
func (d *DestinationDetails) GetExtraProperties() map[string]interface{} {
return d.extraProperties
}
func (d *DestinationDetails) UnmarshalJSON(data []byte) error {
type unmarshaler DestinationDetails
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*d = DestinationDetails(value)
extraProperties, err := internal.ExtractExtraProperties(data, *d)
if err != nil {
return err
}
d.extraProperties = extraProperties
d.rawJSON = json.RawMessage(data)
return nil
}
func (d *DestinationDetails) String() string {
if len(d.rawJSON) > 0 {
if value, err := internal.StringifyJSON(d.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(d); err == nil {
return value
}
return fmt.Sprintf("%#v", d)
}
type DestinationDetailsCardRefundDetails struct {
// The card's non-confidential details.
Card *Card `json:"card,omitempty" url:"card,omitempty"`
// The method used to enter the card's details for the refund. The method can be
// `KEYED`, `SWIPED`, `EMV`, `ON_FILE`, or `CONTACTLESS`.
EntryMethod *string `json:"entry_method,omitempty" url:"entry_method,omitempty"`
// The authorization code provided by the issuer when a refund is approved.
AuthResultCode *string `json:"auth_result_code,omitempty" url:"auth_result_code,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (d *DestinationDetailsCardRefundDetails) GetCard() *Card {
if d == nil {
return nil
}
return d.Card
}
func (d *DestinationDetailsCardRefundDetails) GetEntryMethod() *string {
if d == nil {
return nil
}
return d.EntryMethod
}
func (d *DestinationDetailsCardRefundDetails) GetAuthResultCode() *string {
if d == nil {
return nil
}
return d.AuthResultCode
}
func (d *DestinationDetailsCardRefundDetails) GetExtraProperties() map[string]interface{} {
return d.extraProperties
}
func (d *DestinationDetailsCardRefundDetails) UnmarshalJSON(data []byte) error {
type unmarshaler DestinationDetailsCardRefundDetails
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*d = DestinationDetailsCardRefundDetails(value)
extraProperties, err := internal.ExtractExtraProperties(data, *d)
if err != nil {
return err
}
d.extraProperties = extraProperties
d.rawJSON = json.RawMessage(data)
return nil
}
func (d *DestinationDetailsCardRefundDetails) String() string {
if len(d.rawJSON) > 0 {
if value, err := internal.StringifyJSON(d.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(d); err == nil {
return value
}
return fmt.Sprintf("%#v", d)
}
// Stores details about a cash refund. Contains only non-confidential information.
type DestinationDetailsCashRefundDetails struct {
// The amount and currency of the money supplied by the seller.
SellerSuppliedMoney *Money `json:"seller_supplied_money,omitempty" url:"seller_supplied_money,omitempty"`
// The amount of change due back to the seller.
// This read-only field is calculated
// from the `amount_money` and `seller_supplied_money` fields.
ChangeBackMoney *Money `json:"change_back_money,omitempty" url:"change_back_money,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (d *DestinationDetailsCashRefundDetails) GetSellerSuppliedMoney() *Money {
if d == nil {
return nil
}
return d.SellerSuppliedMoney
}
func (d *DestinationDetailsCashRefundDetails) GetChangeBackMoney() *Money {
if d == nil {
return nil
}
return d.ChangeBackMoney
}
func (d *DestinationDetailsCashRefundDetails) GetExtraProperties() map[string]interface{} {
return d.extraProperties
}
func (d *DestinationDetailsCashRefundDetails) UnmarshalJSON(data []byte) error {
type unmarshaler DestinationDetailsCashRefundDetails
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*d = DestinationDetailsCashRefundDetails(value)
extraProperties, err := internal.ExtractExtraProperties(data, *d)
if err != nil {
return err
}
d.extraProperties = extraProperties
d.rawJSON = json.RawMessage(data)
return nil
}
func (d *DestinationDetailsCashRefundDetails) String() string {
if len(d.rawJSON) > 0 {
if value, err := internal.StringifyJSON(d.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(d); err == nil {
return value
}
return fmt.Sprintf("%#v", d)
}
// Stores details about an external refund. Contains only non-confidential information.
type DestinationDetailsExternalRefundDetails struct {
// The type of external refund the seller paid to the buyer. It can be one of the
// following:
// - CHECK - Refunded using a physical check.
// - BANK_TRANSFER - Refunded using external bank transfer.
// - OTHER\_GIFT\_CARD - Refunded using a non-Square gift card.
// - CRYPTO - Refunded using a crypto currency.
// - SQUARE_CASH - Refunded using Square Cash App.
// - SOCIAL - Refunded using peer-to-peer payment applications.
// - EXTERNAL - A third-party application gathered this refund outside of Square.
// - EMONEY - Refunded using an E-money provider.
// - CARD - A credit or debit card that Square does not support.
// - STORED_BALANCE - Use for house accounts, store credit, and so forth.
// - FOOD_VOUCHER - Restaurant voucher provided by employers to employees to pay for meals
// - OTHER - A type not listed here.
Type string `json:"type" url:"type"`
// A description of the external refund source. For example,
// "Food Delivery Service".
Source string `json:"source" url:"source"`
// An ID to associate the refund to its originating source.
SourceID *string `json:"source_id,omitempty" url:"source_id,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (d *DestinationDetailsExternalRefundDetails) GetType() string {
if d == nil {
return ""
}
return d.Type
}
func (d *DestinationDetailsExternalRefundDetails) GetSource() string {
if d == nil {
return ""
}
return d.Source
}
func (d *DestinationDetailsExternalRefundDetails) GetSourceID() *string {
if d == nil {
return nil
}
return d.SourceID
}
func (d *DestinationDetailsExternalRefundDetails) GetExtraProperties() map[string]interface{} {
return d.extraProperties
}
func (d *DestinationDetailsExternalRefundDetails) UnmarshalJSON(data []byte) error {
type unmarshaler DestinationDetailsExternalRefundDetails
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*d = DestinationDetailsExternalRefundDetails(value)
extraProperties, err := internal.ExtractExtraProperties(data, *d)
if err != nil {
return err
}
d.extraProperties = extraProperties
d.rawJSON = json.RawMessage(data)
return nil
}
func (d *DestinationDetailsExternalRefundDetails) String() string {
if len(d.rawJSON) > 0 {
if value, err := internal.StringifyJSON(d.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(d); err == nil {
return value
}
return fmt.Sprintf("%#v", d)
}
// Defines the response returned by [GetRefund](api-endpoint:Refunds-GetPaymentRefund).
//
// Note: If there are errors processing the request, the refund field might not be
// present or it might be present in a FAILED state.
type GetPaymentRefundResponse struct {
// Information about errors encountered during the request.
Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"`
// The requested `PaymentRefund`.
Refund *PaymentRefund `json:"refund,omitempty" url:"refund,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (g *GetPaymentRefundResponse) GetErrors() []*Error {
if g == nil {
return nil
}
return g.Errors
}
func (g *GetPaymentRefundResponse) GetRefund() *PaymentRefund {
if g == nil {
return nil
}
return g.Refund
}
func (g *GetPaymentRefundResponse) GetExtraProperties() map[string]interface{} {
return g.extraProperties
}
func (g *GetPaymentRefundResponse) UnmarshalJSON(data []byte) error {
type unmarshaler GetPaymentRefundResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*g = GetPaymentRefundResponse(value)
extraProperties, err := internal.ExtractExtraProperties(data, *g)
if err != nil {
return err
}
g.extraProperties = extraProperties
g.rawJSON = json.RawMessage(data)
return nil
}
func (g *GetPaymentRefundResponse) String() string {
if len(g.rawJSON) > 0 {
if value, err := internal.StringifyJSON(g.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(g); err == nil {
return value
}
return fmt.Sprintf("%#v", g)
}
// Defines the response returned by [ListPaymentRefunds](api-endpoint:Refunds-ListPaymentRefunds).
//
// Either `errors` or `refunds` is present in a given response (never both).
type ListPaymentRefundsResponse struct {
// Information about errors encountered during the request.
Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"`
// The list of requested refunds.
Refunds []*PaymentRefund `json:"refunds,omitempty" url:"refunds,omitempty"`
// The pagination cursor to be used in a subsequent request. If empty,
// this is the final response.
//
// For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).
Cursor *string `json:"cursor,omitempty" url:"cursor,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (l *ListPaymentRefundsResponse) GetErrors() []*Error {
if l == nil {
return nil
}
return l.Errors
}
func (l *ListPaymentRefundsResponse) GetRefunds() []*PaymentRefund {
if l == nil {
return nil
}
return l.Refunds
}
func (l *ListPaymentRefundsResponse) GetCursor() *string {
if l == nil {
return nil
}
return l.Cursor
}
func (l *ListPaymentRefundsResponse) GetExtraProperties() map[string]interface{} {
return l.extraProperties
}
func (l *ListPaymentRefundsResponse) UnmarshalJSON(data []byte) error {
type unmarshaler ListPaymentRefundsResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*l = ListPaymentRefundsResponse(value)
extraProperties, err := internal.ExtractExtraProperties(data, *l)
if err != nil {
return err
}
l.extraProperties = extraProperties
l.rawJSON = json.RawMessage(data)
return nil
}
func (l *ListPaymentRefundsResponse) String() string {
if len(l.rawJSON) > 0 {
if value, err := internal.StringifyJSON(l.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(l); err == nil {
return value
}
return fmt.Sprintf("%#v", l)
}
// Represents a refund of a payment made using Square. Contains information about
// the original payment and the amount of money refunded.
type PaymentRefund struct {
// The unique ID for this refund, generated by Square.
ID string `json:"id" url:"id"`
// The refund's status:
// - `PENDING` - Awaiting approval.
// - `COMPLETED` - Successfully completed.
// - `REJECTED` - The refund was rejected.
// - `FAILED` - An error occurred.
Status *string `json:"status,omitempty" url:"status,omitempty"`
// The location ID associated with the payment this refund is attached to.
LocationID *string `json:"location_id,omitempty" url:"location_id,omitempty"`
// Flag indicating whether or not the refund is linked to an existing payment in Square.
Unlinked *bool `json:"unlinked,omitempty" url:"unlinked,omitempty"`
// The destination type for this refund.
//
// Current values include `CARD`, `BANK_ACCOUNT`, `WALLET`, `BUY_NOW_PAY_LATER`, `CASH`,
// `EXTERNAL`, and `SQUARE_ACCOUNT`.
DestinationType *string `json:"destination_type,omitempty" url:"destination_type,omitempty"`
// Contains information about the refund destination. This field is populated only if
// `destination_id` is defined in the `RefundPayment` request.
DestinationDetails *DestinationDetails `json:"destination_details,omitempty" url:"destination_details,omitempty"`
// The amount of money refunded. This amount is specified in the smallest denomination
// of the applicable currency (for example, US dollar amounts are specified in cents).
AmountMoney *Money `json:"amount_money,omitempty" url:"amount_money,omitempty"`
// The amount of money the application developer contributed to help cover the refunded amount.
// This amount is specified in the smallest denomination of the applicable currency (for example,
// US dollar amounts are specified in cents). For more information, see
// [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts).
AppFeeMoney *Money `json:"app_fee_money,omitempty" url:"app_fee_money,omitempty"`
// Processing fees and fee adjustments assessed by Square for this refund.
ProcessingFee []*ProcessingFee `json:"processing_fee,omitempty" url:"processing_fee,omitempty"`
// The ID of the payment associated with this refund.
PaymentID *string `json:"payment_id,omitempty" url:"payment_id,omitempty"`
// The ID of the order associated with the refund.
OrderID *string `json:"order_id,omitempty" url:"order_id,omitempty"`
// The reason for the refund.
Reason *string `json:"reason,omitempty" url:"reason,omitempty"`
// The timestamp of when the refund was created, in RFC 3339 format.
CreatedAt *string `json:"created_at,omitempty" url:"created_at,omitempty"`
// The timestamp of when the refund was last updated, in RFC 3339 format.
UpdatedAt *string `json:"updated_at,omitempty" url:"updated_at,omitempty"`
// An optional ID of the team member associated with taking the payment.
TeamMemberID *string `json:"team_member_id,omitempty" url:"team_member_id,omitempty"`
// An optional ID for a Terminal refund.
TerminalRefundID *string `json:"terminal_refund_id,omitempty" url:"terminal_refund_id,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (p *PaymentRefund) GetID() string {
if p == nil {
return ""
}
return p.ID
}
func (p *PaymentRefund) GetStatus() *string {
if p == nil {
return nil
}
return p.Status
}
func (p *PaymentRefund) GetLocationID() *string {
if p == nil {
return nil
}
return p.LocationID
}
func (p *PaymentRefund) GetUnlinked() *bool {
if p == nil {
return nil
}
return p.Unlinked
}
func (p *PaymentRefund) GetDestinationType() *string {
if p == nil {
return nil
}
return p.DestinationType
}
func (p *PaymentRefund) GetDestinationDetails() *DestinationDetails {
if p == nil {
return nil
}
return p.DestinationDetails
}
func (p *PaymentRefund) GetAmountMoney() *Money {
if p == nil {
return nil
}
return p.AmountMoney
}
func (p *PaymentRefund) GetAppFeeMoney() *Money {
if p == nil {
return nil
}
return p.AppFeeMoney
}
func (p *PaymentRefund) GetProcessingFee() []*ProcessingFee {
if p == nil {
return nil
}
return p.ProcessingFee
}
func (p *PaymentRefund) GetPaymentID() *string {
if p == nil {
return nil
}
return p.PaymentID
}
func (p *PaymentRefund) GetOrderID() *string {
if p == nil {
return nil
}
return p.OrderID
}
func (p *PaymentRefund) GetReason() *string {
if p == nil {
return nil
}
return p.Reason
}
func (p *PaymentRefund) GetCreatedAt() *string {
if p == nil {
return nil
}
return p.CreatedAt
}
func (p *PaymentRefund) GetUpdatedAt() *string {
if p == nil {
return nil
}
return p.UpdatedAt
}
func (p *PaymentRefund) GetTeamMemberID() *string {
if p == nil {
return nil
}
return p.TeamMemberID
}
func (p *PaymentRefund) GetTerminalRefundID() *string {
if p == nil {
return nil
}
return p.TerminalRefundID
}
func (p *PaymentRefund) GetExtraProperties() map[string]interface{} {
return p.extraProperties
}
func (p *PaymentRefund) UnmarshalJSON(data []byte) error {
type unmarshaler PaymentRefund
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*p = PaymentRefund(value)
extraProperties, err := internal.ExtractExtraProperties(data, *p)
if err != nil {
return err
}
p.extraProperties = extraProperties
p.rawJSON = json.RawMessage(data)
return nil
}
func (p *PaymentRefund) String() string {
if len(p.rawJSON) > 0 {
if value, err := internal.StringifyJSON(p.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(p); err == nil {
return value
}
return fmt.Sprintf("%#v", p)
}
// Defines the response returned by
// [RefundPayment](api-endpoint:Refunds-RefundPayment).
//
// If there are errors processing the request, the `refund` field might not be
// present, or it might be present with a status of `FAILED`.
type RefundPaymentResponse struct {
// Information about errors encountered during the request.
Errors []*Error `json:"errors,omitempty" url:"errors,omitempty"`
// The successfully created `PaymentRefund`.
Refund *PaymentRefund `json:"refund,omitempty" url:"refund,omitempty"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (r *RefundPaymentResponse) GetErrors() []*Error {
if r == nil {
return nil
}
return r.Errors
}
func (r *RefundPaymentResponse) GetRefund() *PaymentRefund {
if r == nil {
return nil
}
return r.Refund
}
func (r *RefundPaymentResponse) GetExtraProperties() map[string]interface{} {
return r.extraProperties
}
func (r *RefundPaymentResponse) UnmarshalJSON(data []byte) error {
type unmarshaler RefundPaymentResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*r = RefundPaymentResponse(value)
extraProperties, err := internal.ExtractExtraProperties(data, *r)
if err != nil {
return err
}
r.extraProperties = extraProperties
r.rawJSON = json.RawMessage(data)
return nil
}
func (r *RefundPaymentResponse) String() string {
if len(r.rawJSON) > 0 {
if value, err := internal.StringifyJSON(r.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(r); err == nil {
return value
}
return fmt.Sprintf("%#v", r)
}