SMS to Payment [VIPPS Payment Provider PoC]

Flow Diagram

 

 

Flow Description

 

In order to perform a direct payment using VIPPS, the following actions need to be performed:

  1. User sends CHARGE to 27222

  2. Call to REST API (CGI) is made

  3. REST API (CGI) makes call to a Client Server Function

  4. Based on the keyword sent a call to NEXT Paycore API is made (Paycore SDK is being used):

    1. If CHARGE, than:

      1. Make a POST call to /api/pre-transactions and send sms with vipps reservation page for the user to pay.

      2. User clicks on the link and pays the reserved amount.

      3. Pre-transaction and transaction is created in NEXT Paycore Database and transactionId is being returned to the Client Server app.

      4. New entry in Client Server Database is created with msisd, transactionId and StartChargeUtc date and time

    2. If ENDCHARGE, than:

      1. Update Client Server database EndChargeUtc data and time column.

      2. Calculate the amount to be charged in the Client Server App and based on the msisd, transactionId and StartChargeUtc and EndChargeUtc (client logic for calculation)

      3. Get the transaction with transactionId from Paycore Database using GET /api/transactions/partnerId/transactionId

      4. If reserved amount is greater than calculated amount to be charged, than:

        1. Make a PUT call to /api/transactions/partnerId/transactionId/capture?amount=amount to update the amount to be charged and capture transaction for the updated amount.

        2. Else, if reserved amount is less than the newly calculated amount to be charged, make a PUT call to /api/transactions/partnerId/transactionId/capture and capture the whole reserved amount.

        3. User checks the transactions and can confirm that they were charged the newly calculated amount.

 

Additional feature for enabling payment confirmation SMS

 

Additionally, we have the option to configure the feature to send a confirmation SMS to end user after sending ENDCHARGE when payment has been captured. That option is configurable through the NEXT portal (or directly in the Paycore database).

Client can enable/disable the confirmation SMS and change the text being send if they:

  1. Log into Next portal and go to Mobile Invoice

2. Click on Setup.

3. Find the Partner for which you want this VIPPS confirmation SMS on captured transaction to be sent and click on the edit button next to it.

4. Scroll down to the Sms receipt section. Here, by ticking the Send a receipt SMS upon successful payment tick-box, you can choose to enable the SMS confirmation to be sent. By changing the Text for the receipt message in the below textbox you can change the confirmation SMS text.

The Text for the receipt message is customizable and the {{amount}} will be resolved with the actual charged amount. In addition to the {{amount}}, you can choose to send an URL to the receipt page, using {{receiptPageUrl}} (e.g. Thank you for using our service. You have been charged {{amount}} NOK / KR. For receipt click here: {{receiptPageUrl}}).


A list of parameters that could be use in the paycore SMS texts could be found on the following Confluence page: https://linkmobility.atlassian.net/wiki/spaces/DD/pages/3586687077

 

Note, if you change this, it will be applied to all payments for the particular partner account. If you choose to enable confirmation SMS none of the payments for them will be “silence”.

 

Architectural Overview of the Client Server Demo App

 

REST API (CGI)

REST API (CGI) documentation:

Receive - https://linkmobility.no/wp-content/uploads/sites/3/2019/06/SMS_REST_API_MO-1.7.pdf
Send - https://linkmobility.no/wp-content/uploads/sites/3/2019/06/SMS_REST_API_MT_DLR-1.20.pdf

Client Server App

REST API (CGI) binds to an HTTP triggered Azure function deployed in Azure under:

Subscription: Link Mobile Development(Converted to EA)

Resource Group: Dev-PaymentCore

Function App: clientServer

Function: KeywordSent

SQL Database: demo-dp-client-database

 

Paycore SDK

Client Server client app calls NEXT Paycore API through an updated version of the Paycore SDK uploaded on: https://www.myget.org/feed/linknorway/package/nuget/LinkMobility.PaymentCore.Sdk

