Skip to content

Commit

Permalink
AddReturn in in app billing purchase
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmontemagno committed May 5, 2021
1 parent 5e0c3e3 commit 5809f72
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/Plugin.InAppBilling/Converters.android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ public static InAppBillingPurchase ToIABPurchase(this Purchase purchase)
Payload = purchase.DeveloperPayload,
ProductId = purchase.Sku,
PurchaseToken = purchase.PurchaseToken,
TransactionDateUtc = DateTimeOffset.FromUnixTimeMilliseconds(purchase.PurchaseTime).DateTime
TransactionDateUtc = DateTimeOffset.FromUnixTimeMilliseconds(purchase.PurchaseTime).DateTime,
ObfuscatedAccountId = purchase.AccountIdentifiers?.ObfuscatedAccountId,
ObfuscatedProfileId = purchase.AccountIdentifiers?.ObfuscatedProfileId
};

finalPurchase.State = purchase.PurchaseState switch
Expand Down
13 changes: 9 additions & 4 deletions src/Plugin.InAppBilling/Shared/InAppBillingPurchase.shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public InAppBillingPurchase()
{
}


/// <summary>
/// Purchase/Order Id
/// </summary>
Expand Down Expand Up @@ -62,6 +63,10 @@ public InAppBillingPurchase()

public bool IsAcknowledged { get; set; }

public string ObfuscatedAccountId { get; set; }

public string ObfuscatedProfileId { get; set; }

/// <summary>
/// Developer payload
/// </summary>
Expand All @@ -77,18 +82,18 @@ public override bool Equals(object obj) =>
(obj is InAppBillingPurchase purchase) && Equals(purchase);

public bool Equals(InAppBillingPurchase other) =>
(Id, TransactionDateUtc, IsAcknowledged, ProductId, AutoRenewing, PurchaseToken, State, Payload) ==
(other.Id, other.TransactionDateUtc, other.IsAcknowledged, other.ProductId, other.AutoRenewing, other.PurchaseToken, other.State, other.Payload);
(Id, TransactionDateUtc, IsAcknowledged, ProductId, AutoRenewing, PurchaseToken, State, Payload, ObfuscatedAccountId, ObfuscatedProfileId) ==
(other.Id, other.TransactionDateUtc, other.IsAcknowledged, other.ProductId, other.AutoRenewing, other.PurchaseToken, other.State, other.Payload, other.ObfuscatedAccountId, other.ObfuscatedProfileId);

public override int GetHashCode() =>
(Id, TransactionDateUtc, IsAcknowledged, ProductId, AutoRenewing, PurchaseToken, State, Payload).GetHashCode();
(Id, TransactionDateUtc, IsAcknowledged, ProductId, AutoRenewing, PurchaseToken, State, Payload, ObfuscatedAccountId, ObfuscatedProfileId).GetHashCode();

/// <summary>
/// Prints out product
/// </summary>
/// <returns></returns>
public override string ToString() =>
$"ProductId:{ProductId}| IsAcknowledged:{IsAcknowledged} | AutoRenewing:{AutoRenewing} | State:{State} | Id:{Id}";
$"{nameof(ProductId)}:{ProductId}| {nameof(IsAcknowledged)}:{IsAcknowledged} | {nameof(AutoRenewing)}:{AutoRenewing} | {nameof(State)}:{State} | {nameof(Id)}:{Id} | {nameof(ObfuscatedAccountId)}:{ObfuscatedAccountId} | {nameof(ObfuscatedProfileId)}:{ObfuscatedProfileId} ";

}

Expand Down

0 comments on commit 5809f72

Please sign in to comment.