Beispiel #1
0
        public Transaction_Result Capture(AuthCapture_Details details)
        {
            try
            {
                var gateway = newClient();

                Result <Transaction> Tresult;
                if (details.Amount.HasValue)
                {
                    Tresult = gateway.Transaction.SubmitForSettlement(details.TransactionIndex, details.Amount.Value);
                }
                else
                {
                    Tresult = gateway.Transaction.SubmitForSettlement(details.TransactionIndex);
                }

                Transaction_Result result = formatResult(null, Tresult);
                return(result);
            }
            catch (Exception ex)
            {
                return(new Transaction_Result
                {
                    isApproved = false,
                    hasServerError = true,
                    ErrorText = ex.Message
                });
            }
        }
        //wont work with auto settle on
        public Transaction_Result Capture(AuthCapture_Details details)
        {
            if (isAutoSettleOn)
            {
                throw new Exception("Cannot do an capture only since gateway is configured to automatically mark authorisations to be settled");
            }

            string qs = getCaptureQS(CompanyID, Outlet, details.TransactionIndex, details.Amount.Value.ToString("F2"), Username, Password, details.CardNumber, details.ExpYear.ToString(), details.ExpMonth.ToString(), details.CVV);

            return(PostManagerTransaction("https://manager.setcom.co.za/captures2s.cfm", qs));
        }
        public Transaction_Result Capture(AuthCapture_Details details)
        {
            System.Collections.Specialized.NameValueCollection parameters = new System.Collections.Specialized.NameValueCollection();
            parameters.Add("auth_id", authID);
            parameters.Add("auth_pass", authPass);
            parameters.Add("cust_name", "");
            parameters.Add("cust_address", "");
            parameters.Add("cust_postcode", "");
            parameters.Add("cust_country", "");
            parameters.Add("cust_ip", "");
            parameters.Add("cust_email", "");
            parameters.Add("cust_tel", "");
            parameters.Add("tran_ref", "");
            parameters.Add("tran_amount", details.Amount.Value.ToString("F2"));
            parameters.Add("tran_currency", details.CurrencyCode);
            parameters.Add("tran_testmode", Mode);
            parameters.Add("tran_type", "sale");
            parameters.Add("tran_class", "cont");
            parameters.Add("tran_orig_id", details.TransactionIndex);

            var result = DoUrlEncodedFormPost("https://secure.cashflows.com/gateway/remote", parameters);

            var result_set = result.Split('|');

            if (result_set.Length != 5)
            {
                throw new Exception("Response format invalid");
            }

            var status = result_set[0];
            var transactionIdentifier = result_set[1];
            var avs       = result_set[2];
            var auth_code = result_set[3];
            var message   = result_set[4];

            bool isSuccess = status == "A";

            return(new Transaction_Result
            {
                ApprovalCode = isSuccess ? auth_code : "",
                ErrorCode = !isSuccess ? auth_code : "",
                ErrorText = !isSuccess ? message : "",
                FullRequest = KeyValueToQueryString(parameters),
                FullResponse = result,
                hasServerError = false,
                isApproved = isSuccess,
                isPending = false,
                ResultCode = avs,
                ResultText = message,
                TransactionIndex = transactionIdentifier
            });
        }
        public Transaction_Result Capture(AuthCapture_Details details)
        {
            bool isApproved = false;
            bool isPending  = false;

            try
            {
                StripeConfiguration.SetApiKey(secretKey);
                var          receivedTokenId = details.TransactionIndex;
                var          chargeOptions   = new StripeChargeCreateOptions();
                var          chargeService   = new StripeChargeService();
                StripeCharge charge          = new StripeCharge();
                charge.Captured = true;
                //charge = chargeService.Get(receivedTokenId);
                charge = chargeService.Capture(receivedTokenId);
                string status = charge.Status;
                if (status.Contains("succeeded"))
                {
                    isApproved = true;
                }
                else if (status.Contains("pending"))
                {
                    isPending = true;
                }
                return(new Transaction_Result
                {
                    isApproved = isApproved,
                    hasServerError = false,
                    isPending = isPending,
                    TransactionIndex = charge.BalanceTransactionId,
                    ProviderToken = charge.Id,
                    FullResponse = charge.StripeResponse.ResponseJson,
                    ApprovalCode = status,
                    ResultText = charge.Status
                });
            }
            catch (StripeException e)
            {
                //string errorMessage = handleStripeError(e);
                return(new Transaction_Result
                {
                    isApproved = false,
                    hasServerError = true,
                    ErrorText = e.StripeError.Message,
                    ErrorCode = e.StripeError.Code,
                    ProviderToken = null,
                    FullResponse = e.StripeError.StripeResponse.ResponseJson
                });
            }
        }
