Skip to content

Commit

Permalink
refac: remove receipt from app store subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
uerceg committed Aug 2, 2024
1 parent 49bc33d commit 10f8dfd
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 26 deletions.
19 changes: 8 additions & 11 deletions Adjust/ADJAppStoreSubscription.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,23 @@

@interface ADJAppStoreSubscription : NSObject<NSCopying>

@property (nonatomic, copy, readonly, nonnull) NSDecimalNumber *price; // [M] revenue
@property (nonatomic, copy, readonly, nonnull) NSDecimalNumber *price;

@property (nonatomic, copy, readonly, nonnull) NSString *currency; // [M] currency
@property (nonatomic, copy, readonly, nonnull) NSString *currency;

@property (nonatomic, copy, readonly, nonnull) NSString *transactionId; // [M] transaction_id
@property (nonatomic, copy, readonly, nonnull) NSString *transactionId;

@property (nonatomic, copy, readonly, nonnull) NSData *receipt; // [M] receipt
@property (nonatomic, copy, readonly, nonnull) NSDate *transactionDate;

@property (nonatomic, copy, readonly, nonnull) NSDate *transactionDate; // [O] transaction_date
@property (nonatomic, copy, readonly, nonnull) NSString *salesRegion;

@property (nonatomic, copy, readonly, nonnull) NSString *salesRegion; // [O] sales_region
@property (nonatomic, copy, readonly, nonnull) NSDictionary *callbackParameters;

@property (nonatomic, copy, readonly, nonnull) NSDictionary *callbackParameters; // [O] callback_params

@property (nonatomic, copy, readonly, nonnull) NSDictionary *partnerParameters; // [O] partner_params
@property (nonatomic, copy, readonly, nonnull) NSDictionary *partnerParameters;

- (nullable id)initWithPrice:(nonnull NSDecimalNumber *)price
currency:(nonnull NSString *)currency
transactionId:(nonnull NSString *)transactionId
receipt:(nonnull NSData *)receipt;
transactionId:(nonnull NSString *)transactionId;

- (void)setTransactionDate:(nonnull NSDate *)transactionDate;

Expand Down
5 changes: 1 addition & 4 deletions Adjust/ADJAppStoreSubscription.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ @implementation ADJAppStoreSubscription

- (nullable id)initWithPrice:(nonnull NSDecimalNumber *)price
currency:(nonnull NSString *)currency
transactionId:(nonnull NSString *)transactionId
receipt:(nonnull NSData *)receipt {
transactionId:(nonnull NSString *)transactionId {
self = [super init];
if (self == nil) {
return nil;
Expand All @@ -34,7 +33,6 @@ - (nullable id)initWithPrice:(nonnull NSDecimalNumber *)price
_price = [price copy];
_currency = [currency copy];
_transactionId = [transactionId copy];
_receipt = [receipt copy];

_logger = ADJAdjustFactory.logger;

Expand Down Expand Up @@ -128,7 +126,6 @@ - (id)copyWithZone:(NSZone *)zone {
copy->_price = [self.price copyWithZone:zone];
copy->_currency = [self.currency copyWithZone:zone];
copy->_transactionId = [self.transactionId copyWithZone:zone];
copy->_receipt = [self.receipt copyWithZone:zone];
copy->_transactionDate = [self.transactionDate copyWithZone:zone];
copy->_salesRegion = [self.salesRegion copyWithZone:zone];
copy.mutableCallbackParameters = [self.mutableCallbackParameters copyWithZone:zone];
Expand Down
4 changes: 2 additions & 2 deletions Adjust/ADJPurchaseVerificationResult.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
* @property message
*
* @brief Text message about current state of receipt verification.
* @brief Text message about current state of purchase verification.
*/
@property (nonatomic, copy) NSString *message;

Expand All @@ -29,7 +29,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
* @property verificationStatus
*
* @brief State of verification (success / failure / unknown / not verified)
* @brief State of purchase verification (success / failure / unknown / not verified)
*/
@property (nonatomic, copy) NSString *verificationStatus;

Expand Down
2 changes: 0 additions & 2 deletions Adjust/Internal/ADJPackageBuilder.m
Original file line number Diff line number Diff line change
Expand Up @@ -926,8 +926,6 @@ - (NSMutableDictionary *)getSubscriptionParameters:(ADJAppStoreSubscription *)su
[ADJPackageBuilder parameters:parameters setNumber:subscription.price forKey:@"revenue"];
[ADJPackageBuilder parameters:parameters setString:subscription.currency forKey:@"currency"];
[ADJPackageBuilder parameters:parameters setString:subscription.transactionId forKey:@"transaction_id"];
// [ADJPackageBuilder parameters:parameters setString:[subscription.receipt adjEncodeBase64] forKey:@"receipt"];
[ADJPackageBuilder parameters:parameters setString:[ADJAdditions adjEncodeBase64:subscription.receipt] forKey:@"receipt"];
[ADJPackageBuilder parameters:parameters setDate:subscription.transactionDate forKey:@"transaction_date"];
[ADJPackageBuilder parameters:parameters setString:subscription.salesRegion forKey:@"sales_region"];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,6 @@ - (void)trackAppStoreSubscription:(NSDictionary *)parameters {
NSDecimalNumber *price;
NSString *currency;
NSString *transactionId;
NSData *receipt;
NSDate *transactionDate;
NSString *salesRegion;

Expand All @@ -645,10 +644,6 @@ - (void)trackAppStoreSubscription:(NSDictionary *)parameters {
if ([parameters objectForKey:@"transactionId"]) {
transactionId = [parameters objectForKey:@"transactionId"][0];
}
if ([parameters objectForKey:@"receipt"]) {
NSString *receiptString = [parameters objectForKey:@"receipt"][0];
receipt = [receiptString dataUsingEncoding:NSUTF8StringEncoding];
}
if ([parameters objectForKey:@"transactionDate"]) {
transactionDate = [NSDate dateWithTimeIntervalSince1970:[[parameters objectForKey:@"transactionDate"][0] doubleValue]];
}
Expand All @@ -659,8 +654,7 @@ - (void)trackAppStoreSubscription:(NSDictionary *)parameters {
ADJAppStoreSubscription *subscription =
[[ADJAppStoreSubscription alloc] initWithPrice:price
currency:currency
transactionId:transactionId
receipt:receipt];
transactionId:transactionId];
[subscription setTransactionDate:transactionDate];
[subscription setSalesRegion:salesRegion];

Expand Down

0 comments on commit 10f8dfd

Please sign in to comment.