Ejemplo n.º 1
0
    // Finds the offer information and updates the text
    public void UpdateOffer(int startIndex)
    {
        // Create client and get components
        VisaAPIClient visaAPIClient = new VisaAPIClient();
        Text          text          = gameObject.GetComponent <Text>();

        // Make API call
        string baseUri           = "vmorc/offers";
        string resourcePath      = "/v1/all";
        string queryParameters   = "?max_offers=5&start_index=" + startIndex.ToString();
        Tuple <string, string> t = visaAPIClient.DoMutualAuthCall(baseUri + resourcePath + queryParameters, "GET", "Merchant Offer API Test", "");
        string status            = t.Item1;
        string response          = t.Item2;

        Debug.Log("Returned response from mutual auth call: " + response);

        // Decode JSON returned
        var    responseJSON = JSON.Parse(response);
        string firstProgram = responseJSON["Offers"][1]["programName"].Value;
        string firstOffer   = responseJSON["Offers"][1]["offerTitle"].Value;
        string firstFrom    = responseJSON["Offers"][1]["validityFromDate"].Value;
        string firstTo      = responseJSON["Offers"][1]["validityToDate"].Value;

        // Change text
        string desiredText = firstProgram + "\n" + firstOffer + "\n" + firstFrom + " to " + firstTo;

        text.text = desiredText;

        // Close response
        Debug.Log(status);
    }
Ejemplo n.º 2
0
        public IActionResult TransferFunds([FromBody] Transfer transfer)
        {
            balance.Push(transfer.Amount);

            Configuration configuration = new Configuration
            {
                CertificatePassword = _configuration["CertificatePassword"],
                CertificatePath     = _configuration["CertificatePath"],
                Password            = _configuration["Password"],
                VisaUrl             = _configuration["VisaUrl"],
                UserId = _configuration["UserId"]
            };

            var visaAPIClient = new VisaAPIClient();

            System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
            string baseUri = "visadirect/";


            var    requestFile = @"c:\Visa\PullRequest.json";
            string request     = "";

            if (System.IO.File.Exists(requestFile))
            {
                request = System.IO.File.ReadAllText(requestFile);
            }


            string resourcePath = "fundstransfer/v1/pullfundstransactions/";
            string status       = visaAPIClient.DoMutualAuthCall(baseUri + resourcePath, "POST", "Pull Funds Transaction Test", request, configuration);

            var requestFile2 = @"c:\Visa\PushRequest.json";

            string request2 = "";

            if (System.IO.File.Exists(requestFile))
            {
                request2 = System.IO.File.ReadAllText(requestFile2);
            }
            string resourcePath2 = "fundstransfer/v1/pushfundstransactions/";
            string status2       = visaAPIClient.DoMutualAuthCall(baseUri + resourcePath2, "POST", "Push Funds Transaction Test", request2, configuration);

            return(Ok());
        }