Beispiel #5
0
        public Transaction_Result Capture(AuthCapture_Details details)
        {
            try
            {
                var xmlString = getCaptureXML(userID, details.TransactionIndex);
                var xml       = PostXMLTransaction("https://www.vcs.co.za/vvonline/ccxmlsettle.asp", xmlString);

                XmlNode authResponse = xml.GetElementsByTagName("SettlementResponse").Item(0);
                var     responseNode = authResponse.SelectNodes("Response").Item(0);
                var     refNode      = authResponse.SelectNodes("Reference").Item(0);
                var     addResNode   = authResponse.SelectNodes("AdditionalResponseData").Item(0);

                var approved = responseNode.InnerText.Contains("APPROVED") && !responseNode.InnerText.Contains("NOT");

                var result = new Transaction_Result
                {
                    isApproved       = approved,
                    ApprovalCode     = approved ? responseNode.InnerText : "",
                    TransactionIndex = refNode.InnerText,
                    ProcessorCode    = addResNode.InnerText,
                    FullRequest      = xmlString,
                    FullResponse     = xml.OuterXml,
                    hasServerError   = false,
                    ErrorCode        = !approved ? responseNode.InnerText : "",
                    ErrorText        = addResNode.InnerText
                };

                return(result);
            }
            catch (Exception ex)
            {
                return(new Transaction_Result
                {
                    isApproved = false,
                    hasServerError = true,
                    ErrorText = ex.Message
                });
            }
        }
Beispiel #6
0
        public Transaction_Result Capture(AuthCapture_Details details)
        {
            try
            {
                var gateway = newClient();

                object[] arrResults = gateway.fProcess(
                    "01",                                                               //GatewayID
                    MerchantUID,                                                        //MerchantUID
                    PaymentApplicationUID,                                              //ApplicationUID
                    "3",                                                                //3 Capture Request                                             //Action
                    details.TransactionIndex,                                           //TransactionIndex
                    "",                                                                 //Terminal
                    Mode,                                                               //Mode
                    "",                                                                 //MerchantReference
                    details.Amount.HasValue ? details.Amount.Value.ToString("F2") : "", //Amount
                    "",                                                                 //Currency
                    "",                                                                 //CashBackAmount
                    "",                                                                 //CardType
                    "",                                                                 //AccountType
                    "",                                                                 //CardNumber
                    "",                                                                 //CardHolder
                    "",                                                                 //CCVNumber
                    "",                                                                 //ExpiryMonth
                    "",                                                                 //ExpiryYear
                    "",                                                                 //Budget - 0 Straight, 1 budget
                    "",                                                                 //BudgetPeriod
                    "",                                                                 //AuthorizationNumber
                    "",                                                                 //PIN
                    "",                                                                 //DebugMode
                    "",                                                                 //eCommerceIndicator
                    "",                                                                 //verifiedByVisaXID
                    "",                                                                 //verifiedByVisaCAFF
                    "",                                                                 //secureCodeUCAF
                    "",                                                                 //UCI
                    "",                                                                 //IP Address
                    "",                                                                 //Shipping Country Code,
                    ""                                                                  //Purchase Items ID
                    );


                var results = formatResult(arrResults);

                string cardnumber  = details.CardNumber;
                string last4digits = "";
                if (!String.IsNullOrEmpty(cardnumber))
                {
                    Regex rgx = new Regex(@"[^\d]");
                    cardnumber  = rgx.Replace(cardnumber, String.Empty); //removes dashes spaces, etc
                    last4digits = cardnumber.Substring(details.CardNumber.Length - 4);
                }


                var stringwriter = new System.IO.StringWriter();
                var xmlwriter    = XmlWriter.Create(stringwriter, new XmlWriterSettings {
                    NewLineHandling = NewLineHandling.None
                });
                var serializer = new XmlSerializer(details.GetType());
                serializer.Serialize(xmlwriter, details);
                var fullrequest = stringwriter.ToString();

                if (!String.IsNullOrEmpty(cardnumber))
                {
                    fullrequest = fullrequest.Replace(cardnumber, last4digits);
                }

                if (!String.IsNullOrEmpty(details.CVV))
                {
                    fullrequest = fullrequest.Replace(details.CVV, "***");
                }


                results.FullRequest = fullrequest;

                return(results);
            }
            catch (Exception ex)
            {
                return(new Transaction_Result
                {
                    isApproved = false,
                    hasServerError = true,
                    ErrorText = ex.Message
                });
            }
        }
