diff --git a/CHANGELOG.md b/CHANGELOG.md index 1eb18b81e..5d6be4a44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Added `@JsonCreator` annotation to webhook classes' `fromJson(String)` method - Added `app_id` to `com.vonage.client.numbers.OwnedNumber` - Fixed Viber Video message TTL field being set incorrectly +- Fixed incorrect serialisation of outbound WhatsApp Location message - Added end-to-end encryption support for Video sessions - Added `leg_persistence_time` to Application Voice capability - Added `signed_callbacks` to Application RTC capability diff --git a/src/main/java/com/vonage/client/messages/whatsapp/Location.java b/src/main/java/com/vonage/client/messages/whatsapp/Location.java index 0e0396bc9..fceea9ec6 100644 --- a/src/main/java/com/vonage/client/messages/whatsapp/Location.java +++ b/src/main/java/com/vonage/client/messages/whatsapp/Location.java @@ -15,6 +15,7 @@ */ package com.vonage.client.messages.whatsapp; +import com.fasterxml.jackson.annotation.JsonAlias; import com.fasterxml.jackson.annotation.JsonProperty; import com.vonage.client.JsonableBaseObject; @@ -39,12 +40,14 @@ public final class Location extends JsonableBaseObject { address = builder.address; } - @JsonProperty("lat") + @JsonAlias("lat") + @JsonProperty("latitude") public double getLatitude() { return latitude; } - @JsonProperty("long") + @JsonAlias("long") + @JsonProperty("longitude") public double getLongitude() { return longitude; } diff --git a/src/test/java/com/vonage/client/messages/whatsapp/WhatsappLocationRequestTest.java b/src/test/java/com/vonage/client/messages/whatsapp/WhatsappLocationRequestTest.java index 2833bcb25..a709fffda 100644 --- a/src/test/java/com/vonage/client/messages/whatsapp/WhatsappLocationRequestTest.java +++ b/src/test/java/com/vonage/client/messages/whatsapp/WhatsappLocationRequestTest.java @@ -30,7 +30,8 @@ public void testSerializeAllParams() { .longitude(longitude).latitude(latitude) .build().toJson(); assertTrue(json.contains("\"custom\":{\"type\":\"location\",\"location\":{" + - "\"lat\":"+latitude+",\"long\":"+longitude+",\"name\":\""+name+"\",\"address\":\""+address+"\"}}" + "\"latitude\":"+latitude+",\"longitude\":"+longitude+ + ",\"name\":\""+name+"\",\"address\":\""+address+"\"}}" )); assertTrue(json.contains("\"message_type\":\"custom\"")); assertTrue(json.contains("\"channel\":\"whatsapp\"")); @@ -42,7 +43,7 @@ public void testSerializeRequiredParams() { .longitude(51.5216317).latitude(-0.0890882) .from("317900000002").to("447900000001") .build().toJson(); - assertTrue(json.contains("\"location\":{\"lat\":-0.0890882,\"long\":51.5216317}")); + assertTrue(json.contains("\"location\":{\"latitude\":-0.0890882,\"longitude\":51.5216317}")); assertTrue(json.contains("\"message_type\":\"custom\"")); assertTrue(json.contains("\"channel\":\"whatsapp\"")); }