Skip to content

Commit

Permalink
make transaction identifier '' by default
Browse files Browse the repository at this point in the history
  • Loading branch information
vegaro committed Apr 25, 2024
1 parent b72b424 commit 1839bd1
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 53 deletions.
39 changes: 36 additions & 3 deletions lib/models/store_transaction.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ class StoreTransaction with _$StoreTransaction {
/// Experimental. This factory method is subject to changes without
/// a major release.
const factory StoreTransaction.create(
/// RevenueCat Id associated to the transaction.
String transactionIdentifier,
/// RevenueCat Id associated to the transaction, always null for Amazon.
// ignore: invalid_annotation_target
@JsonKey(readValue: _readRevenueCatIdentifier)
String? orderId,

/// Deprecated: Use transactionIdentifier instead.
@Deprecated('Use transactionIdentifier instead.')
Expand All @@ -25,11 +27,17 @@ class StoreTransaction with _$StoreTransaction {

/// Purchase date of the transaction in ISO 8601 format.
String purchaseDate,
{
/// Deprecated: Use transactionIdentifier instead.
@Deprecated('Use orderId instead.')
/// RevenueCat Id associated to the transaction.
@Default('') String transactionIdentifier,
}
) = _StoreTransaction;

@Deprecated('Constructor has become experimental. Keeping old constructor '
'for backwards compatibility.')
factory StoreTransaction(
factory StoreTransaction.deprecated(
/// Deprecated: Use transactionIdentifier instead.
@Deprecated('Use transactionIdentifier instead.')
String revenueCatIdentifier,
Expand All @@ -47,6 +55,31 @@ class StoreTransaction with _$StoreTransaction {
purchaseDate,
);

@Deprecated('Constructor has become experimental. Keeping old constructor '
'for backwards compatibility.')
factory StoreTransaction(
/// Deprecated: Use transactionIdentifier instead.
@Deprecated('Use transactionIdentifier instead.')
String transactionIdentifier,

/// Deprecated: Use transactionIdentifier instead.
@Deprecated('Use transactionIdentifier instead.')
String revenueCatIdentifier,

/// Product Id associated with the transaction.
String productIdentifier,

/// Purchase date of the transaction in ISO 8601 format.
String purchaseDate,
) =>
StoreTransaction.create(
revenueCatIdentifier,
revenueCatIdentifier,
revenueCatIdentifier,
productIdentifier,
purchaseDate,
);

factory StoreTransaction.fromJson(Map<String, dynamic> json) =>
_$StoreTransactionFromJson(json);
}
Expand Down
Loading

0 comments on commit 1839bd1

Please sign in to comment.