Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
VLI-2515: QR exchange API
Browse files Browse the repository at this point in the history
  • Loading branch information
jonkjenn authored Feb 20, 2024
2 parents 5ab0e74 + 0d2e8db commit 80ca635
Showing 1 changed file with 169 additions and 0 deletions.
169 changes: 169 additions & 0 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,77 @@ paths:
in: path
required: true
description: The MobilePay PoS BeaconId
'/qr/v1/exchange':
post:
summary: Exchange user presented QR code for data
operationId: exchangeQr
tags:
- QR Exchange
parameters:
- $ref: '#/components/parameters/Authorization'
- $ref: '#/components/parameters/Ocp-Apim-Subscription-Key'
- $ref: '#/components/parameters/Merchant-Serial-Number'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/QrExchangeRequest'
examples:
Simple example:
value:
qrCode: 'https://qr.vipps.no/p/qwjhewqhueheuqwhuqwhe'
intent: LOGIN
Example 1:
value:
qrCode: 'https://qr.vipps.no/p/qwjhewqhueheuqwhuqwhe'
intent: CUSTOMER_CLUB_SIGNUP
requestedData:
- MSISDN
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/QrExchangeResponse'
examples:
Version 2.0 example:
value:
msisdn: '4798765432'
timestamp: 1634025600
version: '2.0'
Version 1.0 example:
value:
msisdn: '4798765432'
version: '1.0'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/QrExchangeErrorResponse'
examples:
Example 1:
value:
title: "Bad request"
status: 400
detail: "The request body contains one or more invalid parameters."
extraDetails:
- name: "intent"
reason: "The intent must be one of LOGIN, CUSTOMER_CLUB_SIGNUP, IDENTIFICATION, PAYMENT"
Example 2:
value:
title: "Bad request"
status: 400
detail: "The request body contains one or more invalid parameters."
extraDetails:
- name: "qrCode"
reason: "The complete data contained in the QR code is required."
'401':
description: Unauthorized
'500':
description: Internal Server Error
components:
schemas:
OneTimePaymentQrRequest:
Expand Down Expand Up @@ -588,6 +659,98 @@ components:
qrContent:
type: string
description: The text that is being encoded by the QR code. This is the actual content of the QR code.
QrExchangeRequest:
type: object
description: 'The request body for the QR exchange endpoint. This endpoint is used to exchange information about a QR code that has been scanned by a Vipps user.'
required:
- qrCode
- intent
- requestedData
properties:
qrCode:
type: string
description: 'The complete content of the QR code.'
intent:
$ref: '#/components/schemas/Intent'
requestedData:
type: array
items:
$ref: '#/components/schemas/RequestedData'
default: [ MSISDN ]
QrExchangeResponse:
type: object
properties:
msisdn:
type: string
description: 'The MSISDN of the user presenting the QR code.'
timestamp:
type: integer
description: 'The UTC timestamp in seconds when the QR code was generated. Only available for version 2.0 QR codes.'
version:
type: string
description: 'Version of the QR code format. There are two versions: 1.0 and 2.0. Version 1.0 is the old format, and version 2.0 is the new format.'
required:
- msisdn
- version
Intent:
type: string
description: 'The intended use of the data returned from the QR exchange.'
enum:
- LOGIN
- CUSTOMER_CLUB_SIGNUP
- IDENTIFICATION
- PAYMENT
RequestedData:
type: string
description: 'Which data fields the merchant wants to receive from the QR exchange. Currently only MSISDN is supported.'
enum:
- MSISDN
QrExchangeErrorResponse:
type: object
required:
- title
- status
- detail
properties:
title:
type: string
description: A short, human-readable summary of the problem type.
status:
type: integer
format: int32
description: The HTTP status code associated with the error.
detail:
type: string
description: A human-readable explanation of the specific problem.
extraDetails:
type: array
items:
type: object
required:
- name
- reason
properties:
name:
type: string
description: The name of the invalid parameter.
reason:
type: string
description: The reason why the parameter is invalid.
x-examples:
example-1:
title: "Bad request"
status: 400
detail: "The request body contains one or more invalid parameters."
extraDetails:
- name: "intent"
reason: "The intent must be one of LOGIN, CUSTOMER_CLUB_SIGNUP, IDENTIFICATION, PAYMENT"
example-2:
title: "Bad request"
status: 400
detail: "The request body contains one or more invalid parameters."
extraDetails:
- name: "qrCode"
reason: "The complete data contained in the QR code is required."
securitySchemes:
BearerToken:
type: http
Expand Down Expand Up @@ -694,6 +857,12 @@ components:
application/json:
schema:
$ref: '#/components/schemas/QrErrorResponse'
exchange400BadRequest:
description: Bad request
content:
application/json:
schema:
$ref: '#/components/schemas/QrExchangeErrorResponse'
tags:
- name: Merchant redirect QR
- name: One time payment QR
Expand Down

0 comments on commit 80ca635

Please sign in to comment.