@collectivtech/alana-sdk-js / resources/purchase / Purchase
Class: Purchase
Defined in: src/resources/purchase.ts:77
A resource representing a single purchase by a user for an event or experience on the ALANA Platform.
Extends
Constructors
Constructor
new Purchase(
apiResponse,context):Purchase
Defined in: src/resources/purchase.ts:147
Parameters
apiResponse
any
context
Returns
Purchase
Overrides
Properties
_context
protected_context:ApiContext
Defined in: src/resource.ts:148
The API context for this resource.
Inherited from
created
created:
Date
Defined in: src/resources/purchase.ts:125
The time (in UTC) this purchase record was created.
date
date:
Date
Defined in: src/resources/purchase.ts:107
The date of the experience or event this purchase is for. Note that this is not the date of the purchase itself.
details?
optionaldetails?:PurchaseDetails
Defined in: src/resources/purchase.ts:120
Additional details regarding the purchase.
experience
experience:
Experience
Defined in: src/resources/purchase.ts:86
The experience which was purchased.
experienceRating?
optionalexperienceRating?:number
Defined in: src/resources/purchase.ts:135
The experience's rating by the user.
guests
guests:
number
Defined in: src/resources/purchase.ts:101
The number of guests (i.e., the number of tickets sold) for this purchase.
id
id:
number
Defined in: src/resources/purchase.ts:81
The purchase ID.
price
price:
number
Defined in: src/resources/purchase.ts:96
The total price paid for this purchase.
providerRating?
optionalproviderRating?:number
Defined in: src/resources/purchase.ts:140
The experience seller's rating by the user.
seller
seller:
Business
Defined in: src/resources/purchase.ts:91
The seller of the experience or event.
state
state:
ExperiencePurchaseState
Defined in: src/resources/purchase.ts:115
The state of this purchase:
- open - Some or all of the tickets have yet to be closed
- complete - All tickets have been closed
- canceled - The user or seller has canceled or refunded the purchase
tickets
tickets:
Ticket[]
Defined in: src/resources/purchase.ts:130
An array of Ticket resources representing the tickets included in the purchase.
userRating?
optionaluserRating?:number
Defined in: src/resources/purchase.ts:145
The experience provider's rating for the user.
Methods
rateExperience()
rateExperience(
rating):Promise<boolean>
Defined in: src/resources/purchase.ts:200
Rate the experience associated with this purchase. This requires at least one ticket, to prove that the experience was purchased and attended. Ratings are integers 1-5, representing star ratings.
If your ALANA partner site prefers to use other rating systems, perform the following conversions:
- For "thumbs-up/thumbs-down" systems:
- Thumbs up: 5
- Thumbs down: 1
- For positive/neutral/negative "feedback" systems:
- Positive: 5
- Neutral: 3
- Negative: 1
Parameters
rating
number
The rating to give, which must be an integer in the range 0-5
Returns
Promise<boolean>
true if the operation succeeded
rateProvider()
rateProvider(
rating):Promise<boolean>
Defined in: src/resources/purchase.ts:245
Rate the provider of the experience associated with this purchase. This requires at least one ticket to prove that the experience was purchased and attended. Ratings are integers 1-5, representing star ratings.
If your ALANA partner site prefers to use other rating systems, perform the following conversions:
- For "thumbs-up/thumbs-down" systems:
- Thumbs up: 5
- Thumbs down: 1
- For positive/neutral/negative "feedback" systems:
- Positive: 5
- Neutral: 3
- Negative: 1
Parameters
rating
number
The rating to give, which must be an integer in the range 0-5
Returns
Promise<boolean>
true if the operation succeeded