Beispiel #1
0
 public APIController(MerchantConfig merchantConfig)
 {
     _logger = LogManager.GetCurrentClassLogger();
     Enumerations.ValidateRequestType(merchantConfig.RequestType);
     Enumerations.SetRequestType(merchantConfig);
     _paymentRequestService = new PaymentRequestService(merchantConfig);
 }
        public static void Run()
        {
            try
            {
                // Setting up Merchant Config
                var merchantConfig = new MerchantConfig
                {
                    RequestTarget = RequestTarget,
                    RequestType   = Enumerations.RequestType.GET.ToString()
                };

                // Call to the Controller of API_SDK
                var apiController = new APIController(merchantConfig);
                var response      = apiController.GetPayment();

                // printing the response details
                if (response != null)
                {
                    Console.WriteLine("\n v-c-correlation-id:{0}", response.GetResponseHeaderValue(response.Headers, "v-c-correlation-id"));
                    Console.WriteLine("\n Response Code:{0}", response.StatusCode);
                    Console.WriteLine("\n Response Message:{0}", response.Data);
                }
            }
            catch (Exception e)
            {
                ExceptionUtility.Exception(e.Message, e.StackTrace);
            }
        }
Beispiel #3
0
        public static void Run()
        {
            try
            {
                // Setting up Merchant Config
                var config = new Configuration();

                // Setting RequestJson Data using the sample payments data (instead of reading a JSON file)
                var requestData = new RequestData();

                var merchantConfig = new MerchantConfig(config.GetConfiguration())
                {
                    RequestTarget   = RequestTarget,
                    RequestType     = Enumerations.RequestType.POST.ToString(),
                    RequestJsonData = requestData.SamplePaymentsData()
                };

                // Call to the Controller of API_SDK
                var apiController = new APIController(merchantConfig);
                var response      = apiController.PostPayment();

                // printing the response details
                if (response != null)
                {
                    Console.WriteLine("\n v-c-correlation-id:{0}", response.GetResponseHeaderValue(response.Headers, "v-c-correlation-id"));
                    Console.WriteLine("\n Response Code:{0}", response.StatusCode);
                    Console.WriteLine("\n Response Message:{0}", response.Data);
                }
            }
            catch (Exception e)
            {
                ExceptionUtility.Exception(e.Message, e.StackTrace);
            }
        }
