forked from braintree-go/braintree-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
disbursement.go
49 lines (41 loc) · 1.48 KB
/
disbursement.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
package braintree
import (
"context"
"encoding/xml"
"github.com/braintree-go/braintree-go/date"
)
type Disbursement struct {
XMLName xml.Name `xml:"disbursement"`
Id string `xml:"id"`
ExceptionMessage string `xml:"exception-message"`
DisbursementDate *date.Date `xml:"disbursement-date"`
FollowUpAction string `xml:"follow-up-action"`
Success bool `xml:"success"`
Retry bool `xml:"retry"`
Amount *Decimal `xml:"amount"`
MerchantAccount *MerchantAccount `xml:"merchant-account"`
CurrencyIsoCode string `xml:"currency-iso-code"`
SubmerchantAccount bool `xml:"sub-merchant-account"`
Status string `xml:"status"`
TransactionIds []string `xml:"transaction-ids>item"`
}
const (
// Exception messages
BankRejected = "bank_rejected"
InsufficientFunds = "insuffient_funds"
AccountNotAuthorized = "account_not_authorized"
// Followup actions
ContactUs = "contact_us"
UpdateFundingInformation = "update_funding_information"
None = "none"
)
func (d *Disbursement) Transactions(ctx context.Context, g *TransactionGateway) (*TransactionSearchResult, error) {
query := new(SearchQuery)
f := query.AddMultiField("ids")
f.Items = d.TransactionIds
result, err := g.Search(ctx, query)
if err != nil {
return nil, err
}
return result, err
}