Skip to content

@collectivtech/alana-sdk-js


@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 ​

ApiContext

Returns ​

Purchase

Overrides ​

ApiResource.constructor

Properties ​

_context ​

protected _context: ApiContext

Defined in: src/resource.ts:148

The API context for this resource.

Inherited from ​

ApiResource._context


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? ​

optional details?: 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? ​

optional experienceRating?: 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? ​

optional providerRating?: 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? ​

optional userRating?: 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

ALANA™, ALANA Platform™, ALANA Guide™, and ALANA Partner™ are trademarks of Collectiv Technologies Inc.