Exemple #1
0
        public void VerifyTestCall()
        {
            /*Init appliction configuration*/
            ApplicationConfig config = ObjectFactory.config;

            // TOKENIZE
            Dictionary <String, String> inputParams = new Dictionary <string, string>();

            inputParams.Add("number", "5424180279791732");
            inputParams.Add("nameOnCard", "mastercard");
            inputParams.Add("expiryYear", "2021");
            inputParams.Add("expiryMonth", "04");

            TokenizeCall tokenizeCall = new TokenizeCall(config, inputParams);
            Dictionary <String, String> tokenizeResult = tokenizeCall.Execute();

            Dictionary <String, String> authParams = new Dictionary <String, String>();

            authParams.Add("amount", "0");
            authParams.Add("channel", Channel.ECOM.GetCode());
            authParams.Add("country", CountryCode.PL.GetCode());
            authParams.Add("currency", CurrencyCode.PLN.GetCode());
            authParams.Add("paymentSolutionId", "500");
            authParams.Add("customerId", tokenizeResult["customerId"]);
            authParams.Add("specinCreditCardToken", tokenizeResult["cardToken"]);
            authParams.Add("specinCreditCardCVV", "111");
            authParams.Add("merchantNotificationUrl", "http://localhost:8080/api/TransactionResultCallback");

            //Do verify
            VerifyCall call = new VerifyCall(config, authParams);
            Dictionary <String, String> result = call.Execute();

            Assert.AreEqual(result["result"], "success");
        }
