Marketplace ad store - can't put price required

Bug and problem reporting on Cyclos 4 version

Moderators: rmvanarkel, hugo, alexandre

Post Reply
cyril_ACID
Posts: 9
Joined: Tue Jun 30, 2020 11:47 am

Marketplace ad store - can't put price required

Post by cyril_ACID »

Hello,

I'm having an error when I try to create a new advertissement, I think it can be linked to an update of Cyclos (current version 4.14).

So I'm using the REST api to create the advertissement. Then when I execute the `data-for-new` request to find information about the `price` property, there isn't mention of the property `price` and when I put the property in the body of the store request,there is still the validation error.


Is it linked to a configuration inside the Cyclos, how can I fix this validation error ?

Thanks in advance,

Cyril - ACID-Solutions
luis
Posts: 201
Joined: Fri Feb 17, 2006 11:01 am

Re: Marketplace ad store - can't put price required

Post by luis »

The data-for-new doesn't return a price, unless there would be a default price, which was never the case.
It does, however, return a list of available currencies.
Can you, please, share more details on the subject?
Please, send in the exact parameters / request body / response body on both GET /api/{user}/marketplace/data-for-new and POST /api/{user}/marketplace.
Luis Fernando Planella Gonzalez
Cyclos development team
cyril_ACID
Posts: 9
Joined: Tue Jun 30, 2020 11:47 am

Re: Marketplace ad store - can't put price required

Post by cyril_ACID »

So, for the GET /api/{user}/marketplace/data-for-new

/api/self/marketplace/data-for-new (with a member user who wants to create the ads and empty body)

Answer body is :

Code: Select all

{
  "customFields": [
    {
      "id": "4036693601572265832",
      "name": "Offre Demande",
      "internalName": "tradetype",
      "type": "singleSelection",
      "control": "radio",
      "kind": "marketplace",
      "required": false,
      "defaultValue": "offer",
      "possibleValueCategories": [],
      "hasValuesList": true,
      "possibleValues": [
        {
          "id": "4036693601572265832",
          "value": "Offre",
          "internalName": "offer"
        },
        {
          "id": "4036693600766959464",
          "value": "Demande",
          "internalName": "demand"
        }
      ]
    },
    {
      "id": "4036693600766959464",
      "name": "Tags",
      "internalName": "tags",
      "type": "string",
      "control": "text",
      "kind": "marketplace",
      "required": false,
      "size": "large",
      "hasValuesList": false
    }
  ],
  "requiresAuthorization": false,
  "canCreateNew": true,
  "maxCategoriesPerAd": 1,
  "maxImages": 5,
  "categories": [
    {
      "id": "4036693613920296808",
      "name": "Bars / Restaurants",
      "internalName": "bars",
      "children": []
    },
    {
      "id": "4036693613114990440",
      "name": "Santé / Services / Artisans",
      "internalName": "health",
      "children": []
    },
    {
      "id": "4036693613383425896",
      "name": "Loisirs / Culture",
      "internalName": "entertainment",
      "children": []
    },
    {
      "id": "4036693612578119528",
      "name": "Boutiques / Commerces",
      "internalName": "shops",
      "children": []
    },
    {
      "id": "4036693612846554984",
      "name": "BTP, Construction, Energie, Transport",
      "internalName": "build",
      "children": []
    },
    {
      "id": "4036693616336215912",
      "name": "Informatique, Web, Télécom",
      "internalName": "web",
      "children": []
    },
    {
      "id": "4036693616604651368",
      "name": "Conseil, Formation, Ressources humaines",
      "internalName": "hr",
      "children": []
    },
    {
      "id": "4036693615799345000",
      "name": "Gestion, Finances, Comptabilité",
      "internalName": "finance",
      "children": []
    },
    {
      "id": "4036693616067780456",
      "name": "Autres services aux professionnels",
      "internalName": "other",
      "children": []
    },
    {
      "id": "4036693615262474088",
      "name": "Industrie, Manufacture, Distributeur",
      "internalName": "industry",
      "children": []
    },
    {
      "id": "4036693615530909544",
      "name": "Producteur, Agriculture, Agroalimentaire",
      "internalName": "agriculture",
      "children": []
    },
    {
      "id": "4036693614725603176",
      "name": "Communication, Évènementiel",
      "internalName": "event",
      "children": []
    },
    {
      "id": "4036693614994038632",
      "name": "Immobilier, Architecture",
      "internalName": "architecture",
      "children": []
    },
    {
      "id": "4036693627073634152",
      "name": "Réseaux",
      "internalName": "network",
      "children": []
    }
  ],
  "addresses": [
    {
      "id": "4036691687359029096",
      "name": "address",
      "addressLine1": "7 passage Douard",
      "zip": "44000",
      "city": "Nantes",
      "location": {
        "latitude": 47.211813,
        "longitude": -1.550854
      }
    }
  ],
  "currencies": [
    {
      "id": "4036693601572265832",
      "name": "HEOL",
      "internalName": "heol",
      "symbol": "H",
      "suffix": "H",
      "decimalDigits": 2
    }
  ],
  "kind": "simple",
  "user": {
    "id": "4036691683600932712",
    "display": "Pro Test",
    "shortDisplay": "962010",
    "image": {
      "id": "4036693508693598056",
      "name": "profile.jpg",
      "contentType": "image/jpeg",
      "length": 33679,
      "url": "https://cyclos.brest.somoney.pro/somoneyapp/api/images/content/fuM2b43g0igkHtyNKH4tpDl3k4RzjqLMxfEjmLQBmEFVM1GQxGC17wGHeEqxTjhi_380x202.jpeg",
      "width": 380,
      "height": 202
    }
  },
  "owner": {
    "id": "4036691683600932712",
    "display": "Pro Test",
    "shortDisplay": "962010",
    "image": {
      "id": "4036693508693598056",
      "name": "profile.jpg",
      "contentType": "image/jpeg",
      "length": 33679,
      "url": "https://cyclos.brest.somoney.pro/somoneyapp/api/images/content/fuM2b43g0igkHtyNKH4tpDl3k4RzjqLMxfEjmLQBmEFVM1GQxGC17wGHeEqxTjhi_380x202.jpeg",
      "width": 380,
      "height": 202
    }
  },
  "deliveryMethods": [],
  "advertisement": {
    "categories": [],
    "customValues": {
      "tradetype": "offer",
      "tags": ""
    },
    "addresses": [],
    "deliveryMethods": [],
    "images": [],
    "kind": "simple"
  }
}

