Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.apple.itunes.storekit.model.AppTransactionInfoResponse;
import com.apple.itunes.storekit.model.CheckTestNotificationResponse;
import com.apple.itunes.storekit.model.ConsumptionRequest;
import com.apple.itunes.storekit.model.ConsumptionRequestV1;
import com.apple.itunes.storekit.model.DefaultConfigurationRequest;
import com.apple.itunes.storekit.model.Environment;
import com.apple.itunes.storekit.model.ErrorPayload;
Expand Down Expand Up @@ -365,12 +366,27 @@ public SendTestNotificationResponse requestTestNotification() throws APIExceptio
* @param consumptionRequest The request body containing consumption information.
* @throws APIException If a response was returned indicating the request could not be processed
* @throws IOException If an exception was thrown while making the request
* @see <a href="https://developer.apple.com/documentation/appstoreserverapi/send_consumption_information">Send Consumption Information</a>
* @see <a href="https://developer.apple.com/documentation/appstoreserverapi/send-consumption-information-v1">Send Consumption Information V1</a>
* @deprecated Use {@link #sendConsumptionInformation(String, ConsumptionRequest)} instead
*/
public void sendConsumptionData(String transactionId, ConsumptionRequest consumptionRequest) throws APIException, IOException {
@Deprecated
public void sendConsumptionData(String transactionId, ConsumptionRequestV1 consumptionRequest) throws APIException, IOException {
makeHttpCall("/inApps/v1/transactions/consumption/" + transactionId, "PUT", Map.of(), consumptionRequest, Void.class, JSON);
}

/**
* Send consumption information about an In-App Purchase to the App Store after your server receives a consumption request notification.
*
* @param transactionId The transaction identifier for which you’re providing consumption information. You receive this identifier in the CONSUMPTION_REQUEST notification the App Store sends to your server’s App Store Server Notifications V2 endpoint.
* @param consumptionRequest The request body containing consumption information.
* @throws APIException If a response was returned indicating the request could not be processed
* @throws IOException If an exception was thrown while making the request
* @see <a href="https://developer.apple.com/documentation/appstoreserverapi/send-consumption-information">Send Consumption Information</a>
*/
public void sendConsumptionInformation(String transactionId, ConsumptionRequest consumptionRequest) throws APIException, IOException {
makeHttpCall("/inApps/v2/transactions/consumption/" + transactionId, "PUT", Map.of(), consumptionRequest, Void.class, JSON);
}


/**
* Sets the app account token value for a purchase the customer makes outside your app, or updates its value in an existing transaction.
Expand Down
172 changes: 172 additions & 0 deletions src/main/java/com/apple/itunes/storekit/model/AppData.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
// Copyright (c) 2025 Apple Inc. Licensed under MIT License.

package com.apple.itunes.storekit.model;

import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Map;
import java.util.Objects;

/**
* The object that contains the app metadata and signed app transaction information.
*
* @see <a href="https://developer.apple.com/documentation/appstoreservernotifications/appdata">appData</a>
*/
public class AppData {
private static final String SERIALIZED_NAME_APP_APPLE_ID = "appAppleId";
private static final String SERIALIZED_NAME_BUNDLE_ID = "bundleId";
private static final String SERIALIZED_NAME_ENVIRONMENT = "environment";
private static final String SERIALIZED_NAME_SIGNED_APP_TRANSACTION_INFO = "signedAppTransactionInfo";
@JsonProperty(SERIALIZED_NAME_APP_APPLE_ID)
private Long appAppleId;
@JsonProperty(SERIALIZED_NAME_BUNDLE_ID)
private String bundleId;
@JsonProperty(SERIALIZED_NAME_ENVIRONMENT)
private String environment;
@JsonProperty(SERIALIZED_NAME_SIGNED_APP_TRANSACTION_INFO)
private String signedAppTransactionInfo;
@JsonAnySetter
private Map<String, Object> unknownFields;


public AppData() {
}

public AppData appAppleId(Long appAppleId) {
this.appAppleId = appAppleId;
return this;
}

/**
* The unique identifier of the app that the notification applies to.
*
* @return appAppleId
* @see <a href="https://developer.apple.com/documentation/appstoreservernotifications/appappleid">appAppleId</a>
**/
public Long getAppAppleId() {
return appAppleId;
}

public void setAppAppleId(Long appAppleId) {
this.appAppleId = appAppleId;
}

public AppData bundleId(String bundleId) {
this.bundleId = bundleId;
return this;
}

/**
* The bundle identifier of the app.
*
* @return bundleId
* @see <a href="https://developer.apple.com/documentation/appstoreservernotifications/bundleid">bundleId</a>
**/
public String getBundleId() {
return bundleId;
}

public void setBundleId(String bundleId) {
this.bundleId = bundleId;
}

public AppData environment(Environment environment) {
this.environment = environment != null ? environment.getValue() : null;
return this;
}

/**
* The server environment that the notification applies to, either sandbox or production.
*
* @return environment
* @see <a href="https://developer.apple.com/documentation/appstoreservernotifications/environment">environment</a>
**/
public Environment getEnvironment() {
return environment != null ? Environment.fromValue(environment) : null;
}

/**
* @see #getEnvironment()
*/
public String getRawEnvironment() {
return environment;
}

public void setEnvironment(Environment environment) {
this.environment = environment != null ? environment.getValue() : null;
}

public void setRawEnvironment(String rawEnvironment) {
this.environment = rawEnvironment;
}

public AppData signedAppTransactionInfo(String signedAppTransactionInfo) {
this.signedAppTransactionInfo = signedAppTransactionInfo;
return this;
}

/**
* App transaction information signed by the App Store, in JSON Web Signature (JWS) format.
*
* @return signedAppTransactionInfo
* @see <a href="https://developer.apple.com/documentation/appstoreservernotifications/jwsapptransaction">JWSAppTransaction</a>
**/
public String getSignedAppTransactionInfo() {
return signedAppTransactionInfo;
}

public void setSignedAppTransactionInfo(String signedAppTransactionInfo) {
this.signedAppTransactionInfo = signedAppTransactionInfo;
}

public AppData unknownFields(Map<String, Object> unknownFields) {
this.unknownFields = unknownFields;
return this;
}

/**
Fields that are not recognized for this object

@return A map of JSON keys to objects
*/
public Map<String, Object> getUnknownFields() {
return unknownFields;
}

public void setUnknownFields(Map<String, Object> unknownFields) {
this.unknownFields = unknownFields;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
AppData appData = (AppData) o;
return Objects.equals(this.appAppleId, appData.appAppleId) &&
Objects.equals(this.bundleId, appData.bundleId) &&
Objects.equals(this.environment, appData.environment) &&
Objects.equals(this.signedAppTransactionInfo, appData.signedAppTransactionInfo) &&
Objects.equals(this.unknownFields, appData.unknownFields);
}

@Override
public int hashCode() {
return Objects.hash(appAppleId, bundleId, environment, signedAppTransactionInfo, unknownFields);
}

@Override
public String toString() {
return "AppData{" +
"appAppleId=" + appAppleId +
", bundleId='" + bundleId + '\'' +
", environment='" + environment + '\'' +
", signedAppTransactionInfo='" + signedAppTransactionInfo + '\'' +
", unknownFields=" + unknownFields +
'}';
}
}
Loading
Loading