Exemple #2
0
        /// <summary>
        /// Do a CIT transaction which uses previous stored credentials to complete an authorization
        /// The merchantTrxID is returned from the initiated authorization transaction field "merchantTxId"
        /// Not just authorization support CIT, but Verify and purchase also support CIT
        /// </summary>
        /// <param name="config"></param>
        /// <param name="merchantTraID"></param>
        /// <returns></returns>
        private Dictionary <String, String> COFSubTrans_CIT_Auth(ApplicationConfig config, string merchantTrxID)
        {
            Dictionary <String, String> inputParams = new Dictionary <string, string>();

            inputParams.Add("number", "5424180279791732");
            inputParams.Add("nameOnCard", "mastercard");
            inputParams.Add("expiryYear", "2021");
            inputParams.Add("expiryMonth", "04");

            inputParams.Add("cardOnFileType", "Repeat");
            inputParams.Add("cardOnFileInitiator", "Cardholder");
            inputParams.Add("cardOnFileInitialTransactionId", merchantTrxID);

            TokenizeCall tokenizeCall = new TokenizeCall(config, inputParams);
            Dictionary <String, String> tokenizeResult = tokenizeCall.Execute();

            Dictionary <String, String> authParams = new Dictionary <String, String>();

            authParams.Add("amount", "20.0");
            authParams.Add("channel", Channel.ECOM.GetCode());
            authParams.Add("country", CountryCode.PL.GetCode());
            authParams.Add("currency", CurrencyCode.PLN.GetCode());
            authParams.Add("paymentSolutionId", "500");
            authParams.Add("customerId", tokenizeResult["customerId"]);
            authParams.Add("specinCreditCardToken", tokenizeResult["cardToken"]);
            authParams.Add("specinCreditCardCVV", "111");
            authParams.Add("merchantNotificationUrl", "http://localhost:8080/api/TransactionResultCallback");

            AuthCall call = new AuthCall(config, authParams);
            Dictionary <String, String> result = call.Execute();

            return(result);
        }
        public async Task <object> Post()
        {
            /* Get request paramters from HttpContent object, parse it to dictionary format*/
            string      test           = Properties.Settings.Default.password;
            HttpContent requestContent = Request.Content;
            string      res            = requestContent.ReadAsStringAsync().Result;
            Dictionary <String, String> requestData = Tools.requestToDictionary(res);

            /*Init appliction configuration, get a config object*/
            string merchantID = Properties.Settings.Default.merchantId;
            string password   = Properties.Settings.Default.password;
            string merchantNotificationUrl = Properties.Settings.Default.merchantNotificationUrl;
            string allowOriginUrl          = Properties.Settings.Default.allowOriginUrl;
            string merchantLandingPageUrl  = Properties.Settings.Default.merchantLandingPageUrl;
            string environment             = Properties.Settings.Default.TurnkeySdkConfig;

            ApplicationConfig config = new ApplicationConfig(merchantID, password, allowOriginUrl, merchantNotificationUrl,
                                                             merchantLandingPageUrl, environment);


            /*Execute the action call and get the response*/
            TokenizeCall tokenize = new TokenizeCall(config, requestData);
            Dictionary <string, string> response = tokenize.Execute();

            //return the response data to web page
            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }
        public void PurchaseToRefundTestCall()
        {
            /*Init appliction configuration*/
            ApplicationConfig config = ObjectFactory.config;

            // TOKENIZE
            Dictionary <String, String> tokenizeParams = new Dictionary <string, string>();

            tokenizeParams.Add("number", "5424180279791732");
            tokenizeParams.Add("nameOnCard", "mastercard");
            tokenizeParams.Add("expiryYear", "2021");
            tokenizeParams.Add("expiryMonth", "04");

            TokenizeCall tokenizeCall = new TokenizeCall(config, tokenizeParams);
            Dictionary <String, String> tokenizeResult = tokenizeCall.Execute();

            //Purchase
            Dictionary <String, String> authParams = new Dictionary <String, String>();

            authParams.Add("amount", "20.0");
            authParams.Add("channel", Channel.ECOM.GetCode());
            authParams.Add("country", CountryCode.PL.GetCode());
            authParams.Add("currency", CurrencyCode.PLN.GetCode());
            authParams.Add("paymentSolutionId", "500");
            authParams.Add("customerId", tokenizeResult["customerId"]);
            authParams.Add("specinCreditCardToken", tokenizeResult["cardToken"]);
            authParams.Add("specinCreditCardCVV", "111");
            authParams.Add("merchantNotificationUrl", "http://localhost:8080/api/TransactionResultCallback");

            PurchaseCall purchaseCall = new PurchaseCall(config, authParams);
            Dictionary <String, String> purchaseResult = purchaseCall.Execute();

            Assert.AreEqual(purchaseResult["result"], "success");

            if (purchaseResult["result"] == "success" && (purchaseResult["status"] == "SET_FOR_CAPTURE" || purchaseResult["status"] == "CAPTURED"))
            {
                string status = string.Empty;
                while (status != "CAPTURED")
                {
                    Dictionary <String, String> statusParam = new Dictionary <String, String>();
                    statusParam.Add("txId", purchaseResult["txId"]);

                    StatusCheckCall             statusCall   = new StatusCheckCall(config, statusParam);
                    Dictionary <String, String> statusResult = statusCall.Execute();
                    status = statusResult["status"];
                }

                Dictionary <String, String> refundParams = new Dictionary <String, String>();
                refundParams.Add("originalMerchantTxId", purchaseResult["merchantTxId"]);
                refundParams.Add("amount", "20.0");

                RefundCall cCall = new RefundCall(config, refundParams);
                Dictionary <String, String> cptrueResult = cCall.Execute();

                Assert.AreEqual(cptrueResult["result"], "success");
                Assert.AreEqual(cptrueResult["status"], "SET_FOR_REFUND");
            }
        }
        public void CaptureToVoidExTestCall()
        {
            /*Init appliction configuration*/
            ApplicationConfig config = ObjectFactory.config;

            // TOKENIZE
            Dictionary <String, String> tokenizeParams = new Dictionary <string, string>();

            tokenizeParams.Add("number", "5424180279791732");
            tokenizeParams.Add("nameOnCard", "mastercard");
            tokenizeParams.Add("expiryYear", "2021");
            tokenizeParams.Add("expiryMonth", "04");

            TokenizeCall tokenizeCall = new TokenizeCall(config, tokenizeParams);
            Dictionary <String, String> tokenizeResult = tokenizeCall.Execute();

            Dictionary <String, String> authParams = new Dictionary <String, String>();

            authParams.Add("amount", "20.0");
            authParams.Add("channel", Channel.ECOM.GetCode());
            authParams.Add("country", CountryCode.PL.GetCode());
            authParams.Add("currency", CurrencyCode.PLN.GetCode());
            authParams.Add("paymentSolutionId", "500");
            authParams.Add("customerId", tokenizeResult["customerId"]);
            authParams.Add("specinCreditCardToken", tokenizeResult["cardToken"]);
            authParams.Add("specinCreditCardCVV", "111");
            authParams.Add("merchantNotificationUrl", "http://localhost:8080/api/TransactionResultCallback");

            AuthCall authCall = new AuthCall(config, authParams);
            Dictionary <String, String> authResult = authCall.Execute();

            Assert.AreEqual(authResult["result"], "success");

            if (authResult["result"] == "success" && authResult["status"] == "NOT_SET_FOR_CAPTURE")
            {
                // CAPTURE
                Dictionary <String, String> captrueInputParams = new Dictionary <String, String>();
                captrueInputParams.Add("originalMerchantTxId", authResult["merchantTxId"]);
                captrueInputParams.Add("amount", "20.0");

                CaptureCall captureCall = new CaptureCall(config, captrueInputParams);
                Dictionary <String, String> captureResult = captureCall.Execute();
                if (captureResult["result"] == "success")
                {
                    // VOID
                    Dictionary <String, String> inputParams = new Dictionary <String, String>();
                    inputParams.Add("originalMerchantTxId", authResult["merchantTxId"]);
                    //inputParams.Add("country", "FR");
                    //inputParams.Add("currency", "EUR");

                    VoidCall call = new VoidCall(config, inputParams);
                    Dictionary <String, String> result = call.Execute();

                    Assert.AreEqual(result["result"], "success");
                }
            }
        }