PM> Install-Package LinkMobility.PaymentCore.Sdk -Version 2.1.8 -Source https://www.myget.org/F/linknorway/api/v3/index.json

  1. POST /api/pre-transactions using using LinkMobility.PaymentCore.Sdk.BasePaymentController.CreateDirectPaymentAsync(PreTransactionRequest preTransaction, CancellationToken cancellationToken);

  2. GET /api/transactions/partnerId/transactionId using LinkMobility.PaymentCore.Sdk.BasePaymentController.GetTransactionAsync(int partnerId, string transactionId, CancellationToken cancellationToken);

  3. PUT /api/transactions/partnerId/transactionId/capture using LinkMobility.PaymentCore.Sdk.BasePaymentController.CaptureTransactionAsync(int partnerId, Guid transactionId, CancellationToken cancellationToken);

  4. PUT /api/transactions/partnerId/transactionId/capture?amount=amount using LinkMobility.PaymentCore.Sdk.BasePaymentController.UpdateAndCaptureTransactionAsync(int partnerId, Guid transactionId, decimal amount, CancellationToken cancellationToken);

 

NEXT Paycore API

NEXT Paycore API Documentation: https://linkmobility.atlassian.net/wiki/spaces/DD/pages/88670867

 

Client Server Demo App

 

The ClientServer demo project is uploaded on tfs under the newly created project and repo. There is publicly accessible version of it available on GitHub. See links below:

DirectPayment.Function project (TFS)

https://tfs-linkmobility.visualstudio.com/DirectPayment.Function

Git repository (TFS)

https://tfs-linkmobility.visualstudio.com/_git/DirectPayment.Function

Git repository (GitHub)

https://github.com/marsenovska-LinkMobility/DirectPayment.Function

Testing the SMS2VIPPS Direct Payment Flow

 

Test Case:

1. Send CHARGE to 27222 short number

 

1.1 ClientServer/KeywordSent function gets executed
1.2 Creates Pre-Transaction in Paycore Database
1.3 And creates Transaction in Paycore Database with the same id and the reserved amount
1.4 Creates new entry in Client Server Database with msisd, transactionId and StartChargeUtc

 

 

 

3.1 Sets transaction to Authorized Transaction in Paycore Database, so that it can be later on captured

4. Use service for 1 hour (1 hour is assumed amount: 1 NOK / KR)

5. Send ENDCHARGE to 27222 short number

 

5.1 ClientServer/KeywordSent function gets executed
5.2 Updates Client Server Database entry with msisd, transactionId, StartChargeUtc and EndChargeUtc.
5.3 Updates the transaction in Paycore Database with the new amount and or captures the transaction with the whole reserved or newly calculated amount.

6. Check VIPPS app, notice you have been charged amount: 1 NOK / KR

 

7. Additionally, if the Send a receipt SMS upon successful payment additional option has been enabled for the partner, upon successful payment, end user will receive confirmation SMS with the configured text from the above Additional feature for enabling payment confirmation SMS section in this document. By configuring that exact text the user will receive an SMS with the actual charged amount.

Alternatively, they can choose to also send the link to the receipt page. In such cases, the received SMS upon successful payment will look similar to the following. Hence, charged amount varies depending on the service usage time (5 NOK / KR equals 5 hours of service usage).

 

 

Jira tasks

https://linkmobile.atlassian.net/browse/NEXT-915

https://linkmobile.atlassian.net/browse/NEXT-955

https://linkmobile.atlassian.net/browse/NEXT-970

https://linkmobile.atlassian.net/browse/NEXT-999  

https://linkmobile.atlassian.net/browse/NEXT-1013

https://linkmobile.atlassian.net/browse/NEXT-1036

https://linkmobile.atlassian.net/browse/NEXT-1037

https://linkmobile.atlassian.net/browse/NEXT-1038

https://linkmobile.atlassian.net/browse/NEXT-1014

https://linkmobile.atlassian.net/browse/NEXT-1024