Skip to main content

app_store_server_library/primitives/
consumption_request.rs

1use crate::primitives::delivery_status::DeliveryStatus;
2use crate::primitives::refund_preference::RefundPreference;
3use serde::{Deserialize, Serialize};
4
5/// The request body containing consumption information.
6///
7/// [ConsumptionRequest](https://developer.apple.com/documentation/appstoreserverapi/consumptionrequest)
8#[derive(Debug, Clone, Deserialize, Serialize, Hash)]
9#[serde(rename_all = "camelCase")]
10pub struct ConsumptionRequest {
11    /// A Boolean value that indicates whether the customer consented to provide consumption data to the App Store.
12    ///
13    /// [customerConsented](https://developer.apple.com/documentation/appstoreserverapi/customerconsented)
14    pub customer_consented: bool,
15
16    /// An integer that indicates the percentage, in milliunits, of the In-App Purchase the customer consumed.
17    ///
18    /// [consumptionPercentage](https://developer.apple.com/documentation/appstoreserverapi/consumptionpercentage)
19    #[serde(skip_serializing_if = "Option::is_none")]
20    pub consumption_percentage: Option<u32>,
21
22    /// A value that indicates whether the app successfully delivered an in-app purchase that works properly.
23    ///
24    /// [deliveryStatus](https://developer.apple.com/documentation/appstoreserverapi/deliverystatus)
25    pub delivery_status: DeliveryStatus,
26
27    /// A value that indicates your preference, based on your operational logic, as to whether Apple should grant the refund.
28    ///
29    /// [refundPreference](https://developer.apple.com/documentation/appstoreserverapi/refundpreference)
30    #[serde(skip_serializing_if = "Option::is_none")]
31    pub refund_preference: Option<RefundPreference>,
32
33    /// A Boolean value that indicates whether you provided, prior to its purchase, a free sample or trial of the content, or information about its functionality.
34    ///
35    /// [sampleContentProvided](https://developer.apple.com/documentation/appstoreserverapi/samplecontentprovided)
36    pub sample_content_provided: bool,
37}