encode<V> static method

V encode<V>(
  1. ChargeOutcome instance,
  2. Encoder<V> encoder
)

Implementation

static V encode<V>(
  ChargeOutcome instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.networkStatus != null) {
    container.encodeString(
      'network_status',
      instance.networkStatus!,
    );
  }
  if (instance.reason != null) {
    container.encodeString(
      'reason',
      instance.reason!,
    );
  }
  if (instance.riskLevel != null) {
    container.encodeString(
      'risk_level',
      instance.riskLevel!,
    );
  }
  if (instance.riskScore != null) {
    container.encodeInt(
      'risk_score',
      instance.riskScore!,
    );
  }
  if (instance.rule != null) {
    RuleOrId.encode(
      instance.rule!,
      container.nestedSingleValueContainer('rule').encoder,
    );
  }
  if (instance.sellerMessage != null) {
    container.encodeString(
      'seller_message',
      instance.sellerMessage!,
    );
  }
  container.encodeString(
    'type',
    instance.type,
  );
  return container.value;
}