toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  Map<String, dynamic> result = {
    'application_id': getApplicationId(),
    'pg': pg,
    'order_name': orderName,
    'price': price,
    'currency': currency,
    'tax_free': taxFree,
    'deposit_price': depositPrice,
    'order_id': orderId,
    'subscription_id': subscriptionId,
    'authentication_id': authenticationId,
    // 'use_order_id': useOrderId,
    'metadata': metadata,
    // 'account_expire_at': accountExpireAt,
    // 'show_agree_window': showAgreeWindow,
    'user_token': userToken,
    'key': widgetKey,
    'sandbox': widgetSandbox,
    'use_terms': widgetUseTerms,
  };
  if(this.methods != null && this.methods!.length > 0) {
    if(kIsWeb) result['method'] = this.methods;
    else result['method'] = getMethodValue();
  } else if(this.method != null && this.method!.length > 0) {
    result['method'] = this.method;
  }
  if(extra != null) {
    result['extra'] = extra!.toJson();
  }
  if(user != null) {
    result['user'] = user!.toJson();
  }
  if((items?.length ?? 0) > 0) {
    result['items'] = items!.map((e) => e.toJson()).toList();
  }
  if(widgetOopay != null) {
    result['oopay'] = widgetOopay!.toJson();
  }
  if(_widgetSelectTerms != null && _widgetSelectTerms!.length > 0) {
    result['select_terms'] = getSelectTermsValue();
  }

  return result;
}