-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6d2a55e
commit 3fe41ed
Showing
10 changed files
with
362 additions
and
24 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
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
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
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,22 @@ | ||
package recurly | ||
|
||
import "encoding/xml" | ||
|
||
// Purchase represents an individual checkout holding at least one | ||
// subscription OR one adjustment | ||
type Purchase struct { | ||
XMLName xml.Name `xml:"purchase"` | ||
Account Account `xml:"account,omitempty"` | ||
Adjustments []Adjustment `xml:"adjustments>adjustment,omitempty"` | ||
CollectionMethod string `xml:"collection_method,omitempty"` | ||
Currency string `xml:"currency"` | ||
PONumber string `xml:"po_number,omitempty"` | ||
NetTerms NullInt `xml:"net_terms,omitempty"` | ||
GiftCard string `xml:"gift_card>redemption_code,omitempty"` | ||
CouponCodes []string `xml:"coupon_codes>coupon_code,omitempty"` | ||
Subscriptions []NewSubscription `xml:"subscriptions>subscription,omitempty"` | ||
CustomerNotes string `xml:"customer_notes,omitempty"` | ||
TermsAndConditions string `xml:"terms_and_conditions,omitempty"` | ||
VATReverseChargeNotes string `xml:"vat_reverse_charge_notes,omitempty"` | ||
ShippingAddressID int `xml:"shipping_address_id,omitempty"` | ||
} |
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,26 @@ | ||
package recurly | ||
|
||
import ( | ||
"net/http" | ||
) | ||
|
||
var _ PurchasesService = &purchasesImpl{} | ||
|
||
type purchasesImpl struct { | ||
client *Client | ||
} | ||
|
||
func (s *purchasesImpl) Create(p Purchase) (*Response, *InvoiceCollection, error) { | ||
req, err := s.client.newRequest("POST", "purchases", nil, p) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
|
||
var dst InvoiceCollection | ||
resp, err := s.client.do(req, &dst) | ||
if err != nil || resp.StatusCode >= http.StatusBadRequest { | ||
return resp, nil, err | ||
} | ||
|
||
return resp, &dst, err | ||
} |
Oops, something went wrong.