encode<V> static method

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

Implementation

static V encode<V>(
  IssuingAuthorizationCaptureOptions instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.captureAmount != null) {
    container.encodeInt(
      'capture_amount',
      instance.captureAmount!,
    );
  }
  if (instance.closeAuthorization != null) {
    container.encodeBool(
      'close_authorization',
      instance.closeAuthorization!,
    );
  }
  if (instance.expand != null) {
    container.encodeList(
      'expand',
      (container) =>
          instance.expand!.forEach((el) => container.encodeString(el)),
    );
  }
  if (instance.purchaseDetails != null) {
    AuthorizationPurchaseDetails.encode(
      instance.purchaseDetails!,
      container.nestedSingleValueContainer('purchase_details').encoder,
    );
  }
  return container.value;
}