forked from xendit/xendit-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinvoice.go
123 lines (112 loc) · 7.04 KB
/
invoice.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
package xendit
import "time"
// Invoice contains data from Xendit's API response of invoice related requests.
// For more API details see https://xendit.github.io/apireference/?bash#invoices.
// For documentation of subpackage invoice, checkout https://pkg.go.dev/github.com/xendit/xendit-go/invoice
type Invoice struct {
ID string `json:"id"`
InvoiceURL string `json:"invoice_url"`
UserID string `json:"user_id,omitempty"`
ExternalID string `json:"external_id"`
Status string `json:"status"`
MerchantName string `json:"merchant_name"`
MerchantProfilePictureURL string `json:"merchant_profile_picture_url,omitempty"`
Amount float64 `json:"amount"`
Locale string `json:"locale,omitempty"`
Items []InvoiceItem `json:"items,omitempty"`
Fees []InvoiceFee `json:"fees,omitempty"`
PayerEmail string `json:"payer_email,omitempty"`
Description string `json:"description,omitempty"`
ExpiryDate *time.Time `json:"expiry_date"`
Customer InvoiceCustomer `json:"customer,omitempty"`
CustomerNotificationPreference InvoiceCustomerNotificationPreference `json:"customer_notification_preference,omitempty"`
AvailableBanks []InvoiceBank `json:"available_banks,omitempty"`
AvailableEWallets []InvoiceEWallet `json:"available_ewallets,omitempty"`
AvailableRetailOutlets []InvoiceRetailOutlet `json:"available_retail_outlets,omitempty"`
ReminderDate *time.Time `json:"reminder_date,omitempty"`
FixedVA bool `json:"fixed_va,omitempty"`
MidLabel string `json:"mid_label,omitempty"`
ShouldExcludeCreditCard bool `json:"should_exclude_credit_card,omitempty"`
ShouldAuthenticateCreditCard bool `json:"should_authenticate_credit_card,omitempty"`
ShouldSendEmail bool `json:"should_send_email"`
Created *time.Time `json:"created"`
Updated *time.Time `json:"updated"`
Currency string `json:"currency,omitempty"`
PaidAt *time.Time `json:"paid_at,omitempty"`
PaymentMethod string `json:"payment_method,omitempty"`
PaymentChannel string `json:"payment_channel,omitempty"`
PaymentDestination string `json:"payment_destination,omitempty"`
PaymentDetail InvoicePaymentDetail `json:"payment_details,omitempty"`
SuccessRedirectURL string `json:"success_redirect_url,omitempty"`
FailureRedirectURL string `json:"failure_redirect_url,omitempty"`
RecurringPaymentID string `json:"recurring_payment_id,omitempty"`
CreditCardChargeID string `json:"credit_card_charge_id,omitempty"`
AdjustedReceivedAmount float64 `json:"adjusted_received_amount,omitempty"`
//deprecated
BankCode string `json:"bank_code,omitempty"`
PaidAmount float64 `json:"paid_amount,omitempty"`
}
// InvoiceBank is data that contained in `Invoice` at AvailableBanks
type InvoiceBank struct {
BankCode string `json:"bank_code"`
CollectionType string `json:"collection_type"`
BankAccountNumber string `json:"bank_account_number"`
TransferAmount float64 `json:"transfer_amount"`
BankBranch string `json:"bank_branch"`
AccountHolderName string `json:"account_holder_name"`
IdentityAmount int `json:"identity_amount"`
}
// InvoiceEWallet is data that contained in `Invoice` at AvailableEWallets
type InvoiceEWallet struct {
EWalletType string `json:"ewallet_type"`
}
// InvoiceRetailOutlet is data that contained in `Invoice` at AvailableRetailOutlets
type InvoiceRetailOutlet struct {
RetailOutletName string `json:"retail_outlet_name"`
//WILL BE DEPRECATED SOON
PaymentCode string `json:"payment_code,omitempty"`
//WILL BE DEPRECATED SOON
TransferAmount float64 `json:"transfer_amount,omitempty"`
MerchantName string `json:"merchant_name,omitempty"`
}
// InvoiceItem is data that contained in `Invoice` at Items
type InvoiceItem struct {
Name string `json:"name" validate:"required"`
Price float64 `json:"price" validate:"required"`
Quantity int `json:"quantity" validate:"required"`
Category string `json:"category,omitempty"`
Url string `json:"url,omitempty"`
}
// InvoiceCustomer is data that contained in `Invoice` at Customer
type InvoiceCustomer struct {
GivenNames string `json:"given_names,omitempty"`
Surname string `json:"surname,omitempty"`
Email string `json:"email,omitempty"`
MobileNumber string `json:"mobile_number,omitempty"`
Address []InvoiceCustomerAddress `json:"addresses,omitempty"`
}
type InvoiceCustomerAddress struct {
City string `json:"city,omitempty"`
Country string `json:"country,omitempty"`
PostalCode string `json:"postal_code,omitempty"`
State string `json:"state,omitempty"`
StreetLine1 string `json:"street_line1,omitempty"`
StreetLine2 string `json:"street_line2,omitempty"`
}
// InvoiceCustomerNotificationPreference is data that contained in `Invoice` at CustomerNotificationPreference
type InvoiceCustomerNotificationPreference struct {
InvoiceCreated []string `json:"invoice_created,omitempty"`
InvoiceReminder []string `json:"invoice_reminder,omitempty"`
InvoicePaid []string `json:"invoice_paid,omitempty"`
InvoiceExpired []string `json:"invoice_expired,omitempty"`
}
// InvoiceFee is data that contained in `Invoice` at Fees
type InvoiceFee struct {
Type string `json:"type" validate:"required"`
Value float64 `json:"value" validate:"required"`
}
// InvoicePaymentDetail is data that contained in `Invoice` at PaymentDetail
type InvoicePaymentDetail struct {
ReceiptID string `json:"receipt_id,omitempty"`
Source string `json:"source,omitempty"`
}