Giter VIP home page Giter VIP logo

nbluem's Introduction

NBluem

NuGet

NBluem is a .NET-library that enables usage of the Bluem payment provider.

Usage

Basic example

using System;
using System.Security.Cryptography.X509Certificates;
using NBluem.Net;
using NBluem.Net.Request;
using NBluem.Net.Request.Factory;
using NBluem.Net.RequestTypes;
using NBluem.Net.Response;
using NBluem.Security;
using NBluem.Structure.Net.Response;
using NBluem.ValueObjects;
using NLog;

namespace NBluem
{
    public class TestClass
    {
        public BluemTransactionResponse DoTest()
        {
            // Create certificate store that contains your Bluem certificate
            var store = new X509Store(StoreName.My, StoreLocation.LocalMachine);

            // Create a logger
            var logger = new LogFactory().GetCurrentClassLogger(typeof(TestClass));

            // Create the signage object to sign your request to Bluem
            var signage = new Signage(store, logger);

            // Create a new request via the BluemRequestFactory, for instance a payment request
            var paymentRequest = new BluemRequestFactory().CreateRequest(
                new BluemPaymentRequestType()) as IBluePaymentRequest;

            // Add some data to the payment request
            paymentRequest.AddPaymentData(
                new EntranceCode(),             // A unique entrance code
                "paymentReference",             // Your unique payment-reference
                "debtorReference",              // A unique debtor-reference
                "My description",               // A short description
                12.34,                          // The payment amount
                DateTime.Today.AddDays(10));    // The due datetime for the payment request

            // Create a new Bluem-client to handle the request
            BluemClient client = new BluemClient(logger);

            // Sign the actual request
            var signedRequest = signage.SignRequest(paymentRequest);

            // Send the signed request
            var response = (BluemTransactionResponse) client.SendRequest(signedRequest);

            // Return the actual response
            return response;
        }
    }
}

Install certificate

All communication between your application and Bluem is encrypted via a certificate which can be obtained from Bluem.

Configuration

Add the following NBluem configuration section to your web.config:

<configSections>
    ...
    <section name="NBluem.BluemConfiguration" type="NBluem.Configuration.BluemConfiguration"/>
</configSections>

Configuration example:

<NBluem.BluemConfiguration
    
    CertificateThumbprint="n533t2mguoq8mkneetdvch2x2dnjx37zullns738"
    Fingerprint="E823B6A6AFC5B06E5F9C6B02936764BA80B3A1347948EE876E186A0232B643BF"
    SenderId="S1234"
    ReturnUrl="https://return.to.me"
    
    PaymentRequestUri="https://test.viamijnbank.net/pr/createTransaction"
    PaymentStatusUri="https://test.viamijnbank.net/pr/requestTransactionStatus"
    BrandId="IDEAL"
    SkinId="PayRequest"
    Currency="EUR"
    DumpReports="false"
    HashSalt="BluemDefaultHashSalt"
    HashLength="16"
    
></NBluem.BluemConfiguration>

Parameters

Mandatory

CertificateThumbprint

Type: string
Format: 40-character alphanumeric string ([0-9a-z]{40})

The certificate thumbprint as it is registered in the Windows Certificate Store.

Fingerprint

Type: string
Format: 64-character alphanumeric string ([0-9A-Za-z]{64})

The certificate fingerprint as it is generated by OpenSSL

SenderId

Type: string

The unique client ID as agreed by Bluem

ReturnUrl

Type: string
Format: Basic URL-encoded URI

The URL where the paymentrequest is redirected to upon registering the payment. The URL can contain optional format parameters that are automatically replaced with data from the request. The possible parameters are:

  • entranceCode
  • paymentReference
  • debtorReference

So for instance, the following ReturnUrl can be constructed:

ReturnUrl="https://return.to.me/?ec={entranceCode}&pr={paymentReference}&dr={debtorReference}"

Which will result in something like:

GET https://return.to.me/?ec=123abc&pr=456def&dr=789ghi

Optional

PaymentRequestUri

Type: string
Format: Basic URL-encoded URI
Default: https://viamijnbank.net/pr/createTransaction

The URI which is used to create a new payment transaction.

PaymentStatusUri

Type: string
Format: Basic URL-encoded URI
Default: https://viamijnbank.net/pr/requestTransactionStatus

The URI which is used to create a new payment status transaction.

BrandId

Type: string
Default: IDEAL

The prefered method of payment.

SkinId

Type: string
Default: PayRequest

The skin that is used on the payment page as it is set in Bluem.

Currency

Type: string
Format: 3-character string
Default: EUR

The currency which is used on your payment-page.

DumpReports

Type: boolean
Default: false

Get a complete dump of the request as it being build-up and sent to Bluem for debugging purposes.

HashSalt

Type: string
Default: BluemDefaultHashSalt

The salt that is used to generate an EntranceCode for each request that's being sent to Bluem.

HashLength

Type: integer
Default: 16

The length of the hash that is used as an EntranceCode.

nbluem's People

Contributors

wim-jan avatar

Watchers

James Cloos avatar Christiaan Maks avatar Jimmy van der Sleen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.