toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  Map<String, dynamic> dict = {};

  dict['client_key'] = clientKey;
  if (name != null) dict['name'] = name;
  if (memo != null) dict['memo'] = memo;
  if (user != null) dict['user'] = user!.toJson();
  if (price > 0) dict['price'] = price;
  if (redirectUrl != null) dict['redirect_url'] = redirectUrl;
  if (usageApiUrl != null) dict['usage_api_url'] = usageApiUrl;
  dict['use_auto_login'] = useAutoLogin;
  if (requestId != null) dict['request_id'] = requestId;
  dict['use_notification'] = useNotification;

  if (products != null && products!.isNotEmpty) {
    dict['products'] = products!.map((p) => p.toJson()).toList();
  }

  if (metadata != null && metadata!.isNotEmpty) {
    dict['metadata'] = metadata;
  }

  if (extra != null) dict['extra'] = extra!.toJson();

  return dict;
}