feat: Added missing info to IAP transaction and product structures (#31739)
This commit is contained in:
parent
d26d337bb8
commit
2fe5d0e1e8
11 changed files with 323 additions and 6 deletions
|
@ -94,6 +94,25 @@ using InAppTransactionCallback = base::RepeatingCallback<void(
|
|||
return [dateFormatter stringFromDate:date];
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a SKPaymentDiscount object to a PaymentDiscount structure.
|
||||
*
|
||||
* @param paymentDiscount - The SKPaymentDiscount object to convert.
|
||||
*/
|
||||
- (in_app_purchase::PaymentDiscount)skPaymentDiscountToStruct:
|
||||
(SKPaymentDiscount*)paymentDiscount API_AVAILABLE(macosx(10.14.4)) {
|
||||
in_app_purchase::PaymentDiscount paymentDiscountStruct;
|
||||
|
||||
paymentDiscountStruct.identifier = [paymentDiscount.identifier UTF8String];
|
||||
paymentDiscountStruct.keyIdentifier =
|
||||
[paymentDiscount.keyIdentifier UTF8String];
|
||||
paymentDiscountStruct.nonce = [[paymentDiscount.nonce UUIDString] UTF8String];
|
||||
paymentDiscountStruct.signature = [paymentDiscount.signature UTF8String];
|
||||
paymentDiscountStruct.timestamp = [paymentDiscount.timestamp intValue];
|
||||
|
||||
return paymentDiscountStruct;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a SKPayment object to a Payment structure.
|
||||
*
|
||||
|
@ -110,6 +129,18 @@ using InAppTransactionCallback = base::RepeatingCallback<void(
|
|||
paymentStruct.quantity = (int)payment.quantity;
|
||||
}
|
||||
|
||||
if (payment.applicationUsername != nil) {
|
||||
paymentStruct.applicationUsername =
|
||||
[payment.applicationUsername UTF8String];
|
||||
}
|
||||
|
||||
if (@available(macOS 10.14.4, *)) {
|
||||
if (payment.paymentDiscount != nil) {
|
||||
paymentStruct.paymentDiscount =
|
||||
[self skPaymentDiscountToStruct:payment.paymentDiscount];
|
||||
}
|
||||
}
|
||||
|
||||
return paymentStruct;
|
||||
}
|
||||
|
||||
|
@ -178,6 +209,14 @@ using InAppTransactionCallback = base::RepeatingCallback<void(
|
|||
|
||||
namespace in_app_purchase {
|
||||
|
||||
PaymentDiscount::PaymentDiscount() = default;
|
||||
PaymentDiscount::PaymentDiscount(const PaymentDiscount&) = default;
|
||||
PaymentDiscount::~PaymentDiscount() = default;
|
||||
|
||||
Payment::Payment() = default;
|
||||
Payment::Payment(const Payment&) = default;
|
||||
Payment::~Payment() = default;
|
||||
|
||||
Transaction::Transaction() = default;
|
||||
Transaction::Transaction(const Transaction&) = default;
|
||||
Transaction::~Transaction() = default;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue