toArguments method

Map<String, Object?> toArguments()

The argument map as it crosses the channel.

Amounts go as a decimal string in major units. The host converts to minor units with EcrConfig.minorUnitDigits, so the conversion happens once, in the same place on both platforms, using the same rounding.

Implementation

Map<String, Object?> toArguments() => <String, Object?>{
      EcrArgs.operationId: operationId,
      EcrArgs.host: host,
      EcrArgs.serialNumber: serialNumber,
      EcrArgs.transport: transport.channelName,
      EcrArgs.config: <String, Object?>{
        EcrConfigKeys.ecrId: config.ecrId,
        EcrConfigKeys.currencyCode: config.currencyCode,
        EcrConfigKeys.minorUnitDigits: config.minorUnitDigits,
        EcrConfigKeys.port: config.port,
        EcrConfigKeys.connectTimeoutMs: config.connectTimeout.inMilliseconds,
        EcrConfigKeys.responseTimeoutMs: config.responseTimeout.inMilliseconds,
        EcrConfigKeys.probeTimeoutMs: config.probeTimeout.inMilliseconds,
        EcrConfigKeys.secureHashKey: config.secureHashKey,
        EcrConfigKeys.autoInquireOnFailure: config.autoInquireOnFailure,
        EcrConfigKeys.merchantId: config.merchantId,
        EcrConfigKeys.terminalId: config.terminalId,
        EcrConfigKeys.environment: config.environment.wireName,
      },
      EcrArgs.amount: amount?.toWireString(),
      EcrArgs.receiptNumber: receiptNumber,
      EcrArgs.transactionDate: transactionDate,
      EcrArgs.originalTerminalId: originalTerminalId,
      EcrArgs.merchantReference: merchantReference,
      EcrArgs.originalMerchantReference: originalMerchantReference,
      EcrArgs.receiptImage: receiptImage,
    };