Beispiel #1
0
        public void CreditTransaction()
        {
            var card = new Card
            {
                Name           = "APPROVED",
                Number         = "4097440000000004",
                ExpirationDate = "2040/12",
                SecurityCode   = 321
            };

            var tx = _kit.Payments.BuildCardTransaction(_proto, card, _buyer, _payer,
                                                        TransactionType.AuthorizeAndCapture());

            var response = _kit.Payments.ExecuteTransaction(tx);

            Assert.AreEqual(ResponseCode.Success, response.Code);
        }
Beispiel #2
0
        /// <summary>
        /// Create a transactional object for PSE debit transactions.
        /// </summary>
        /// <param name="proto">Contains all the information required to build a transaction.</param>
        /// <param name="buyer">The buyer for the transaction.</param>
        /// <param name="payer">The payer for the transaction. Can be the same as the buyer.</param>
        /// <param name="responseURL">The URL to send the user to when the PSE flow ends.</param>
        /// <param name="targetBank">The financial institution redirection to send the user to. <see cref="GetAvailablePSEBanks"/>.</param>
        /// <param name="docType">The Colombian-issued DNI type of the user who will perform the payment..</param>
        /// <param name="document">The Colombian-issued DNI of the user who will perform the payment.</param>
        /// <returns></returns>
        public Transaction BuildPSETransaction(TransactionPrototype proto, Buyer buyer, Payer payer, string responseURL, string targetBank, string docType, string document)
        {
            var baseTx = BuildBaseTransaction(proto, buyer, payer, TransactionType.AuthorizeAndCapture(), true);

            docType = docType.ToUpper();

            var userType = docType == "NIT" ? "J" : "N";

            baseTx.PaymentMethod  = "PSE";
            baseTx.PaymentCountry = "CO";

            baseTx.ExtraParameters = new RequestExtraParameters
            {
                InstallmentsNumber       = null,
                ResponseURL              = responseURL,
                UserIP                   = proto.IPAddress,
                FinancialInstitutionCode = targetBank,
                UserType                 = userType,
                DocumentType             = docType,
                UserDNI                  = document
            };

            return(baseTx);
        }