allegro / allegro/allegro-api

[NEWS] Cenniki hurtowe dla transakcji B2B / Wholesale price list for B2B transactions

Aperta
#3,641 2 commenti 0 reazioni 1 assegnatario Rivendicata da @MaciejFrackowiak Vedi su GitHub
News
Lingua principale
Nessun dato sulla lingua
Stelle
244
Fork
40
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Od dziś dodasz cenniki hurtowe do ofert. Dzięki nim zaoferujesz rabat podczas transakcji B2B (firma - firma). Aby utworzyć cennik hurtowy, skorzystaj z [POST /sale/loyalty/promotions](https://developer.allegro.pl/documentation/#operation/createPromotionUsingPOST_1) i określ progi ilościowe oraz przypadający dla nich rabat procentowy.

**Przykładowy request:**

```
curl -X POST
'https://api.allegro.pl/sale/loyalty/promotions' \
-H 'Accept: application/vnd.allegro.public.v1+json' \
-H 'Content-Type: application/vnd.allegro.public.v1+json' \
-H 'Authorization: Bearer {token}' \
-d '{
"benefits": [
{
"specification": {
"type": "WHOLESALE_PRICE_LIST", -- typ promocji (lista dostępnych
wartości znajduje się w dokumentacji zasobu)
"name": "Cennik hurtowy nr 1", -- nazwa cennika
"thresholds": [ -- progi rabatowe
{
"quantity": { -- minimalna liczba
"lowerBound": 5 zakupionych przedmiotów
},
"discount": { -- wysokość rabatu (%)
"percentage": "5"
}
},
{
"quantity": {
"lowerBound": 10
},
"discount": {
"percentage": "8"
}
}
]
}
}
],
"offerCriteria": [
{
"type": "OFFERS_ASSIGNED_EXTERNALLY" -- oferty przypiszesz za pomocą
} PUT /sale/offer-modification-commands/{commandId}
]
}'
```
W odpowiedzi otrzymasz identyfikator utworzonego cennika.

**Przykładowy response:**

```
{
"id": "9de4be5d-9c60-48aa-8711-363625c9d793", -- identyfikator cennika
"createdAt": "2020-08-13T06:08:06.011Z", -- data utworzenia
"benefits": [
{
"specification": {
"name": "Cennik hurtowy nr 1",
"thresholds": [
{
"quantity": {
"lowerBound": 5
},
"discount": {
"percentage": "5"
}
},
{
"quantity": {
"lowerBound": 10
},
"discount": {
"percentage": "8"
}
}
],
"type": "WHOLESALE_PRICE_LIST"
}
}
],
"offerCriteria": [
{
"type": "OFFERS_ASSIGNED_EXTERNALLY"
}
],
"status": "ACTIVE"
}
```

Utworzony cennik hurtowy przypiszesz do wybranych ofert za pomocą zasobu do grupowych zmian w ofercie - [PUT /sale/offer-modification-commands/{commandId}](https://developer.allegro.pl/documentation/#operation/modificationCommandUsingPUT).

**Przykładowy request:**

```
curl -X PUT \
'https://api.allegro.pl/sale/offer-modification-commands/daccd266-fa5e-4a6b-a10b-d24836c411e1' \
-H 'Authorization: Bearer {token}' \
-H 'Accept: application/vnd.allegro.public.v1+json' \
-H 'Content-Type: application/vnd.allegro.public.v1+json' \
-d '{
"modification": {
"discounts": { -- typ zmiany
"wholesalePriceList": {
"id": "9de4be5d-9c60-48aa-8711-363625c9d793" -- identyfikator cennika
}
}
},
"offerCriteria": [
{
"offers": [
{
"id": "9292002929" -- identyfikator oferty
},
{
"id": "9876543210"
}
],
"type": "CONTAINS_OFFERS"
}
]
}'
```

**Ważne!** Obecnie informacji o przypisanym cenniku hurtowym do oferty nie otrzymasz w odpowiedzi dla [GET /sale/offers/{offerId}](https://developer.allegro.pl/documentation/#operation/getOfferUsingGET).

Więcej informacji o cennikach hurtowych i zasobach do zarządzania nimi znajdziesz w [naszym poradniku](https://developer.allegro.pl/offer_bundles/#30).

-----
From today you will add wholesale price lists to your offers. Thanks to them, you will offer a discount during B2B transactions (company - company). To create a wholesale price list, please use [POST /sale/loyalty/promotions](https://developer.allegro.pl/documentation/#operation/createPromotionUsingPOST_1) and define the quantitative thresholds and the percentage discount applicable to them.

**Sample request:**

```
curl -X POST
'https://api.allegro.pl/sale/loyalty/promotions' \
-H 'Accept: application/vnd.allegro.public.v1+json' \
-H 'Content-Type: application/vnd.allegro.public.v1+json' \
-H 'Authorization: Bearer {token}' \
-d '{
"benefits": [
{
"specification": {
"type": "WHOLESALE_PRICE_LIST", -- promotion type (list of available values
can be found in resource documentation)
"name": "Price list number 1", -- wholesale price list name
"thresholds": [ -- discount thresholds
{
"quantity": { -- minimum quantity purchased items
"lowerBound": 5
},
"discount": { -- discount percentage (%)
"percentage": "5"
}
},
{
"quantity": {
"lowerBound": 10
},
"discount": {
"percentage": "8"
}
}
]
}
}
],
"offerCriteria": [
{
"type": "OFFERS_ASSIGNED_EXTERNALLY" -- you will assign offers via
} PUT /sale/offer-modification-commands/{commandId}
]
}'
```

In response, you will receive the ID of the created wholesale price list.

**Sample response:**

```
{
"id": "9de4be5d-9c60-48aa-8711-363625c9d793", -- wholesale price list ID
"createdAt": "2020-08-13T06:08:06.011Z", -- creation date
"benefits": [
{
"specification": {
"name": "Price list number 1",
"thresholds": [
{
"quantity": {
"lowerBound": 5
},
"discount": {
"percentage": "5"
}
},
{
"quantity": {
"lowerBound": 10
},
"discount": {
"percentage": "8"
}
}
],
"type": "WHOLESALE_PRICE_LIST"
}
}
],
"offerCriteria": [
{
"type": "OFFERS_ASSIGNED_EXTERNALLY"
}
],
"status": "ACTIVE"
}
```

You will assign the created wholesale price list to selected offers using the resource responsible for group changes in the offers - [PUT /sale/offer-modification-commands/{commandId}](https://developer.allegro.pl/documentation/#tag/Batch-offer-modification).

**Sample request:**

```
curl -X PUT \
'https://api.allegro.pl/sale/offer-modification-commands/daccd266-fa5e-4a6b-a10b-d24836c411e1' \
-H 'Authorization: Bearer {token}' \
-H 'Accept: application/vnd.allegro.public.v1+json' \
-H 'Content-Type: application/vnd.allegro.public.v1+json' \
-d '{
"modification": {
"discounts": { -- change type
"wholesalePriceList": {
"id": "9de4be5d-9c60-48aa-8711-363625c9d793" -- wholesale price list ID
}
}
},
"offerCriteria": [
{
"offers": [
{
"id": "9292002929" -- offer ID
},
{
"id": "9876543210"
}
],
"type": "CONTAINS_OFFERS"
}
]
}'
```

**Note!** Currently, you will not receive information about the wholesale price list assigned to the offer in response to [GET /sale/offers/{offerId}](https://developer.allegro.pl/documentation/#operation/getOfferUsingGET).

You will find more information about wholesale price lists and resources to manage them in [our tutorial](https://developer.allegro.pl/en/offer_bundles/#30).

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.