コード例 #1
0
        /// <summary>
        /// Performs the mobile topup.
        /// </summary>
        /// <returns></returns>
        private async Task <Boolean> PerformMobileTopup()
        {
            SaleTransactionRequestMessage saleTransactionRequestMessage = new SaleTransactionRequestMessage
            {
                Amount = this.MobileTopupPerformTopupViewModel.TopupAmount,
                CustomerAccountNumber = this.MobileTopupPerformTopupViewModel.CustomerMobileNumber,
                DeviceIdentifier      = this.Device.GetDeviceIdentifier(),
                OperatorIdentifier    = this.MobileTopupPerformTopupViewModel.OperatorName,
                TransactionDateTime   = DateTime.Now,
                TransactionNumber     = "1"                                                           // TODO: Need to hold txn number somewhere
            };

            String requestJson = JsonConvert.SerializeObject(saleTransactionRequestMessage);

            this.AnalysisLogger.TrackEvent(MessageSentToHostEvent.Create(App.Configuration.TransactionProcessorACL, requestJson, DateTime.Now));

            SaleTransactionResponseMessage response =
                await this.TransactionProcessorAclClient.PerformSaleTransaction(App.TokenResponse.AccessToken, saleTransactionRequestMessage, CancellationToken.None);

            String responseJson = JsonConvert.SerializeObject(response);

            this.AnalysisLogger.TrackEvent(MessageReceivedFromHostEvent.Create(responseJson, DateTime.Now));

            if (response.ResponseCode != "0000")
            {
                return(false);
            }

            return(true);
        }
コード例 #2
0
        /// <summary>
        /// Performs the logon transaction.
        /// </summary>
        /// <exception cref="System.Exception">Error during logon transaction. Response Code [{response.ResponseCode}] Response Message [{response.ResponseMessage}]</exception>
        /// <exception cref="Exception">Error during logon transaction</exception>
        private async Task PerformLogonTransaction()
        {
            this.AnalysisLogger.TrackEvent(DebugInformationEvent.Create("About to Do Logon Transaction"));

            LogonTransactionRequestMessage logonTransactionRequestMessage = new LogonTransactionRequestMessage
            {
                DeviceIdentifier = this.Device.GetDeviceIdentifier(),
                RequireConfigurationInResponse = false,
                TransactionDateTime            = DateTime.Now,
                TransactionNumber = "1"                                                                 // TODO: Need to hold txn number somewhere
            };

            String requestJson = JsonConvert.SerializeObject(logonTransactionRequestMessage);

            this.AnalysisLogger.TrackEvent(MessageSentToHostEvent.Create(App.Configuration.TransactionProcessorACL, requestJson, DateTime.Now));

            LogonTransactionResponseMessage response =
                await this.TransactionProcessorAclClient.PerformLogonTransaction(App.TokenResponse.AccessToken, logonTransactionRequestMessage, CancellationToken.None);

            String responseJson = JsonConvert.SerializeObject(response);

            this.AnalysisLogger.TrackEvent(MessageReceivedFromHostEvent.Create(responseJson, DateTime.Now));

            if (response.ResponseCode != "0000")
            {
                throw new Exception($"Error during logon transaction. Response Code [{response.ResponseCode}] Response Message [{response.ResponseMessage}]");
            }
        }