-
Notifications
You must be signed in to change notification settings - Fork 45
/
payments.go
51 lines (45 loc) · 1.8 KB
/
payments.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
package webhooks
import (
"encoding/xml"
"github.com/blacklightcms/recurly"
)
// Payment notifications.
// https://dev.recurly.com/page/webhooks#payment-notifications
const (
SuccessfulPayment = "successful_payment_notification"
FailedPayment = "failed_payment_notification"
VoidPayment = "void_payment_notification"
SuccessfulRefund = "successful_refund_notification"
ScheduledPayment = "scheduled_payment_notification"
ProcessingPayment = "processing_payment_notification"
)
// PaymentNotification is returned for all credit payment notifications.
type PaymentNotification struct {
Type string `xml:"-"`
Account Account `xml:"account"`
Transaction Transaction `xml:"transaction"`
}
// Transaction represents the transaction object sent in webhooks.
type Transaction struct {
XMLName xml.Name `xml:"transaction"`
UUID string `xml:"id"`
InvoiceNumber int `xml:"invoice_number"`
SubscriptionUUID string `xml:"subscription_id"`
Action string `xml:"action"`
PaymentMethod string `xml:"payment_method"`
AmountInCents int `xml:"amount_in_cents"`
Status string `xml:"status"`
Message string `xml:"message"`
GatewayErrorCodes string `xml:"gateway_error_codes"`
FailureType string `xml:"failure_type"`
Reference string `xml:"reference"`
Source string `xml:"source"`
Test recurly.NullBool `xml:"test"`
Voidable recurly.NullBool `xml:"voidable"`
Refundable recurly.NullBool `xml:"refundable"`
}
// Transaction constants.
const (
TransactionFailureTypeDeclined = "declined"
TransactionFailureTypeDuplicate = "duplicate_transaction"
)