Exemple #6
0
        public void ExExpTestCall()
        {
            Dictionary <String, String> inputParams = new Dictionary <string, string>();

            inputParams.Add("number", "5424180279791732");
            inputParams.Add("nameOnCard", "mastercard");
            inputParams.Add("expiryYear", "2010");

            /*Init appliction configuration*/
            ApplicationConfig config = ObjectFactory.config;

            TokenizeCall call = new TokenizeCall(config, inputParams);
            Dictionary <String, String> result = call.Execute();

            Assert.AreEqual(result["result"], "failure");
        }
Exemple #7
0
        /// <summary>
        /// To initiate a recurring transaction by completing an purchase transaction with card on file required parameters
        /// For Recurring Payments this must be “PURCHASE” or “VERIFY”
        /// Fields mmrpCustomerPresent, mmrpContractNumber ,mmrpExistingDebt,mmrpCurrentInstallmentNumber,mmrpOriginalMerchantTransactionId are required when mmrpBillPayment is set to "Recurring"
        /// </summary>
        /// <param name="config"></param>
        /// <returns></returns>
        private Dictionary <String, String> COFInitiateRecurringTran_Purchase(ApplicationConfig config, string merchantTrxID)
        {
            Dictionary <String, String> inputParams = new Dictionary <string, string>();

            inputParams.Add("number", "5424180279791732");
            inputParams.Add("nameOnCard", "mastercard");
            inputParams.Add("expiryYear", "2021");
            inputParams.Add("expiryMonth", "04");

            //Card on file parameter
            inputParams.Add("cardOnFileType", "Repeat");
            inputParams.Add("cardOnFileInitiator", "Merchant");
            inputParams.Add("cardOnFileInitialTransactionId", merchantTrxID);

            //Recurring parameter
            inputParams.Add("mmrpBillPayment", "Recurring");
            inputParams.Add("mmrpCustomerPresent", "BillPayment");
            inputParams.Add("mmrpContractNumber", "12345678");
            inputParams.Add("mmrpExistingDebt", "NotExistingDebt");
            inputParams.Add("mmrpCurrentInstallmentNumber", "1");
            inputParams.Add("mmrpOriginalMerchantTransactionId", merchantTrxID);

            TokenizeCall tokenizeCall = new TokenizeCall(config, inputParams);
            Dictionary <String, String> tokenizeResult = tokenizeCall.Execute();

            Dictionary <String, String> authParams = new Dictionary <String, String>();

            authParams.Add("amount", "20.0");
            authParams.Add("channel", Channel.ECOM.GetCode());
            authParams.Add("country", CountryCode.PL.GetCode());
            authParams.Add("currency", CurrencyCode.PLN.GetCode());
            authParams.Add("paymentSolutionId", "500");
            authParams.Add("customerId", tokenizeResult["customerId"]);
            authParams.Add("specinCreditCardToken", tokenizeResult["cardToken"]);
            authParams.Add("specinCreditCardCVV", "111");
            authParams.Add("merchantNotificationUrl", "http://localhost:8080/api/TransactionResultCallback");

            PurchaseCall call = new PurchaseCall(config, authParams);
            Dictionary <String, String> result = call.Execute();

            return(result);
        }
Exemple #8
0
        public void noExTestCall()
        {
            Dictionary <String, String> inputParams = new Dictionary <string, string>();

            inputParams.Add("number", "5424180279791732");
            inputParams.Add("nameOnCard", "mastercard");
            inputParams.Add("expiryYear", "2021");
            inputParams.Add("expiryMonth", "04");
            inputParams.Add("customerId", "123456789");
            inputParams.Add("cardDescription", "test");


            /*Init appliction configuration*/
            ApplicationConfig config = ObjectFactory.config;

            //Do tokenize
            TokenizeCall call = new TokenizeCall(config, inputParams);
            Dictionary <String, String> result = call.Execute();

            Assert.AreEqual(result["result"], "success");
        }