encode<V> static method

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

Implementation

static V encode<V>(
  PaymentIntentPaymentMethodData instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.acssDebit != null) {
    PaymentIntentAcssDebit.encode(
      instance.acssDebit!,
      container.nestedSingleValueContainer('acss_debit').encoder,
    );
  }
  if (instance.affirm != null) {
    container.encodePrimitive(
      'affirm',
      instance.affirm!,
    );
  }
  if (instance.afterpayClearpay != null) {
    container.encodePrimitive(
      'afterpay_clearpay',
      instance.afterpayClearpay!,
    );
  }
  if (instance.alipay != null) {
    container.encodePrimitive(
      'alipay',
      instance.alipay!,
    );
  }
  if (instance.auBecsDebit != null) {
    PaymentIntentAuBecsDebit.encode(
      instance.auBecsDebit!,
      container.nestedSingleValueContainer('au_becs_debit').encoder,
    );
  }
  if (instance.bacsDebit != null) {
    PaymentIntentBacsDebit.encode(
      instance.bacsDebit!,
      container.nestedSingleValueContainer('bacs_debit').encoder,
    );
  }
  if (instance.bancontact != null) {
    container.encodePrimitive(
      'bancontact',
      instance.bancontact!,
    );
  }
  if (instance.billingDetails != null) {
    PaymentIntentBillingDetails.encode(
      instance.billingDetails!,
      container.nestedSingleValueContainer('billing_details').encoder,
    );
  }
  if (instance.blik != null) {
    container.encodePrimitive(
      'blik',
      instance.blik!,
    );
  }
  if (instance.boleto != null) {
    PaymentMethodDetailsBoleto.encode(
      instance.boleto!,
      container.nestedSingleValueContainer('boleto').encoder,
    );
  }
  if (instance.cashapp != null) {
    container.encodePrimitive(
      'cashapp',
      instance.cashapp!,
    );
  }
  if (instance.customerBalance != null) {
    container.encodePrimitive(
      'customer_balance',
      instance.customerBalance!,
    );
  }
  if (instance.eps != null) {
    PaymentIntentEps.encode(
      instance.eps!,
      container.nestedSingleValueContainer('eps').encoder,
    );
  }
  if (instance.fpx != null) {
    PaymentIntentFpx.encode(
      instance.fpx!,
      container.nestedSingleValueContainer('fpx').encoder,
    );
  }
  if (instance.giropay != null) {
    container.encodePrimitive(
      'giropay',
      instance.giropay!,
    );
  }
  if (instance.grabpay != null) {
    container.encodePrimitive(
      'grabpay',
      instance.grabpay!,
    );
  }
  if (instance.ideal != null) {
    PaymentIntentIdeal.encode(
      instance.ideal!,
      container.nestedSingleValueContainer('ideal').encoder,
    );
  }
  if (instance.interacPresent != null) {
    container.encodePrimitive(
      'interac_present',
      instance.interacPresent!,
    );
  }
  if (instance.klarna != null) {
    PaymentIntentKlarna.encode(
      instance.klarna!,
      container.nestedSingleValueContainer('klarna').encoder,
    );
  }
  if (instance.konbini != null) {
    container.encodePrimitive(
      'konbini',
      instance.konbini!,
    );
  }
  if (instance.link != null) {
    container.encodePrimitive(
      'link',
      instance.link!,
    );
  }
  if (instance.metadata != null) {
    container.encodeMap(
      'metadata',
      (container) => instance.metadata!.forEach((
        key,
        value,
      ) =>
          container.encodeString(
            key,
            value,
          )),
    );
  }
  if (instance.mobilepay != null) {
    container.encodePrimitive(
      'mobilepay',
      instance.mobilepay!,
    );
  }
  if (instance.oxxo != null) {
    container.encodePrimitive(
      'oxxo',
      instance.oxxo!,
    );
  }
  if (instance.p24 != null) {
    PaymentIntentP24.encode(
      instance.p24!,
      container.nestedSingleValueContainer('p24').encoder,
    );
  }
  if (instance.paynow != null) {
    container.encodePrimitive(
      'paynow',
      instance.paynow!,
    );
  }
  if (instance.paypal != null) {
    container.encodePrimitive(
      'paypal',
      instance.paypal!,
    );
  }
  if (instance.pix != null) {
    container.encodePrimitive(
      'pix',
      instance.pix!,
    );
  }
  if (instance.promptpay != null) {
    container.encodePrimitive(
      'promptpay',
      instance.promptpay!,
    );
  }
  if (instance.radarOptions != null) {
    RadarRadarOptions.encode(
      instance.radarOptions!,
      container.nestedSingleValueContainer('radar_options').encoder,
    );
  }
  if (instance.revolutPay != null) {
    container.encodePrimitive(
      'revolut_pay',
      instance.revolutPay!,
    );
  }
  if (instance.sepaDebit != null) {
    PaymentIntentSepaDebit.encode(
      instance.sepaDebit!,
      container.nestedSingleValueContainer('sepa_debit').encoder,
    );
  }
  if (instance.sofort != null) {
    PaymentIntentSofort.encode(
      instance.sofort!,
      container.nestedSingleValueContainer('sofort').encoder,
    );
  }
  if (instance.swish != null) {
    container.encodePrimitive(
      'swish',
      instance.swish!,
    );
  }
  container.encodeString(
    'type',
    instance.type,
  );
  if (instance.usBankAccount != null) {
    PaymentIntentUsBankAccount.encode(
      instance.usBankAccount!,
      container.nestedSingleValueContainer('us_bank_account').encoder,
    );
  }
  if (instance.wechatPay != null) {
    container.encodePrimitive(
      'wechat_pay',
      instance.wechatPay!,
    );
  }
  if (instance.zip != null) {
    container.encodePrimitive(
      'zip',
      instance.zip!,
    );
  }
  return container.value;
}