ecrSale method
Ecr sale function in Eghl
will notify Eghl terminal to prompt sale page let it can scan or doing sale operation
amount
is amount in this transaction
operatorID
is this transaction Operator ID
customField
is optional there contains ecr_invoice_number
example: "{"ecr_invoice_number":"ECR20211028153155_01"}"
Implementation
Future<EghlResponseModel> ecrSale(
{required double amount, String? operatorID, String? customField}) async {
_msgType = "Sale";
_amount = amount;
_operatorID = operatorID ?? "";
_setPosDateTime();
final String sign = _sign(_payload);
final message = EghlEcrSalePayloadMessageModel(
msgType: _msgType,
txnType: _txnType,
amount: _amount?.toStringAsFixed(2) ?? "",
merchantID: _merchantID,
terminalID: _terminalID,
posDateTime: _posDateTime,
operatorID: _operatorID,
customField2: customField,
);
final response = await _postJson<EghlEcrSalePayloadMessageModel>(
message,
sign,
);
_clear();
return _convertEGHLResponseModel<EghlEcrReponseModel>(_verify(response));
}