Pizzi API - Ressource server (0.2.0)

Download OpenAPI specification:Download

This is the internal API resource server documentation for the PizziPayment. You can find out more about Pizzi here.

Payments

Everything about payments.

Proceed Payment

Pay.

Authorizations:
BearerAuth
Request Body schema: application/json

Payment's informations.

transaction_id
required
number

Responses

Request samples

Content type
application/json
{
  • "transaction_id": 2
}

Response samples

Content type
application/json
Example
{
  • "source": "/source",
  • "message": "invalid `user_id` field"
}

Shop Item

Every route about a shop item. We call shop item product and service that a shop can sell.

Create shop items

Create shop items from a list of items.

Authorizations:
BearerAuth
Request Body schema: application/json

List of items to create.

required
Array of objects (shop_item) non-empty

Array of shop items to create.

Responses

Request samples

Content type
application/json
{
  • "items": [
    ]
}

Response samples

Content type
application/json
{
  • "items": [
    ]
}

List shop items

Get a list of shop items by page.

Authorizations:
BearerAuth
query Parameters
page
integer >= 1
Default: 1

Page number.

nb_items
integer >= 1
Default: 25

Number of item(s) per page

query
string

Return only results with an occurence of query. Only works with the sort_by=name parameter.

sort_by
string
Default: "name"
Enum: "date" "name" "price"

Sort by:

  • date - creation date
  • name - name of the shop item
  • price - price of the shop item
order
string
Default: "asc"
Enum: "asc" "desc"

Order:

  • asc - Ascending
  • desc - Descending

Responses

Response samples

Content type
application/json
{
  • "items": [
    ]
}

Delete shop item

Delete a shop item.

Authorizations:
BearerAuth
path Parameters
id
required
integer

Item's id.

Responses

Response samples

Content type
application/json
Example
{
  • "source": "/source",
  • "message": "invalid `user_id` field"
}

Update shop item

Update the shop item related to the id in path. Notice that every field in the request's body are optional.

Authorizations:
BearerAuth
path Parameters
id
required
integer

Id of the shop item.

Request Body schema: application/json

Item's information.

name
required
string

Product/service's name.

price
required
integer (types_price)

Price stored thousandth of euro.

category
string
color
string

Responses

Request samples

Content type
application/json
{
  • "name": "Shovel",
  • "price": 450000,
  • "category": "Tools",
  • "color": "#000000"
}

Response samples

Content type
application/json
{
  • "id": 3,
  • "name": "Shovel",
  • "price": 450000,
  • "category": "Tools",
  • "color": "#000000"
}

Shop

Everything about shop.

Get shop infos

Returns the informations related to the given token.

Authorizations:
BearerAuth

Responses

Response samples

Content type
application/json

Shop's info example

{}

Update shop infos

Update shop informations related to the given token. Note that every field in the request's body is optional.

Authorizations:
BearerAuth
Request Body schema: application/json

Update shop body.

description
string

Shop's description.

website
string

Shop's website.

instagram
string

Shop's instagram page.

twitter
string

Shop's twitter account.

facebook
string

Shop's facebook page.

Responses

Request samples

Content type
application/json
{}

Response samples

Content type
application/json

Shop's info example

{}

Register Shop

Create a Pizzi shop account.

Authorizations:
BasicAuth
Request Body schema: application/json

User's informations.

name
required
string

Shop's name.

required
object

Shop's address information.

email
required
string

Shop's email.

phone
required
string

Shop's phone number.

password
required
string (types_password) >= 12 characters

