Beispiel #1
0
        /// <summary>
        /// Performs a (partial) refund call on an existing transaction
        /// </summary>
        /// <param name="transactionId">Transaction ID</param>
        /// <param name="description">Reason for the refund. May be null.</param>
        /// <param name="amount">Amount of the refund. If null is given, it will be the full amount of the transaction.</param>
        /// <param name="processDate">Date to process the refund. May be null.</param>
        /// <returns>Full response including the Refund ID</returns>
        public PAYNLSDK.API.Transaction.Refund.Response Refund(string transactionId, string description = null, decimal?amount = null, DateTime?processDate = null)
        {
            var request = new TransactionRefund
            {
                TransactionId = transactionId,
                Description   = description,
                Amount        = amount,
                ProcessDate   = processDate
            };

            _webClient.PerformRequest(request);
            return(request.Response);
        }
Beispiel #2
0
        /// <summary>
        /// Performs a (partial) refund call on an existing transaction
        /// </summary>
        /// <param name="transactionId">Transaction ID</param>
        /// <param name="description">Reason for the refund. May be null.</param>
        /// <param name="amount">Amount of the refund. If null is given, it will be the full amount of the transaction.</param>
        /// <param name="processDate">Date to process the refund. May be null.</param>
        /// <returns>Full response including the Refund ID</returns>
        static public PAYNLSDK.API.Transaction.Refund.Response Refund(string transactionId, string description, int?amount, DateTime?processDate)
        {
            TransactionRefund request = new TransactionRefund();

            request.TransactionId = transactionId;
            request.Description   = description;
            request.Amount        = amount;
            request.ProcessDate   = processDate;
            Client c = new Client();

            c.PerformRequest(request);
            return(request.Response);
        }
Beispiel #3
0
        public async Task TransactionRefundAsync(string transactionID, string amount, string exchangeUrl)
        {
            try
            {
                ClearDebug();

                var parsed = int.TryParse(amount, out var numValue);

                if (!parsed || transactionID == "")
                {
                    if (!parsed)
                    {
                        AddDebug("foutieve invoer");
                        AddDebug("amount: only numbers. 3,40 must be filled in as 350");
                    }
                    AddDebug("foutieve invoer");
                    AddDebug("transactionID mag niet leeg zijn");
                }
                else if (exchangeUrl != "")
                {
                    AddDebug("-----");
                    AddDebug("Working with modified version of call");

                    var response = await new Transaction(ClientService)
                                   .RefundAsync(transactionID, null, numValue, null, exchangeUrl);

                    tbMain.Text = response.RefundId;
                }
                else
                {
                    var request = new PAYNLSDK.API.Transaction.Refund.Request
                    {
                        Amount        = numValue,
                        TransactionId = transactionID
                    };

                    InitRequestDebug(request);

                    await ClientService.PerformPostRequestAsync(request);

                    DebugRawResponse(request);

                    tbMain.Text = request.Response.RefundId;
                }
            }
            catch (ErrorException ee)
            {
                AddDebug("~~EXCEPTION~~");
                AddDebug(ee.Message);
            }
        }
Beispiel #4
0
        public void TransactionRefund(string transactionID, string amount, string exchangeUrl)
        {
            try
            {
                APISettings.InitAPI();
                ClearDebug();

                int  numValue;
                bool parsed = Int32.TryParse(amount, out numValue);
                if (!parsed || transactionID == "")
                {
                    if (!parsed)
                    {
                        AddDebug("foutieve invoer");
                        AddDebug("amount: only numbers. 3,40 must be filled in as 350");
                    }
                    AddDebug("foutieve invoer");
                    AddDebug("transactionID mag niet leeg zijn");
                }

                else if (exchangeUrl != "")
                {
                    APISettings.InitAPI();
                    AddDebug("-----");
                    AddDebug("Working with modified version of call");

                    PAYNLSDK.API.Transaction.Refund.Response response = Transaction.Refund(transactionID, null, numValue, null, exchangeUrl);

                    tbMain.Text = response.RefundId;
                }

                else
                {
                    PAYNLSDK.API.Transaction.Refund.Request request = new PAYNLSDK.API.Transaction.Refund.Request();
                    request.Amount        = numValue;
                    request.TransactionId = transactionID;

                    InitRequestDebug(request);

                    APISettings.Client.PerformRequest(request);
                    DebugRawResponse(request);

                    tbMain.Text = request.Response.RefundId;
                }
            }
            catch (ErrorException ee)
            {
                AddDebug("~~EXCEPTION~~");
                AddDebug(ee.Message);
            }
        }
