appleTransaction static method

VerificationResult appleTransaction(
  1. JWSTransactionDecodedPayload tx, {
  2. required String environment,
})

Parses a single decoded transaction from getTransactionHistory.

Implementation

static VerificationResult appleTransaction(
  JWSTransactionDecodedPayload tx, {
  required String environment,
}) {
  final revoked = tx.revocationDate != null;
  return VerificationResult(
    isValid: !revoked,
    state: revoked ? VerificationState.revoked : VerificationState.purchased,
    platform: StorePlatform.apple,
    productId: tx.productId,
    expiresAt: _fromMillis(tx.expiresDate),
    isSandbox: _isAppleSandbox(environment),
    raw: tx.toJson(),
  );
}