コード例 #1
0
        public async Task Make3PartyPaymentAsync(string locationIdentifier,
                                                 long transactionId, long ticketId, int amount, int tip, string tenderType, string type)
        {
            GSPRPaymentCallback callbackDto = new GSPRPaymentCallback();

            try
            {
                callbackDto = await ticketRepository.AddPaymentAsync(
                    locationIdentifier, transactionId, ticketId, amount, tip, tenderType, type);

                Logger.LogInfo("Payment added.");
            }
            catch (ApiException ex)
            {
                callbackDto = new GSPRPaymentCallback()
                {
                    ErrorMessage  = ex.Message,
                    Success       = false,
                    TransactionID = transactionId
                };
                Logger.LogError("Cannot ad payment.", ex);
            }

            //TODO: add call to the endpoint(TBD) and pass to it GSPRPaymentCallback
        }
コード例 #2
0
        public async Task <GSPRPaymentCallback> AddPaymentAsync(string locationIdentifier, long transactionId,
                                                                long ticketId, int amount, int tip, string tenderType, string type)
        {
            string generalErrorMessage = "Cannot add payment.";

            PaymentCompleted response = await communicator.AddPayment(locationIdentifier, transactionId, ticketId, amount, tip, tenderType, type);

            GSPRPaymentCallback calbackDto = new GSPRPaymentCallback()
            {
                TransactionID = transactionId,
                Success       = (response == null) ? false : response.Successful,
            };

            if (!calbackDto.Success)
            {
                logger.LogWarn(generalErrorMessage);
                calbackDto.ErrorMessage = generalErrorMessage;
            }

            return(calbackDto);
        }