Beispiel #5
0
        /// <summary>
        /// Performs a (partial) refund call on an existing transaction
        /// </summary>
        /// <param name="transactionId">Transaction ID</param>
        /// <param name="description">Reason for the refund. May be null.</param>
        /// <param name="amount">Amount of the refund. If null is given, it will be the full amount of the transaction.</param>
        /// <param name="processDate">Date to process the refund. May be null.</param>
        /// <returns>Full response including the Refund ID</returns>
        static public API.Transaction.Refund.Response Refund(IClient client, string transactionId, string description, int?amount, DateTime?processDate)
        {
            var request = new TransactionRefund()
            {
                TransactionId = transactionId,
                Description   = description,
                Amount        = amount,
                ProcessDate   = processDate
            };

            client.PerformRequest(request);

            return(request.Response);
        }
Beispiel #6
0
        public void Request_NoAmountSupplied_NoParameterWithAmount()
        {
            // Arrange
            var sut = new PAYNLSDK.API.Transaction.Refund.Request
            {
                TransactionId = "DUMMY",
                Amount        = null
            };

            // Act
            var result = sut.GetParameters();

            // Assert
            Assert.IsNull(result["amount"]);
        }
Beispiel #7
0
        public void Request_AmountInCents_PassedInAsDecimal()
        {
            // Arrange
            var sut = new PAYNLSDK.API.Transaction.Refund.Request
            {
                TransactionId = "DUMMY",
                Amount        = 3.50m
            };

            // Act
            var result = sut.GetParameters();

            // Assert
            Assert.AreEqual("350", result["amount"]);
        }
Beispiel #8
0
        public void TransactionRefund(string transactionID, string amount)
        {
            try
            {
                ClearDebug();

                var parsed = decimal.TryParse(amount, out var numValue);
                if (!parsed || transactionID == "")
                {
                    if (!parsed)
                    {
                        AddDebug("foutieve invoer");
                        AddDebug("amount: only numbers. 3,40 must be filled in as 350");
                    }
                    AddDebug("foutieve invoer");
                    AddDebug("transactionID mag niet leeg zijn");
                }
                else
                {
                    PAYNLSDK.API.Transaction.Refund.Request request = new PAYNLSDK.API.Transaction.Refund.Request();
                    request.Amount        = numValue;
                    request.TransactionId = transactionID;

                    InitRequestDebug(request);

                    MyStaticPayNlClient.Client.PerformRequest(request);
                    DebugRawResponse(request);

                    tbMain.Text = request.Response.RefundId;
                }
            }
            catch (PayNlException ee)
            {
                AddDebug("~~EXCEPTION~~");
                AddDebug(ee.Message);
            }
        }
Beispiel #9
0
 /// <summary>
 /// Performs a (partial) refund call on an existing transaction
 /// </summary>
 /// <param name="transactionId">Transaction ID</param>
 /// <param name="description">Reason for the refund. May be null.</param>
 /// <param name="amount">Amount of the refund. If null is given, it will be the full amount of the transaction.</param>
 /// <param name="processDate">Date to process the refund. May be null.</param>
 /// <returns>Full response including the Refund ID</returns>
 public static PAYNLSDK.API.Transaction.Refund.Response Refund(string transactionId, string description, int? amount, DateTime? processDate)
 {
     TransactionRefund request = new TransactionRefund();
     request.TransactionId = transactionId;
     request.Description = description;
     request.Amount = amount;
     request.ProcessDate = processDate;
     Client c = new Client();
     c.PerformRequest(request);
     return request.Response;
 }