Skip to content

Commit eccb693

Browse files
authored
fix: adding currency property to events (#110)
1 parent 1dbf0ee commit eccb693

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
46
zipStoreBase=GRADLE_USER_HOME
57
zipStorePath=wrapper/dists

src/main/java/com/amplitude/Event.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ public class Event {
144144
*/
145145
public String revenueType;
146146

147+
/**
148+
* The 3 letter revenue currency code for the item purchased.
149+
*/
150+
public String currency;
151+
147152
/**
148153
* An incrementing counter to distinguish events with the same user_id and timestamp from each
149154
* other. We recommend you send an event_id, increasing over time, especially if you expect events
@@ -271,6 +276,7 @@ public JSONObject toJsonObject() {
271276
event.put("revenue", revenue);
272277
event.put("productId", productId);
273278
event.put("revenueType", revenueType);
279+
event.put("currency", currency);
274280
}
275281

276282
event.put("event_id", replaceWithJSONNull(eventId));

src/test/java/com/amplitude/EventTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public void testLogEventWithRevenue() {
7676
event.price = price;
7777
event.productId = productId;
7878
event.revenueType = revenueType;
79+
event.currency = "USD";
7980

8081
JSONObject truncatedEvent = event.toJsonObject();
8182
assertEquals(eventType, truncatedEvent.getString("event_type"));
@@ -85,6 +86,7 @@ public void testLogEventWithRevenue() {
8586
assertEquals(quantity, truncatedEvent.getInt("quantity"));
8687
assertEquals(productId, truncatedEvent.getString("productId"));
8788
assertEquals(revenueType, truncatedEvent.getString("revenueType"));
89+
assertEquals("USD", truncatedEvent.getString("currency"));
8890
}
8991

9092
@Test

0 commit comments

Comments
 (0)