parseIosOrder static method

Future<AWResponseModel<List<AWOrder>>> parseIosOrder(
  1. dynamic purchaseData,
  2. List<AWOrder> purchaseList
)

解析iOS返回的订单数据:供订单列表和恢复购买使用的统一方法

Implementation

static Future<AWResponseModel<List<AWOrder>>> parseIosOrder(
    dynamic purchaseData, List<AWOrder> purchaseList) async {
  //订阅
  final List subs = purchaseData["subs"] ?? [];
  for (var purchaseJson in subs) {
    purchaseList.add(AWOrder.fromIosJson(purchaseJson));
  }

  //消耗品、非消耗品、非续期订阅
  final List inapps = purchaseData["inapps"] ?? [];
  for (var purchaseJson in inapps) {
    purchaseList.add(AWOrder.fromIosJson(purchaseJson));
  }
  return AWResponseModel.sendSuccess(purchaseList);
}