forked from apple/app-store-server-library-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request apple#53 from alexanderjordanbaker/AppStoreServerA…
…PI110 Updating new fields added in App Store Server API v1.10
- Loading branch information
Showing
4 changed files
with
154 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/main/java/com/apple/itunes/storekit/model/OfferDiscountType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright (c) 2023 Apple Inc. Licensed under MIT License. | ||
|
||
package com.apple.itunes.storekit.model; | ||
|
||
import com.google.gson.TypeAdapter; | ||
import com.google.gson.annotations.JsonAdapter; | ||
import com.google.gson.stream.JsonReader; | ||
import com.google.gson.stream.JsonWriter; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* The payment mode you configure for an introductory offer, promotional offer, or offer code on an auto-renewable subscription. | ||
* | ||
* @see <a href="https://developer.apple.com/documentation/appstoreserverapi/offerdiscounttype">offerDiscountType</a> | ||
*/ | ||
@JsonAdapter(OfferDiscountType.Adapter.class) | ||
public enum OfferDiscountType { | ||
|
||
FREE_TRIAL("FREE_TRIAL"), | ||
PAY_AS_YOU_GO("PAY_AS_YOU_GO"), | ||
PAY_UP_FRONT("PAY_UP_FRONT"); | ||
|
||
private final String value; | ||
|
||
OfferDiscountType(String value) { | ||
this.value = value; | ||
} | ||
|
||
public static OfferDiscountType fromValue(String value) { | ||
for (OfferDiscountType b : OfferDiscountType.values()) { | ||
if (b.value.equals(value)) { | ||
return b; | ||
} | ||
} | ||
throw new IllegalArgumentException("Unexpected value '" + value + "'"); | ||
} | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return String.valueOf(value); | ||
} | ||
|
||
public static class Adapter extends TypeAdapter<OfferDiscountType> { | ||
@Override | ||
public void write(final JsonWriter jsonWriter, final OfferDiscountType enumeration) throws IOException { | ||
jsonWriter.value(enumeration.getValue()); | ||
} | ||
|
||
@Override | ||
public OfferDiscountType read(final JsonReader jsonReader) throws IOException { | ||
String value = jsonReader.nextString(); | ||
return OfferDiscountType.fromValue(value); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters