handleOnPurchased static method
Implementation
static handleOnPurchased(MethodCall call){
final result = json.decode(call.arguments);
int platform = result["platform"];
List<AWOrder> purchaseList = [];
/// ios
if (platform == AwPlatformType.ios.index) {
//订阅
final List subs = result["subs"] ?? [];
for (var purchaseJson in subs) {
purchaseList.add(AWOrder.fromIosJson(purchaseJson));
}
//消耗品、非消耗品、非续期订阅
final List inapps = result["inapps"] ?? [];
for (var purchaseJson in inapps) {
purchaseList.add(AWOrder.fromIosJson(purchaseJson));
}
}
/// android
if (platform == AwPlatformType.android.index) {
final List purchaseStr = result["orderList"];
for (var purchaseJson in purchaseStr) {
purchaseList.add(AWOrder.fromAndroidJson(purchaseJson));
}
}
observer?.onPurchased(purchaseList);
}