toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  Map<String, dynamic> result = {
    'application_id': getApplicationId(),
    'pg': pg,
    'method': method,
    'order_name': orderName,
    'price': price,
    'tax_free': taxFree,
    'order_id': orderId,
    'subscription_id': subscriptionId,
    'authentication_id': authenticationId,
    'wallet_id': walletId,
    'token': token,
    'authenticate_type': authenticateType,
    'easy_type': easyType,
    'user_token': userToken
  };
  if(this.methods != null && this.methods!.length > 0) {
    if(kIsWeb) result['methods'] = this.methods;
    else result['methods'] = methodListString();
  } else if(this.method != null && this.method!.length > 0) {
    result['method'] = this.method;
  }
  if(user != null) {
    result['user'] = user!.toJson();
  }
  if(extra != null) {
    result['extra'] = extra!.toJson();
  }
  if(items!.length > 0) {
    result['items'] = items!.map((e) => e.toJson()).toList();
  }

  return result;
}