Skip to content

Commit cdc0a0c

Browse files
authored
Add support for shop services (APPS-1039) (#220)
1 parent 24dc316 commit cdc0a0c

File tree

3 files changed

+56
-2
lines changed

3 files changed

+56
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ All notable changes to this project will be documented in this file.
77
### Removed
88
### Fixed
99

10+
## [0.79.0]
11+
### Added
12+
* core: Add the shop services from meta data to Shop class
13+
1014
## [0.78.0]
1115
### Added
1216
* core: Add the `isSuccessful` state to orders/receipts

core/src/main/java/io/snabble/sdk/Shop.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ public String toString() {
162162
private CustomerNetwork[] customerNetworks;
163163
private OpeningHourSpecification[] openingHoursSpecification;
164164
private JsonElement external;
165+
@SerializedName("shopServices")
166+
private ShopServices[] shopServices;
165167

166168
Shop() {
167169
// for gson
@@ -299,6 +301,14 @@ public JsonElement getExternal() {
299301
return external;
300302
}
301303

304+
/**
305+
* Returns the shop related on-site services for the customer
306+
*/
307+
@NonNull
308+
public ShopServices[] getShopServices() {
309+
return shopServices;
310+
}
311+
302312
static Shop[] fromJson(JsonElement json) {
303313
try {
304314
return GsonHolder.get().fromJson(json, Shop[].class);
@@ -329,7 +339,8 @@ public boolean equals(Object o) {
329339
Objects.equals(links, shop.links) &&
330340
Arrays.equals(customerNetworks, shop.customerNetworks) &&
331341
Arrays.equals(openingHoursSpecification, shop.openingHoursSpecification) &&
332-
Objects.equals(external, shop.external);
342+
Objects.equals(external, shop.external) &&
343+
Arrays.equals(shopServices, shop.shopServices);
333344
}
334345

335346
@Override
@@ -338,6 +349,7 @@ public int hashCode() {
338349
result = 31 * result + Arrays.hashCode(services);
339350
result = 31 * result + Arrays.hashCode(customerNetworks);
340351
result = 31 * result + Arrays.hashCode(openingHoursSpecification);
352+
result = 31 * result + Arrays.hashCode(shopServices);
341353
return result;
342354
}
343355

@@ -369,6 +381,7 @@ public String toString() {
369381
", customerNetworks=" + Arrays.toString(customerNetworks) +
370382
", openingHoursSpecification=" + Arrays.toString(openingHoursSpecification) +
371383
", external=" + external +
384+
", shopServices=" + Arrays.toString(shopServices) +
372385
'}';
373386
}
374387

@@ -401,4 +414,4 @@ public Shop[] newArray(int size) {
401414
return new Shop[size];
402415
}
403416
};
404-
}
417+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package io.snabble.sdk
2+
3+
import com.google.gson.annotations.SerializedName
4+
5+
/**
6+
* Shop related on-site services
7+
*/
8+
data class ShopServices(
9+
/**
10+
* Url for the service related icon.
11+
*
12+
* The URL might be empty!
13+
*/
14+
@SerializedName("iconURL") val iconPath: String,
15+
16+
/**
17+
* Descriptions for the services in the language de and en.
18+
*/
19+
@SerializedName("translations") val descriptions: Descriptions,
20+
) {
21+
22+
data class Descriptions(
23+
/**
24+
* Description in the language de.
25+
*
26+
* This value might be empty!
27+
*/
28+
@SerializedName("de") val german: String?,
29+
30+
/**
31+
* Description in the language en.
32+
*
33+
* This value might be empty!
34+
*/
35+
@SerializedName("en") val english: String?
36+
)
37+
}

0 commit comments

Comments
 (0)