fossasia / open-event-server

The Open Event Organizer Server to Manage Events https://test-api.eventyay.com
https://api.eventyay.com
GNU General Public License v3.0
2.98k stars 1.89k forks source link

Recreate Order APIs #6302

Open iamareebjamal opened 5 years ago

iamareebjamal commented 5 years ago

There are a lot of issues in Order API and it does not fit the model of CRUD JSON RESTAPI without forcing clients to do unnecessary and buggy calculations.

Orders with tax and discounts cannot be modeled by just returning DB models and asking clients to create attendee, create order and handle ticket prices and discount code, etc

None of these APIs will be modeled by JSONAPI spec as they are not CRUD APIs with DB models backing them. Once they are finalized, the order and attendee API will be limited to just GET, and POST, PATCH and DELETE will be disabled

shreyanshdwivedi commented 5 years ago

Will create sub-issues one by one and solve it

iamareebjamal commented 4 years ago

There are some concerns over current implementation of calculation, hence fixing them and adding tests before integration in frontend

prateekj117 commented 4 years ago

@iamareebjamal So if I am sending an create-order request with say the following payload:

{
    "tickets": [
        {"id": "14", "quantity": 2},
        {"id": "13", "quantity": 1}
    ],
    "attendee": {
      "firstname": "John2",
      "lastname": "Doe",
      "email": "johndoe@example.com",
      "attendee-notes": "example notes"
    },
    "event_id": "2",
    "status": "completed"
}

Then in the complete-order request payload, the first two attendee info's will be for ticket_id 14, and the last one for ticket_id 13.

prateekj117 commented 4 years ago

For example:

{
    "attendees": [
        {
            "firstname": "John1",
            "lastname": "Doe1",
            "email": "johndoe1@example.com",
            "address": "address1"
        },
        {
            "firstname": "John2",
            "lastname": "Doe2",
            "email": "johndoe2@example.com",
            "address": "address2"
        },
        {
            "firstname": "John3",
            "lastname": "Doe3",
            "email": "johndoe3@example.com",
            "address": "address3"
        }
    ],
    "is-billing-enabled": true,
    "company": "bill company",
    "address": "bill address",
    "city": "bill city",
    "zipcode": "202001",
    "country": "bill country",
    "payment-mode": "onsite",
    "tax-business-info": "bill info 123"
}

John1, and John2 details would go to ticket holders of ticket_id 14, and John3 will go to ticket holder of ticket_id 13.

iamareebjamal commented 4 years ago

Hmm, this needs some better mechanism. Will think of something

prateekj117 commented 4 years ago

@iamareebjamal Hmmm, I also think so.

iamareebjamal commented 4 years ago

API Is now stable, so removing high priority

yagyesh-bobde commented 11 months ago

hii! I am new to this repo, but would like to start contributing. Can you tell what is remaining to work on in this issue?