encode<V> static method

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

Implementation

static V encode<V>(
  PaymentMethodCardWallet instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.amexExpressCheckout != null) {
    PaymentMethodCardWalletAmexExpressCheckout.encode(
      instance.amexExpressCheckout!,
      container.nestedSingleValueContainer('amex_express_checkout').encoder,
    );
  }
  if (instance.applePay != null) {
    PaymentMethodCardWalletApplePay.encode(
      instance.applePay!,
      container.nestedSingleValueContainer('apple_pay').encoder,
    );
  }
  if (instance.dynamicLast4 != null) {
    container.encodeString(
      'dynamic_last4',
      instance.dynamicLast4!,
    );
  }
  if (instance.googlePay != null) {
    PaymentMethodCardWalletGooglePay.encode(
      instance.googlePay!,
      container.nestedSingleValueContainer('google_pay').encoder,
    );
  }
  if (instance.link != null) {
    PaymentMethodCardWalletLink.encode(
      instance.link!,
      container.nestedSingleValueContainer('link').encoder,
    );
  }
  if (instance.masterpass != null) {
    PaymentMethodCardWalletMasterpass.encode(
      instance.masterpass!,
      container.nestedSingleValueContainer('masterpass').encoder,
    );
  }
  if (instance.samsungPay != null) {
    PaymentMethodCardWalletSamsungPay.encode(
      instance.samsungPay!,
      container.nestedSingleValueContainer('samsung_pay').encoder,
    );
  }
  container.encodeString(
    'type',
    instance.type,
  );
  if (instance.visaCheckout != null) {
    PaymentMethodCardWalletVisaCheckout.encode(
      instance.visaCheckout!,
      container.nestedSingleValueContainer('visa_checkout').encoder,
    );
  }
  return container.value;
}