forked from braintree-go/braintree-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Submit For Settlement functionality
- Loading branch information
1 parent
01bf0b7
commit a2b69e6
Showing
4 changed files
with
53 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package braintree | ||
|
||
type Record struct { | ||
XMLName string `xml:"record"` | ||
CardType string `xml:"card-type"` | ||
Count int `xml:"count"` | ||
MerchantAccountId string `xml:"merchant-account_id"` | ||
Kind string `xml:"kind"` | ||
AmountSettled *Decimal `xml:"amount-settled"` | ||
} | ||
|
||
type XMLRecords struct { | ||
XMLName string `xml:"records"` | ||
Type []Record `xml:"record"` | ||
} | ||
type SettlementBatchSummary struct { | ||
XMLName string `xml:"settlement-batch-summary"` | ||
Records XMLRecords `xml:"records"` | ||
} | ||
|
||
type Settlement struct { | ||
XMLName string `xml:"settlement_batch_summary"` | ||
Date string `xml:"settlement_date"` | ||
//CustomField string `xml:group_by_custom_field"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package braintree | ||
|
||
type SettlementGateway struct { | ||
*Braintree | ||
} | ||
|
||
func (sg *SettlementGateway) Generate(s *Settlement) (*SettlementBatchSummary, error) { | ||
resp, err := sg.execute("POST", "settlement_batch_summary", s) | ||
if err != nil { | ||
return nil, err | ||
} | ||
switch resp.StatusCode { | ||
case 200: | ||
return resp.settlement() | ||
} | ||
return nil, &invalidResponseError{resp} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters