Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adding currency property #68

Merged
merged 2 commits into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions amplitude/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ func (c *client) Revenue(revenue Revenue, eventOptions EventOptions) {
constants.RevenueType: revenue.RevenueType,
constants.RevenueReceipt: revenue.Receipt,
constants.RevenueReceiptSig: revenue.ReceiptSig,
constants.Currency: revenue.Currency,
constants.DefaultRevenue: revenue.Revenue,
},
}
Expand Down
2 changes: 2 additions & 0 deletions amplitude/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ func (t *ClientSuite) TestRevenue() {
Quantity: 45,
ProductID: "product-1",
RevenueType: "revenue-1",
Currency: "USD",
Receipt: "receipt-1",
ReceiptSig: "sig-1",
Revenue: 7,
Expand All @@ -172,6 +173,7 @@ func (t *ClientSuite) TestRevenue() {
"ip": "IP 1",
"city": "IP 1 city",
"event_properties": {
"$currency": "USD",
"$price": 12.3,
"$quantity": 45,
"$productId": "product-1",
Expand Down
1 change: 1 addition & 0 deletions amplitude/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const (
RevenueQuantity = "$quantity"
RevenuePrice = "$price"
RevenueType = "$revenueType"
Currency = "$currency"
RevenueReceipt = "$receipt"
RevenueReceiptSig = "$receiptSig"
DefaultRevenue = "$revenue"
Expand Down
1 change: 1 addition & 0 deletions amplitude/types/event_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type EventOptions struct {
Price float64 `json:"price,omitempty"`
Quantity int `json:"quantity,omitempty"`
Revenue float64 `json:"revenue,omitempty"`
Currency string `json:"currency,omitempty"`
ProductID string `json:"productId,omitempty"`
RevenueType string `json:"revenueType,omitempty"`
EventID int `json:"event_id,omitempty"`
Expand Down
1 change: 1 addition & 0 deletions amplitude/types/revenue.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ type Revenue struct {
Quantity int
ProductID string
RevenueType string
Currency string
Receipt string
ReceiptSig string
Properties map[string]interface{}
Expand Down
Loading