toPurchaseStatus method

PurchaseStatus toPurchaseStatus(
  1. PurchaseStateWrapper object
)

Converts the purchase state stored in object to a PurchaseStatus.

PurchaseStateWrapper.unspecified_state is mapped to PurchaseStatus.error.

Implementation

PurchaseStatus toPurchaseStatus(PurchaseStateWrapper object) {
  switch (object) {
    case PurchaseStateWrapper.pending:
      return PurchaseStatus.pending;
    case PurchaseStateWrapper.purchased:
      return PurchaseStatus.purchased;
    case PurchaseStateWrapper.unspecified_state:
      return PurchaseStatus.error;
  }
}