A string longer than 12 characters with at least a number, an upper case, a lower case and a special character (!@#$%^&*()/|\-_?.,;+¤{}[]).

siret
required
string

Shop's siret.

Responses

Request samples

Content type
application/json
{
  • "name": "Voitukle",
  • "place": {
    },
  • "email": "shop@example.com",
  • "phone": "+33 6 12 34 56 78",
  • "password": "Testeee8!eee",
  • "siret": "12345678912345"
}

Response samples

Content type
application/json
Example
{
  • "source": "/source",
  • "message": "invalid `user_id` field"
}

Delete Shop

Delete the Pizzi shop account related to the given token.

Authorizations:
BearerAuth
Request Body schema: application/json

Shop's password.

password
string (types_password) >= 12 characters

A string longer than 12 characters with at least a number, an upper case, a lower case and a special character (!@#$%^&*()/|\-_?.,;+¤{}[]).

Responses

Request samples

Content type
application/json
{
  • "password": "Valid_passw0rd"
}

Response samples

Content type
application/json
Example
{
  • "source": "/source",
  • "message": "invalid `user_id` field"
}

Update email

Update shop's email.

Authorizations:
BearerAuth
Request Body schema: application/json

Shop's new email

password
required
string (types_password) >= 12 characters

A string longer than 12 characters with at least a number, an upper case, a lower case and a special character (!@#$%^&*()/|\-_?.,;+¤{}[]).

new_email
required
string

Responses

Request samples

Content type
application/json

New email

{
  • "password": "Valid_passw0rd",
  • "new_email": "nicolas.porte@example.com"
}

Response samples

Content type
application/json
Example
{
  • "source": "/source",
  • "message": "invalid `user_id` field"
}

Replace password

Replace shop's password.

Authorizations:
BearerAuth
Request Body schema: application/json

Shop's new password

password
required
string (types_password) >= 12 characters

A string longer than 12 characters with at least a number, an upper case, a lower case and a special character (!@#$%^&*()/|\-_?.,;+¤{}[]).

new_password
required
string (types_password) >= 12 characters

A string longer than 12 characters with at least a number, an upper case, a lower case and a special character (!@#$%^&*()/|\-_?.,;+¤{}[]).

Responses

Request samples

Content type
application/json

Change password

{
  • "password": "Old_passw0rd",
  • "new_password": "New_passw0rd"
}

Response samples

Content type
application/json
Example
{
  • "source": "/source",
  • "message": "invalid `user_id` field"
}

List receipts

List the shop's receipts

Authorizations:
BearerAuth
query Parameters
filter
string (filter)
Enum: "latest" "oldest" "price_ascending" "price_descending"
Example: filter=latest

The order in which the elements should be returned.

from
string
Example: from=2018-03-20T09:12:28Z
to
string
Example: to=2018-03-20T09:12:28Z

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Receipt details

Get a receipt's details

Authorizations:
BearerAuth
path Parameters
receipt_id
required
number

The receipt's id

Responses

Response samples

Content type
application/json
{
  • "products": [
    ],
  • "payment_type": "card",
  • "creation_date": "18/06/2020",
  • "total_ht": 174900,
  • "total_ttc": 209880
}

Create transaction

Create a transaction.

Authorizations:
BearerAuth
Request Body schema: application/json

The transaction's contents.

tva_percentage
number

The sales tax percentage

total_price
integer (types_price)

Price stored thousandth of euro.

payment_method
string (types_payment_method)
Enum: "card" "cash" "cheque" "unassigned"

The payment method

Array of objects

The transaction's shop items

Responses

Request samples

Content type
application/json
{
  • "tva_percentage": 20,
  • "total_price": 278900,
  • "payment_method": "card",
  • "items": [
    ]
}

Response samples

Content type
application/json
{
  • "id": 1,
  • "token": "Ceciestuntoken"
}

Set avatar

Set shop's avatar.

Authorizations:
BearerAuth
Request Body schema: multipart/form-data
avatar
string <binary>

The image in binary format

Responses

Request samples

Content type
multipart/form-data
{
  "avatar": "An image"
}

Response samples

Content type
application/json
{
  • "avatar_id": 435
}

User

Everything about user.

Get user infos

Returns the informations related to the given token.

Authorizations:
BearerAuth

Responses

Response samples

Content type
application/json

User's info example

{
  • "id": 1,
  • "firstname": "Louis de Funes",
  • "surname": "Loulou",
  • "address": "62 rue de l'église",
  • "zipcode": 92400,
  • "avatar_id": 324
}

Register User

Create a Pizzi user account.

Authorizations:
BasicAuth
Request Body schema: application/json

User's informations.

name
required
string
surname
required
string
email
required
string
password
required
string (types_password) >= 12 characters

A string longer than 12 characters with at least a number, an upper case, a lower case and a special character (!@#$%^&*()/|\-_?.,;+¤{}[]).

required
object

Responses

Request samples

Content type
application/json
{
  • "name": "Valérie Debout",
  • "surname": "Valoche",
  • "email": "valerie.debout@example.com",
  • "password": "Testeee8!eee",
  • "place": {
    }
}

Response samples

Content type
application/json
Example
{
  • "source": "/source",
  • "message": "invalid `user_id` field"
}

Delete User

Delete the Pizzi user account related to the given token.

Authorizations:
BearerAuth
Request Body schema: application/json

User's password.

password
required
string (types_password) >= 12 characters

A string longer than 12 characters with at least a number, an upper case, a lower case and a special character (!@#$%^&*()/|\-_?.,;+¤{}[]).

Responses

Request samples

Content type
application/json
{
  • "password": "Valid_passw0rd"
}

Response samples

Content type
application/json
Example
{
  • "source": "/source",
  • "message": "invalid `user_id` field"
}

Update User

Update the Pizzi user account related to the given token. Notice that every items in the request's body are optionals. However, if you try to update a place, you'll need the place.address and the place.city correctly filled.

Authorizations:
BearerAuth
Request Body schema: application/json

User's information.

name
string
surname
string
object

Responses

Request samples

Content type
application/json
{
  • "name": "Louis de Funes",
  • "surname": "Loulou",
  • "place": {
    }
}

Response samples

Content type
application/json

User's info example

{
  • "id": 1,
  • "firstname": "Louis de Funes",
  • "surname": "Loulou",
  • "address": "62 rue de l'église",
  • "zipcode": 92400,
  • "avatar_id": 324
}

Update email

Update user's email.

Authorizations:
BearerAuth
Request Body schema: application/json
password
required
string (types_password) >= 12 characters

A string longer than 12 characters with at least a number, an upper case, a lower case and a special character (!@#$%^&*()/|\-_?.,;+¤{}[]).

new_email
required
string

Responses

Request samples

Content type
application/json

New email

{
  • "password": "Valid_passw0rd",
  • "new_email": "nicolas.porte@example.com"
}

Response samples

Content type
application/json
Example
{
  • "source": "/source",
  • "message": "invalid `user_id` field"
}

Replace password

Replace user's password.

Authorizations:
BearerAuth
Request Body schema: application/json

User's new password

password
required
string (types_password) >= 12 characters

A string longer than 12 characters with at least a number, an upper case, a lower case and a special character (!@#$%^&*()/|\-_?.,;+¤{}[]).

new_password
required
string (types_password) >= 12 characters

A string longer than 12 characters with at least a number, an upper case, a lower case and a special character (!@#$%^&*()/|\-_?.,;+¤{}[]).

Responses

Request samples

Content type
application/json

Change password

{
  • "password": "Old_passw0rd",
  • "new_password": "New_passw0rd"
}

Response samples

Content type
application/json
Example
{
  • "source": "/source",
  • "message": "invalid `user_id` field"
}

List user's receipts

List user's receipts with a filter.

Authorizations:
BearerAuth
query Parameters
filter
string (filter)
Enum: "latest" "oldest" "price_ascending" "price_descending"
Example: filter=latest

The order in which the elements should be returned.

query
string
Example: query=steam
from
string
Example: from=2018-03-20T09:12:28Z
to
string
Example: to=2018-03-20T09:12:28Z

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get receipt details

Get a receipt's details

Authorizations:
BearerAuth
path Parameters
receipt_id
required
number
Example: 4

The receipt's id

Responses

Response samples

Content type
application/json
{
  • "vendor": {
    },
  • "products": [
    ],
  • "payment_type": "card",
  • "creation_date": "18/06/2020",
  • "total_ht": 174900,
  • "total_ttc": 209900
}

Take transaction

Self assign a transaction.

Authorizations:
BearerAuth
Request Body schema: application/json

The transaction's id and the required token

id
required
number
token
required
string

Responses

Request samples

Content type
application/json
{
  • "id": 12345,
  • "token": "token"
}

Response samples

Content type
application/json
Example
{
  • "source": "/source",
  • "message": "invalid `user_id` field"
}

Share receipt

Share receipt using a user's email.

Authorizations:
BearerAuth
path Parameters
receipt_id
required
number

The receipt's id

Request Body schema: application/json

The transaction's id and the required token

recipient_email
required
string

Responses

Request samples

Content type
application/json
{
  • "recipient_email": "toto@tata.com"
}

Response samples

Content type
application/json
Example
{
  • "source": "/source",
  • "message": "invalid `user_id` field"
}

List shared receipt

List shared receipts related to user.

Authorizations:
BearerAuth
query Parameters
filter
string
Enum: "latest" "oldest"
Example: filter=latest
query
string
Example: query=steam

Search query for shop name.

from
string
Example: from=2018-03-20T09:12:28Z
to
string
Example: to=2018-03-20T09:12:28Z

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Set avatar

Set user's avatar.

Authorizations:
BearerAuth
Request Body schema: multipart/form-data
avatar
string <binary>

The image in binary format

Responses

Request samples

Content type
multipart/form-data
{
  "avatar": "An image"
}

Response samples

Content type
application/json
{
  • "avatar_id": 435
}

Transactions

Everything about transactions. We call transaction the virtual object describing a contract between a user and a shop.

List transactions

Retrieve owner's transactions by specifying a "state"

Authorizations:
BearerAuth
query Parameters
state
string
Enum: "pending" "failed" "validated"

Transactions' state

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Init transaction

Create a pending transaction

Authorizations:
BearerAuth
Request Body schema: application/json

Transaction's informations.

receipt_id
required
number
user_id
number or null
shop_id
required
number
payment_method
required
string (types_payment_method)
Enum: "card" "cash" "cheque" "unassigned"

The payment method

Responses

Request samples

Content type
application/json
{
  • "receipt_id": 1203,
  • "user_id": null,
  • "shop_id": 12323,
  • "payment_method": "unassigned"
}

Response samples

Content type
application/json
{
  • "id": 21344,
  • "receipt_id": 1203,
  • "user_id": null,
  • "shop_id": 12323,
  • "state": "pending",
  • "payment_method": "unassigned",
  • "created_at": "2022-05-21T22:31:01.992Z",
  • "updated_at": null
}

Update user

Link a transaction to a user.

Authorizations:
BearerAuth
path Parameters
id
required
number

Transaction's id

Request Body schema: application/json

User's id

user_id
required
number

Responses

Request samples

Content type
application/json
{
  • "user_id": 32
}

Response samples

Content type
application/json
Example
{
  • "source": "/source",
  • "message": "invalid `user_id` field"
}

Update payment method

Update payment method registered for the transaction.

Authorizations:
BearerAuth
path Parameters
id
required
number

Transaction's id

Request Body schema: application/json

Payment method

payment_method
required
string (types_payment_method)
Enum: "card" "cash" "cheque" "unassigned"

The payment method

Responses

Request samples

Content type
application/json
{
  • "payment_method": "card"
}

Response samples

Content type
application/json
Example
{
  • "source": "/source",
  • "message": "invalid `user_id` field"
}

Product Return

Everything about product return.

List Product Return Certificates

Get all product return certificates associated to a receipt's id.

Authorizations:
BearerAuth
path Parameters
receipt_id
required
number

The receipt's id

Responses

Response samples

Content type
application/json
[
  • {
    },
  • {
    }
]

Create Product Return Certificates

Create a product return certificate on a receipt item.

Authorizations:
BearerAuth
path Parameters
receipt_id
required
number

The receipt's id

Request Body schema: application/json

Certificate's informations.

receipt_item_id
required
number

Id of the associated receipt item.

quantity
required
number

Quantity of item returned.

reason
required
string

Reason of return.

Responses

Request samples

Content type
application/json
{
  • "receipt_item_id": 123,
  • "quantity": 2,
  • "reason": "Le produit est cassé."
}

Response samples

Content type
application/json
{
  • "id": 2,
  • "receipt_item_id": 123,
  • "quantity": 2,
  • "reason": "Le produit est cassé.",
  • "return_date": "2022-08-11T16:12:59.278Z"
}

List All Product Return Certificates

Get all product return certificates associated to the current shop.

Authorizations:
BearerAuth

Responses

Response samples

Content type
application/json
[
  • {
    },
  • {
    }
]

Image

Everything about images.

Retrieve an image

Returns the image associated with the given id.

path Parameters
id
required
number

Image's id

Responses

Response samples

Content type
image/jpeg
An image