POST /api/{user}/marketplace. I have api/4036691683600932712/marketplace (4036691683600932712 the id of the user connected)

With the body:

Code: Select all

{
  "name": "test",
  "description": "test",
  "categories": [
    "4036693613920296808"
  ],
  "publicationPeriod": {
    "begin": "2020-12-02T15:28:17+01:00",
    "end": "2020-12-04T15:28:17+01:00"
  },
  "customValues": {
    "tags": null
  }
}

Answer body is:

Code: Select all

{
  "properties": [
    "price"
  ],
  "propertyErrors": {
    "price": [
      "Prix est requis"
    ]
  },
  "code": "validation"
}
luis
Posts: 201
Joined: Fri Feb 17, 2006 11:01 am

Re: Marketplace ad store - can't put price required

Post by luis »

You're missing the price property:
{
"name": "test",
"price": 100.21,
"description": "test",
"categories": [
"4036693613920296808"
],
"publicationPeriod": {
"begin": "2020-12-02T15:28:17+01:00",
"end": "2020-12-04T15:28:17+01:00"
},
"customValues": {
"tags": null
}
}
Luis Fernando Planella Gonzalez
Cyclos development team
cyril_ACID
Posts: 9
Joined: Tue Jun 30, 2020 11:47 am

Re: Marketplace ad store - can't put price required

Post by cyril_ACID »

As I said in my first post
when I put the property in the body of the store request,there is still the validation error.
So I retry now with adding the price property

Code: Select all

{
  "name": "test",
  "description": "fzefz",
  "categories": [
    "4036693613920296808"
  ],
  "price": 10,
  "publicationPeriod": {
    "begin": "2020-12-03T12:07:57+01:00",
    "end": "2020-12-04T12:07:57+01:00"
  },
  "customValues": {
    "tags": null
  }
}

And I have the same error :(

Code: Select all

{
  "properties": [
    "price"
  ],
  "propertyErrors": {
    "price": [
      "Prix est requis"
    ]
  },
  "code": "validation"
}
luis
Posts: 201
Joined: Fri Feb 17, 2006 11:01 am

Re: Marketplace ad store - can't put price required

Post by luis »

Oh, now I realize.
You are required to set the currency also, otherwise the price is ignored.
Try passing the currency property with either the id or internal name of the currency,
Luis Fernando Planella Gonzalez
Cyclos development team
cyril_ACID
Posts: 9
Joined: Tue Jun 30, 2020 11:47 am

Re: Marketplace ad store - can't put price required

Post by cyril_ACID »

Thanks for your help it work well now.
Post Reply