Beispiel #4
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            var clientReferenceInformationObj = new V2paymentsClientReferenceInformation("Testing-VDP-Payments-Refund");
            var amountDetailsObj    = new V2paymentsidcapturesOrderInformationAmountDetails("102.21", "USD");
            var orderInformationObj = new V2paymentsidrefundsOrderInformation(amountDetailsObj);
            var requestBody         = new RefundPaymentRequest(clientReferenceInformationObj, null, null, orderInformationObj);

            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType     = "POST",
                RequestTarget   = "/pts/v2/payments/5336232827876732903529/refunds",
                RequestJsonData = JsonConvert.SerializeObject(requestBody)
            };

            try
            {
                var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                var apiInstance          = new RefundApi(configurationSwagger);
                var result = apiInstance.RefundPayment(requestBody, "5336232827876732903529");
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
Beispiel #5
0
        public void TestInit()
        {
            IdentityParam identityParam = new IdentityParam()
            {
                IdentityType = "CERT_INFO",
                CertType     = "IDENTITY_CARD",
                CertName     = "张三",
                CertNo       = "513901198008089876"
            };

            MerchantConfig merchantConfig = new MerchantConfig()
            {
                ReturnUrl = "www.taobao.com"
            };


            AlipayUserCertifyOpenInitializeResponse response = Factory.Member.Identification().Init(
                Guid.NewGuid().ToString(), "FACE", identityParam, merchantConfig);

            Assert.IsTrue(ResponseChecker.Success(response));
            Assert.AreEqual(response.Code, "10000");
            Assert.AreEqual(response.Msg, "Success");
            Assert.IsNull(response.SubCode);
            Assert.IsNull(response.SubMsg);
            Assert.NotNull(response.HttpBody);
            Assert.NotNull(response.CertifyId);
        }
Beispiel #6
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            const string reportId       = "TRRReport";
            const string organizationId = "testrest";

            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType   = "GET",
                RequestTarget = $"/reporting/v2/reports/{reportId}?organizationId={organizationId}"
            };

            try
            {
                Console.WriteLine("No Implementation");

                //var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                //var apiInstance = new ReportsApi(configurationSwagger);
                //var result = apiInstance.GetReportByReportId(reportId, organizationId);
                //Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
Beispiel #7
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            const string startTime = "2018-05-01T12:00:00-05:00";
            const string endTime   = "2018-05-30T12:00:00-05:00";

            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType   = "GET",
                RequestTarget = $"/reporting/v3/notification-of-changes?startTime={startTime}&endTime={endTime}"
            };

            try
            {
                Console.WriteLine("No Implementation");

                //var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                //var apiInstance = new NotificationOfChangesApi(configurationSwagger);
                //var result = apiInstance.GetNotificationOfChangeReport(startTime, endTime);
                //Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
        public static void Run()
        {
            try
            {
                // Creating a dictionary object which contains the merchant configuration
                var config = new Configuration();

                // Passing the dictionary object to the Merchant Config Constructor to bypass the config set up via App.Config File
                var merchantConfig = new MerchantConfig(config.GetConfiguration())
                {
                    RequestTarget = RequestTarget,
                    RequestType   = Enumerations.RequestType.GET.ToString()
                };

                // Call to the Controller of API_SDK
                var apiController = new APIController(merchantConfig);
                var response      = apiController.GetPayment();

                // printing the response details
                if (response != null)
                {
                    Console.WriteLine("\n v-c-correlation-id:{0}", response.GetResponseHeaderValue(response.Headers, "v-c-correlation-id"));
                    Console.WriteLine("\n Response Code:{0}", response.StatusCode);
                    Console.WriteLine("\n Response Message:{0}", response.Data);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine(e.StackTrace);
            }
        }
        public void MustBeAbleToFetchSinglePayout()
        {
            var config        = new MerchantConfig("K500746", "fia'w2ahSheahahc", Server.Playground);
            var payoutsGetter = new Payouts();
            var payout        = payoutsGetter.GetSinglePayout("FYCK", config);

            Assert.IsNotNull(payout);
        }
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="acquirerCertificate"><see cref="AcquirerCertificate" /> to be used, reverts to configuration if not set.</param>
        /// <param name="clientCertificate"><see cref="ClientCertificate" /> to be used, reverts to configuration if not set.</param>
        /// <param name="merchantId"></param>
        /// <param name="merchantSubId"></param>
        /// <param name="acquirerUrl"></param>
        /// <exception cref="UriFormatException">Url is not in correct format.</exception>
        /// <exception cref="InvalidCastException">Configuration setting has invalid format.</exception>
        /// <exception cref="ConfigurationErrorsException">Configuration setting is missing.</exception>
        public Connector(X509Certificate2 acquirerCertificate = null, X509Certificate2 clientCertificate = null,
                         string merchantId = null, string merchantSubId = null, string acquirerUrl = null)
        {
            // Copy configuration from default configuration
            merchantConfig = (MerchantConfig)DefaultMerchantConfig(acquirerCertificate, clientCertificate, merchantId, merchantSubId, acquirerUrl).Clone();

            Resources.Culture = CultureInfo.CurrentCulture;
        }
Beispiel #11
0
        public object SaveMerchantConfig([FromBody] MerchantConfig objMerchantConfig)
        {
            try
            {
                //if (isEditMode != true)
                //{
                //    try
                //    {
                //        cashEntry.TransNo = _distributorDepositService.GetTransactionNo();
                //        cashEntry.TransDate = System.DateTime.Now;
                //        _distributorDepositService.Add(cashEntry);
                //    }
                //    catch (Exception)
                //    {

                //        throw;
                //    }

                //    return true;

                //}
                //else
                //{
                //    if (evnt == "edit")
                //    {

                objMerchantConfig.UpdateTime = System.DateTime.Now;
                return(MerchantConfigService.UpdateByStringField(objMerchantConfig, "Mphone"));

                //    }
                //    else if (evnt == "register")
                //    {
                //        cashEntry.Status = "P";
                //        cashEntry.CheckedDate = System.DateTime.Now;
                //        //here have to insert Balance_M into Reginfo
                //        _distributorDepositService.UpdateByStringField(cashEntry, "TransNo");
                //        //insert into gl_trans_dtl and gl_trans_mst and RegInfo
                //        _distributorDepositService.DataInsertToTransMSTandDTL(cashEntry);

                //        return true;
                //    }
                //    else
                //    {
                //        cashEntry.Status = "M";// M means pass to maker
                //        cashEntry.CheckedDate = System.DateTime.Now;
                //        _distributorDepositService.UpdateByStringField(cashEntry, "TransNo");
                //        return true;
                //    }

                //}
            }
            catch (Exception)
            {
                throw;
            }
        }
 /// <summary>
 /// Initiating a new Klarna Offline Order
 /// </summary>
 /// <param name="cart">The cart for the order</param>
 /// <param name="config">The merchant config to be used</param>
 /// <param name="terminal">What terminal is the purchase from?</param>
 /// <param name="phonenumber">Phonenumber of the customer incl countrycode</param>
 /// <param name="merchantReference">The store-reference for this order</param>
 public OfflineOrder(Klarna.Entities.Cart cart, MerchantConfig config, string terminal, string phonenumber, string merchantReference, bool autoActivate = true) : base(cart, config)
 {
     mobile_no     = phonenumber;
     _status       = Status.NotSent;
     _cart         = cart;
     _config       = config;
     _terminalId   = terminal;
     auto_activate = autoActivate;
     verifyPhoneForCountry();
     _merchantReference = merchantReference;
 }
Beispiel #13
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            var requestObj = new Body2();

            var paymentInformationCardObj = new PaymentinstrumentsCard();

            paymentInformationCardObj.ExpirationMonth = "09";
            paymentInformationCardObj.ExpirationYear  = "2022";
            paymentInformationCardObj.Type            = PaymentinstrumentsCard.TypeEnum.Visa;
            requestObj.Card = paymentInformationCardObj;

            var v2paymentsOrderInformationBillToObj = new PaymentinstrumentsBillTo();

            v2paymentsOrderInformationBillToObj.FirstName          = "John";
            v2paymentsOrderInformationBillToObj.LastName           = "Smith";
            v2paymentsOrderInformationBillToObj.Company            = "CyberSource";
            v2paymentsOrderInformationBillToObj.Address1           = "12 Main Street";
            v2paymentsOrderInformationBillToObj.Address2           = "20 My Street";
            v2paymentsOrderInformationBillToObj.Locality           = "Foster City";
            v2paymentsOrderInformationBillToObj.AdministrativeArea = "CA";
            v2paymentsOrderInformationBillToObj.PostalCode         = "90200";
            v2paymentsOrderInformationBillToObj.Country            = "US";
            v2paymentsOrderInformationBillToObj.Email       = "*****@*****.**";
            v2paymentsOrderInformationBillToObj.PhoneNumber = "555123456";
            requestObj.BillTo = v2paymentsOrderInformationBillToObj;

            var instrumentIdentifierObj = new PaymentinstrumentsInstrumentIdentifier();

            var v2paymentsPaymentInformationCardObj = new InstrumentidentifiersCard();

            v2paymentsPaymentInformationCardObj.Number = "4111111111111111";
            instrumentIdentifierObj.Card = v2paymentsPaymentInformationCardObj;

            requestObj.InstrumentIdentifier = instrumentIdentifierObj;

            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType     = "POST",
                RequestTarget   = "/tms/v1/paymentinstruments",
                RequestJsonData = JsonConvert.SerializeObject(requestObj)
            };

            try
            {
                var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                var apiInstance          = new PaymentInstrumentApi(configurationSwagger);
                var result = apiInstance.PaymentinstrumentsPost("93B32398-AD51-4CC2-A682-EA3E93614EB1", requestObj);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
Beispiel #14
0
        public void MustBeAbleToReachCreateOrder()
        {
            MerchantConfig config = new MerchantConfig("K500746", "fia'w2ahSheahahc", Server.Playground);
            OrderHandler   oh     = new OrderHandler(config);
            MerchantUrls   urls   = new MerchantUrls();
            var            lines  = new List <PaymentsOrderLine> {
                new PaymentsOrderLine("test", 1, 1000, 2500)
            };
            PaymentsOrder o = new PaymentsOrder(lines, urls);

            oh.CreateOrder("3eaeb557-5e30-47f8-b840-b8d987f5945d", o);
        }
        public static JwtToken GetToken(MerchantConfig merchantConfig)
        {
            var authorizeObj = new Authorize(merchantConfig);
            var token        = authorizeObj.GetToken();

            if (token == null)
            {
                throw new Exception($"{Constants.ErrorPrefix} Null Token Returned by the AuthSdk");
            }

            return(token);
        }
Beispiel #16
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            var requestObj = new CreatePaymentRequest();

            var v2PaymentsClientReferenceInformationObj = new V2paymentsClientReferenceInformation
            {
                Code = "TC45572-1"
            };

            requestObj.ClientReferenceInformation = v2PaymentsClientReferenceInformationObj;

            var v2PaymentsOrderInformationObj = new V2paymentsOrderInformation();

            var v2PaymentsOrderInformationAmountDetailsObj = new V2paymentsOrderInformationAmountDetails
            {
                TotalAmount = "5432",
                Currency    = "USD"
            };

            v2PaymentsOrderInformationObj.AmountDetails = v2PaymentsOrderInformationAmountDetailsObj;

            requestObj.OrderInformation = v2PaymentsOrderInformationObj;

            var v2PaymentsPaymentInformationObj = new V2paymentsPaymentInformation();

            var customerObj = new V2paymentsPaymentInformationCustomer
            {
                CustomerId = "5303162577043192705841"
            };

            v2PaymentsPaymentInformationObj.Customer = customerObj;

            requestObj.PaymentInformation = v2PaymentsPaymentInformationObj;

            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType     = "POST",
                RequestTarget   = "/pts/v2/payments",
                RequestJsonData = JsonConvert.SerializeObject(requestObj)
            };

            try
            {
                var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                var apiInstance          = new PaymentApi(configurationSwagger);
                var result = apiInstance.CreatePayment(requestObj);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
        public static HttpToken GetSignature(MerchantConfig merchantConfig)
        {
            var authorizeObj = new Authorize(merchantConfig);
            var signature    = authorizeObj.GetSignature();

            if (signature == null)
            {
                throw new Exception($"{Constants.ErrorPrefix} Null Signature Returned by the AuthSdk");
            }

            return(signature);
        }
Beispiel #18
0
 /// <summary>
 /// Initialize JWT token from Merchant Config.
 /// </summary>
 /// <param name="merchantConfig">Configuration for consumer (merchant).</param>
 public JwtToken(MerchantConfig merchantConfig)
 {
     RequestJsonData = merchantConfig.RequestJsonData;
     HostName        = merchantConfig.HostName;
     P12FilePath     = merchantConfig.P12Keyfilepath;
     if (!File.Exists(P12FilePath))
     {
         throw new TokenException($"{Constants.ErrorPrefix} File not found at the given path: {Path.GetFullPath(P12FilePath)}");
     }
     KeyAlias    = merchantConfig.KeyAlias;
     KeyPass     = merchantConfig.KeyPass;
     Certificate = Cache.FetchCachedCertificate(P12FilePath, KeyPass);
 }
Beispiel #19
0
 public JwtToken(MerchantConfig merchantConfig)
 {
     this.RequestJsonData = merchantConfig.RequestJsonData;
     this.HostName        = merchantConfig.HostName;
     this.P12FilePath     = merchantConfig.P12Keyfilepath;
     if (!File.Exists(this.P12FilePath))
     {
         throw new Exception(Constants.ErrorPrefix + " File not found at the given path: " + Path.GetFullPath(this.P12FilePath));
     }
     this.KeyAlias    = merchantConfig.KeyAlias;
     this.KeyPass     = merchantConfig.KeyPass;
     this.Certificate = Cache.FetchCachedCertificate(this.P12FilePath, this.KeyPass);
 }
        public void GetTokenTest_Get_MerchCfgObj()
        {
            var merchConfigObj = new MerchantConfig
            {
                AuthenticationType = "jwt",
                RequestType        = "GET"
            };
            var authObj = new Authorize(merchConfigObj);

            var testObj = authObj.GetToken();

            Assert.IsInstanceOf(typeof(JwtToken), testObj);
        }
Beispiel #21
0
        public void MustBeAbleToGetAllTransactions()
        {
            var config = new MerchantConfig("K500746", "fia'w2ahSheahahc", Server.Playground);

            TransactionRequest req = new TransactionRequest()
            {
                Offset = 0,
                Size   = 10
            };
            var payoutsGetter = new Transactions();
            var listOfPayouts = payoutsGetter.GetTransactions(req, config);

            Assert.IsNotNull(listOfPayouts);
        }
        /// <summary>
        /// Initialize token from Merchant Config.
        /// </summary>
        /// <param name="merchantConfig">Configuration for consumer (merchant).</param>
        public HttpToken(MerchantConfig merchantConfig)
        {
            SignatureAlgorithm = Constants.SignatureAlgorithm;
            DateTime dateTime = DateTime.Now;

            dateTime              = dateTime.ToUniversalTime();
            GmtDateTime           = dateTime.ToString("r");
            RequestJsonData       = merchantConfig.RequestJsonData;
            HostName              = merchantConfig.HostName;
            MerchantId            = merchantConfig.MerchantId;
            MerchantSecretKey     = merchantConfig.MerchantSecretKey;
            MerchantKeyId         = merchantConfig.MerchantKeyId;
            HttpSignRequestTarget = $"{merchantConfig.RequestType.ToString().ToLower()} {merchantConfig.RequestTarget}";
        }
        public HttpClient GetConnectionForGet(MerchantConfig merchantConfig)
        {
            var token           = AuthenticationHelper.GetToken(merchantConfig);
            var httpConnUtility = new HttpConnUtility(merchantConfig.ProxyAddress, merchantConfig.ProxyPort, merchantConfig.TimeOut);
            var client          = httpConnUtility.GetHttpClient();

            client.DefaultRequestHeaders
            .Accept
            .Add(new MediaTypeWithQualityHeaderValue(Constants.MediaTypeHalAndJson));

            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(Constants.Bearer, token.BearerToken);

            return(client);
        }
        public HttpClient GetConnectionForPut(MerchantConfig merchantConfig)
        {
            var token           = AuthenticationHelper.GetToken(merchantConfig);
            var httpConnUtility = new HttpConnUtility(merchantConfig.ProxyAddress, merchantConfig.ProxyPort, merchantConfig.TimeOut);
            var client          = httpConnUtility.GetHttpClient();

            var content = new StringContent(merchantConfig.RequestJsonData);

            content.Headers.ContentType = new MediaTypeHeaderValue(Constants.MediaTypeJson);

            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(Constants.Bearer, token.BearerToken);

            return(client);
        }
Beispiel #25
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            const string reportName = "subscriptionAutomation2";

            //var requestObj = new Request();

            //requestObj.ReportDefinitionName = "TransactionRequestClass";
            //var reportFieldsObj = new List<string>();
            //reportFieldsObj.Add("Request.RequestID");
            //reportFieldsObj.Add("Request.TransactionDate");
            //reportFieldsObj.Add("Request.MerchantID");

            //requestObj.ReportFields = reportFieldsObj;

            //requestObj.ReportMimeType = "application/xml";
            //requestObj.ReportFrequency = "DAILY";
            //requestObj.Timezone = "America/Chicago";
            //requestObj.StartTime = "0900";
            //requestObj.StartDay = "1";
            //var reportFiltersObj = new ReportFilters();

            //requestObj.ReportFilters = reportFiltersObj;

            //var reportPreferencesObj = new ReportPreferences();

            //reportPreferencesObj.SignedAmounts = "False";
            //requestObj.ReportPreferences = reportPreferencesObj;

            //requestObj.OrganizationId = "uday_wf";

            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType   = "PUT",
                RequestTarget = $"/reporting/v3/report-subscriptions/{reportName}"
            };

            try
            {
                Console.WriteLine("No Implementation");

                //var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                //var apiInstance = new ReportSubscriptionsApi(configurationSwagger);
                //var result = apiInstance.CreateSubscription(reportName, requestBody);
                //Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
        private HttpWebResponse DoRequest(MerchantConfig config, string path, string method)
        {
            var digest      = _digestCreator.CreateDigest(config.merchantId, config.sharedSecret);
            var apiLocation = GetApiLocation(config);

            try
            {
                return(_requestHelper.CreateRequest(digest, new Uri(apiLocation + "" + path), method, useragent: "Mnording Settlement API " + Assembly.GetExecutingAssembly().GetName().Version));
            }
            catch (System.Exception e)
            {
                throw new ConnectionException("failed to connect", config, e);
            }
        }
Beispiel #27
0
        public static void Run(IReadOnlyDictionary <string, string> configDictionary)
        {
            var requestObj = new AuthReversalRequest();

            var v2PaymentsClientReferenceInformationObj = new V2paymentsidreversalsClientReferenceInformation
            {
                Code = "TC50171_1"
            };

            requestObj.ClientReferenceInformation = v2PaymentsClientReferenceInformationObj;

            // var v2paymentsOrderInformationObj = new V2paymentsidreversalsOrderInformation();

            // var amountDetailsObj = new V2paymentsidreversalsOrderInformationAmountDetails();

            // amountDetailsObj.Currency = "USD";
            // v2paymentsOrderInformationObj.AmountDetails = amountDetailsObj;

            // requestObj.OrderInformation = v2paymentsOrderInformationObj;

            var reversalInformationObj = new V2paymentsidreversalsReversalInformation();

            var amountDetailsObj = new V2paymentsidreversalsReversalInformationAmountDetails
            {
                TotalAmount = "3000.00"
            };

            reversalInformationObj.AmountDetails = amountDetailsObj;

            requestObj.ReversalInformation = reversalInformationObj;

            var merchantConfig = new MerchantConfig(configDictionary)
            {
                RequestType     = "POST",
                RequestTarget   = "/pts/v2/payments/5305395916686582801541/reversals",
                RequestJsonData = JsonConvert.SerializeObject(requestObj)
            };

            try
            {
                var configurationSwagger = new ApiClient().CallAuthenticationHeader(merchantConfig);
                var apiInstance          = new ReversalApi(configurationSwagger);
                var result = apiInstance.AuthReversal("5305395916686582801541", requestObj);
                Console.WriteLine(result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception on calling the API: " + e.Message);
            }
        }
        public TransactionResult GetTransactions(TransactionRequest reg, MerchantConfig config)
        {
            TransactionResult transactions;

            var reqhelper = new RequestHelper();
            var response  = reqhelper.CreateRequest("GET", reg, config);

            using (var reader = new StreamReader(response.GetResponseStream()))
            {
                string result   = reader.ReadToEnd(); // do something fun...
                var    jsreader = new JsonTextReader(new StringReader(result));
                transactions = new JsonSerializer().Deserialize <TransactionResult>(jsreader);
            }
            return(transactions);
        }
Beispiel #29
0
 public object OnMerchantConfigUpdate([FromBody] MerchantConfig merchantConfig)
 {
     try
     {
         if (string.IsNullOrEmpty(merchantConfig.UpdateBy))
         {
             return(StatusCode(StatusCodes.Status401Unauthorized));
         }
         return(_MerchantService.OnMerchantConfigUpdate(merchantConfig));
     }
     catch (Exception ex)
     {
         return(errorLogService.InsertToErrorLog(ex, MethodBase.GetCurrentMethod().Name, Request.Headers["UserInfo"].ToString()));
     }
 }
Beispiel #30
0
        public Payout GetSinglePayout(string paymentRef, MerchantConfig config)
        {
            Payout payouts;

            var reqhelper = new RequestHelper();
            var response  = reqhelper.CreateSinglePayoutRequest("GET", paymentRef, config);

            using (var reader = new StreamReader(response.GetResponseStream()))
            {
                string result   = reader.ReadToEnd(); // do something fun...
                var    jsreader = new JsonTextReader(new StringReader(result));
                payouts = new JsonSerializer().Deserialize <Payout>(jsreader);
            }
            return(payouts);
        }