Beispiel #1
0
        public override void ParseResponse(byte[] response)
        {
            if (response == null)
            {
                throw new ApiException("Response data is null");
            }

            if (response.Length < INGENICO_GLOBALS.RAW_RESPONSE_LENGTH)
            {
                byte[] newResponse = new byte[INGENICO_GLOBALS.RAW_RESPONSE_LENGTH];
                response.CopyTo(newResponse, 0);

                response = newResponse;
            }

            base.ParseResponse(response);

            var tlv = new TypeLengthValue(response.SubArray(12, 55));

            string terminalStatusData = (string)tlv.GetValue((byte)StateResponseCode.Status, typeof(string), TLVFormat.State);

            _terminalStatus                 = (TerminalStatus)Convert.ToByte(terminalStatusData.Substring(0, 1));
            _salesMode                      = (SalesMode)Convert.ToByte(terminalStatusData.Substring(1, 1));
            _terminalCapabilities           = terminalStatusData.Substring(2, 6);
            _additionalTerminalCapabilities = terminalStatusData.Substring(8, 10);
            _appVersionNumber               = (string)tlv.GetValue((byte)StateResponseCode.AppVersionNumber, typeof(string), TLVFormat.State);
            _handsetNumber                  = (string)tlv.GetValue((byte)StateResponseCode.HandsetNumber, typeof(string), TLVFormat.State);
            _terminalId                     = (string)tlv.GetValue((byte)StateResponseCode.TerminalId, typeof(string), TLVFormat.State);
        }
 public Product Recommend(SalesMode salesMode, Customer customer)
 {
     throw new NotImplementedException(); // TODO:
 }
 public Product Recommend(SalesMode salesMode, Customer customer)
 {
     return(_recommenders.FirstOrDefault(e => e.Metadata.SalesMode == salesMode).Value.Recommend(customer));
 }