Skip to content

Commit

Permalink
Merge pull request #57 from kieter/feature/add-payment-method-to-order
Browse files Browse the repository at this point in the history
Add the payment_method field to Order
  • Loading branch information
wawrzyniec-madej authored Jan 3, 2025
2 parents ed04912 + 6f80e5d commit efc6e52
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions svc_order.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type Order struct {

OrderID string `json:"order_id"`
CardID int64 `json:"card_id"`
PaymentMethod string `json:"payment_method"`
Status string `json:"status"`
SourceLangISO string `json:"source_language_iso"`
TargetLangISOs []string `json:"target_language_isos"`
Expand All @@ -43,6 +44,7 @@ type Order struct {
type CreateOrder struct {
ProjectID string `json:"project_id"`
CardID int64 `json:"card_id"`
PaymentMethod string `json:"payment_method"`
Briefing string `json:"briefing"`
SourceLangISO string `json:"source_language_iso"`
TargetLangISOs []string `json:"target_language_isos"`
Expand Down
10 changes: 8 additions & 2 deletions svc_order_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func TestOrderService_Create(t *testing.T) {
data := `{
"project_id": "` + testProjectID + `",
"card_id": 12345,
"payment_method": "credit_card",
"briefing": "Terms of use of our app.",
"source_language_iso": "en_US",
"target_language_isos": [
Expand All @@ -47,6 +48,7 @@ func TestOrderService_Create(t *testing.T) {
_, _ = fmt.Fprint(w, `{
"order_id": "20181231AAAA",
"project_id": "`+testProjectID+`",
"payment_method": "credit_card",
"card_id": 12345,
"status": "in progress",
"created_at": "2018-12-31 12:00:00 (Etc/UTC)",
Expand Down Expand Up @@ -82,6 +84,7 @@ func TestOrderService_Create(t *testing.T) {

r, err := client.Orders().Create(1, CreateOrder{
ProjectID: testProjectID,
PaymentMethod: "credit_card",
CardID: 12345,
Briefing: "Terms of use of our app.",
SourceLangISO: "en_US",
Expand All @@ -107,6 +110,7 @@ func TestOrderService_Create(t *testing.T) {
CreatedByEmail: "[email protected]",
},
OrderID: "20181231AAAA",
PaymentMethod: "credit_card",
CardID: 12345,
Status: "in progress",
SourceLangISO: "en_US",
Expand Down Expand Up @@ -187,7 +191,8 @@ func TestOrderService_Retrieve(t *testing.T) {
testHeader(t, r, apiTokenHeader, testApiToken)

_, _ = fmt.Fprint(w, `{
"order_id": "20181231AAAA"
"order_id": "20181231AAAA",
"payment_method": "credit_card"
}`)
})

Expand All @@ -197,7 +202,8 @@ func TestOrderService_Retrieve(t *testing.T) {
}

want := Order{
OrderID: "20181231AAAA",
OrderID: "20181231AAAA",
PaymentMethod: "credit_card",
}

if !reflect.DeepEqual(r, want) {
Expand Down

0 comments on commit efc6e52

Please sign in to comment.