コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string jsonData = new StreamReader(Request.InputStream).ReadToEnd();

        if (string.IsNullOrWhiteSpace(jsonData))
        {
            throw new Exception("Invalid notification call.");
        }

        var refreshToken = WebConfigurationManager.AppSettings["RefreshToken"];
        var signingKey   = WebConfigurationManager.AppSettings["SigningKey"];
        var testMode     = bool.Parse(WebConfigurationManager.AppSettings["TestMode"]);
        var client       = new OmniKassaApiClient(refreshToken, signingKey, testMode);

        var announcementResponse = RaboOmniKassaApi.Net.Models.Response.Response.CreateInstance <AnnouncementResponse>(jsonData, new SigningKey(Convert.FromBase64String(signingKey)));

        bool moreResultsAvailable;

        do
        {
            var response = client.RetrieveAnnouncement(announcementResponse);

            //... Update the order statuses

            moreResultsAvailable = response.MoreOrderResultsAvailable;
        } while (moreResultsAvailable);
    }
コード例 #2
0
 public void Setup()
 {
     _signingKey = new SigningKey("secret");
     _connector  = new Mock <IConnector>();
     _client     = new OmniKassaApiClientWrapper(_connector.Object, _signingKey);
 }
コード例 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var orderItems = new[]
        {
            new OrderItem
            {
                Id          = "1",
                Name        = "Test product",
                Description = "Description",
                Quantity    = 1,
                Amount      = Money.FromDecimal("EUR", 99.99),
                Tax         = Money.FromDecimal("EUR", 20.99),
                Category    = ProductType.Digital,
                VatCategory = VatCategory.High
            }
        };

        var shippingDetail = new Address
        {
            FirstName           = "Jan",
            MiddleName          = "van",
            LastName            = "Veen",
            Street              = "Voorbeeldstraat",
            PostalCode          = "1234AB",
            City                = "Haarlem",
            CountryCode         = "NL",
            HouseNumber         = "5",
            HouseNumberAddition = "a"
        };

        var billingDetail = new Address
        {
            FirstName   = "Jan",
            MiddleName  = "van",
            LastName    = "Veen",
            Street      = "Factuurstraat",
            PostalCode  = "2314AB",
            City        = "Haarlem",
            CountryCode = "NL",
            HouseNumber = "15",
        };

        var customerInformation = new CustomerInformation
        {
            EmailAddress    = "*****@*****.**",
            DateOfBirth     = new DateTime(1987, 3, 20),
            Gender          = "M",
            Initials        = "J.M.",
            TelephoneNumber = "0204971111"
        };

        var order = new MerchantOrder
        {
            MerchantOrderId     = "100",
            Description         = "Order ID: 100",
            OrderItems          = orderItems,
            Amount              = Money.FromDecimal("EUR", 99.99),
            ShippingDetail      = shippingDetail,
            BillingDetail       = billingDetail,
            CustomerInformation = customerInformation,
            Language            = "NL",
            MerchantReturnUrl   = "http://localhost/",
            PaymentBrand        = PaymentBrand.Ideal,
            PaymentBrandForce   = PaymentBrandForce.ForceOnce
        };

        var refreshToken = WebConfigurationManager.AppSettings["RefreshToken"];
        var signingKey   = WebConfigurationManager.AppSettings["SigningKey"];
        var testMode     = bool.Parse(WebConfigurationManager.AppSettings["TestMode"]);
        var client       = new OmniKassaApiClient(refreshToken, signingKey, testMode);
        var redirectUrl  = client.AnnounceMerchantOrder(order);

        //Redirect user to Rabo OmniKassa
        Response.Redirect(redirectUrl, true);
    }