コード例 #1
0
        private async Task DeleteTriggeredPayment()
        {
            try
            {
                var deleteRequest = new DeletePaymentRequest {
                    ClientId = ClientId
                };
                var deleteResponse = await Client.DeletePaymentAsync(deleteRequest);

                Assert.AreEqual(true, deleteResponse.Successful);
            }
            catch
            {
                LogMessages();
                throw;
            }
        }
コード例 #2
0
ファイル: PeriodicClient.cs プロジェクト: jjeffery/SecurePay
        public async Task<DeletePaymentResponse> DeletePaymentAsync(DeletePaymentRequest request)
        {
            var requestMessage = new PeriodicRequestMessage();
            var periodicItem = requestMessage.Periodic.PeriodicList.PeriodicItem;
            periodicItem.ActionType = "delete";
            periodicItem.ClientId = request.ClientId;

            var responseMessage = await PostAsync<PeriodicRequestMessage, PeriodicResponseMessage>(requestMessage);
            periodicItem = responseMessage.Periodic.PeriodicList.PeriodicItem;

            var response = new DeletePaymentResponse
            {
                Successful = periodicItem.Successful == "yes",
                ResponseCode = periodicItem.ResponseCode,
                ResponseText = periodicItem.ResponseText,
            };

            return response;
        }
コード例 #3
0
        public async Task <DeletePaymentResponse> DeletePaymentAsync(DeletePaymentRequest request)
        {
            var requestMessage = new PeriodicRequestMessage();
            var periodicItem   = requestMessage.Periodic.PeriodicList.PeriodicItem;

            periodicItem.ActionType = "delete";
            periodicItem.ClientId   = request.ClientId;

            var responseMessage = await PostAsync <PeriodicRequestMessage, PeriodicResponseMessage>(requestMessage);

            periodicItem = responseMessage.Periodic.PeriodicList.PeriodicItem;

            var response = new DeletePaymentResponse
            {
                Successful   = periodicItem.Successful == "yes",
                ResponseCode = periodicItem.ResponseCode,
                ResponseText = periodicItem.ResponseText,
            };

            return(response);
        }
コード例 #4
0
        public CommunicationResponse DeletePayment([FromBody] DeletePaymentRequest paymentRequest)
        {
            var response = new CommunicationResponse();

            try
            {
                if (_userService.AuthenticateSession(Request.Headers["Authorization"].ToString()) == false)
                {
                    response.AddError("The authorization credentails were invalid", ErrorCode.SESSION_INVALID);
                    return(response);
                }

                var rowUpdated = _billRepository.DeletePayment(paymentRequest.PaymentId);

                if (rowUpdated == false)
                {
                    response.AddError($"Cannot delete the payment (ID: {paymentRequest.PaymentId}) because it does not exist");
                    return(response);
                }

                response.Notifications = new List <string>
                {
                    $"The payment (ID: {paymentRequest.PaymentId}) has been deleted"
                };
            }
            catch (ErrorCodeException exception)
            {
                response.AddError($"An unexpected exception occured: {exception}", paymentRequest, exception.Code);
            }
            catch (Exception exception)
            {
                response.AddError($"An unexpected exception occured: {exception}", paymentRequest);
            }

            return(response);
        }
コード例 #5
0
        private async Task DeleteTriggeredPayment()
        {
            try
            {
                var deleteRequest = new DeletePaymentRequest {ClientId = ClientId};
                var deleteResponse = await Client.DeletePaymentAsync(deleteRequest);
                Assert.AreEqual(true, deleteResponse.Successful);
            }
            catch
            {
                LogMessages();
                throw;
            }

        }
コード例 #6
0
 /// <remarks/>
 public void DeletePaymentAsync(DeletePaymentRequest DeletePaymentRequest, object userState) {
     if ((this.DeletePaymentOperationCompleted == null)) {
         this.DeletePaymentOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDeletePaymentOperationCompleted);
     }
     this.InvokeAsync("DeletePayment", new object[] {
                 DeletePaymentRequest}, this.DeletePaymentOperationCompleted, userState);
 }
コード例 #7
0
 /// <remarks/>
 public void DeletePaymentAsync(DeletePaymentRequest DeletePaymentRequest) {
     this.DeletePaymentAsync(DeletePaymentRequest, null);
 }