Beispiel #7
0
        public Transaction_Result Capture(AuthCapture_Details details)
        {
            try
            {
                var gateway = newClient();

                DoTransactionResponseMessage gateWayResult = gateway.doTransaction(
                    "ONE_ZERO",
                    SafeKey,
                    transactionType.FINALIZE,
                    authenticationType.NA,
                    new additionalInfo {
                    merchantReference = "FINALIZE-" + details.TransactionIndex, payUReference = details.TransactionIndex
                },
                    null,
                    new basket {
                    amountInCents = (details.Amount * 100).ToString(), currencyCode = details.CurrencyCode
                },
                    null,
                    new creditCard[]
                {
                    new creditCard
                    {
                        amountInCents = (details.Amount * 100).ToString(),
                    }
                },
                    null,
                    null,
                    null,
                    null,
                    null,
                    null,
                    null,
                    null,
                    null,
                    null,
                    null,
                    null,
                    null,
                    null,
                    null
                    );

                var results = gateWayResult;


                if (results.successful)
                {
                    return(new Transaction_Result
                    {
                        isApproved = true,
                        ApprovalCode = results.resultCode,
                        ResultCode = results.resultCode,
                        ResultText = results.resultMessage,
                        TransactionIndex = results.payUReference,
                        hasServerError = false,
                        FullRequest = getXmlString(details),
                        FullResponse = getXmlString(results)
                    });
                }
                else
                {
                    return(new Transaction_Result
                    {
                        isApproved = false,
                        hasServerError = false,
                        ErrorCode = results.resultCode,
                        ErrorText = results.resultMessage,
                        FullResponse = getXmlString(results),
                        FullRequest = getXmlString(details)
                    });
                }
            }
            catch (Exception ex)
            {
                return(new Transaction_Result
                {
                    isApproved = false,
                    hasServerError = true,
                    ErrorText = ex.Message
                });
            }
        }
Beispiel #8
0
        public Transaction_Result Capture(AuthCapture_Details details)
        {
            try
            {
                var     xmlString = getCaptureXML(PayGateID, Password, details.TransactionIndex);
                var     xml       = GatewayUtils.PostXMLTransaction(url, xmlString);
                XmlNode protocol  = xml.GetElementsByTagName("protocol").Item(0);
                XmlNode errorNode = protocol.SelectNodes("errorrx").Item(0);

                var reqXmlDoc = new XmlDocument();
                reqXmlDoc.LoadXml(xmlString);

                var reqstringwriter = new System.IO.StringWriter();
                reqXmlDoc.Save(reqstringwriter);

                var respstringwriter = new System.IO.StringWriter();
                xml.Save(respstringwriter);

                if (errorNode == null)
                {
                    XmlNode successNode       = protocol.SelectNodes("settlerx").Item(0);
                    string  transactionID     = successNode.Attributes.GetNamedItem("tid").Value;   //The unique reference number assign by PayGate to the original transaction.
                    string  customerReference = successNode.Attributes.GetNamedItem("cref").Value;  //This is your reference number for use by your internal systems. Must be different per transaction
                    string  status            = successNode.Attributes.GetNamedItem("stat").Value;  //Transaction status.
                    string  statusDesc        = successNode.Attributes.GetNamedItem("sdesc").Value; //Transaction status description.
                    string  resultCode        = successNode.Attributes.GetNamedItem("res").Value;   //Result Code
                    string  resultDesc        = successNode.Attributes.GetNamedItem("rdesc").Value; //Result Code description.
                    return(new Transaction_Result
                    {
                        TransactionIndex = transactionID,
                        isApproved = status != "0" && status != "2",
                        ApprovalCode = statusDesc,
                        ResultCode = resultCode,
                        ResultText = resultDesc,
                        FullRequest = reqstringwriter.ToString(),
                        FullResponse = protocol.InnerXml
                    });
                }
                else
                {
                    string errorCode = errorNode.Attributes.GetNamedItem("ecode").Value;
                    string errorDesc = errorNode.Attributes.GetNamedItem("edesc").Value;

                    return(new Transaction_Result
                    {
                        isApproved = false,
                        hasServerError = false,
                        ErrorCode = errorCode,
                        ErrorText = errorDesc,
                    });
                }
            }
            catch (Exception ex)
            {
                return(new Transaction_Result
                {
                    isApproved = false,
                    hasServerError = true,
                    ErrorText = ex.Message
                });
            }
        }
 public Transaction_Result Capture(AuthCapture_Details details)
 {
     throw new NotImplementedException();
 }