Skip to content

[CT-10] Implement ticket purchase with payment token #774

@yusuftomilola

Description

@yusuftomilola

Overview

Implement the buy_ticket function so members can purchase a ticket for an event using the payment token. Work inside contracts/sandbox/event_ticketing/.

Acceptance Criteria

  • buy_ticket(env, buyer, ticket_id, event_id) is implemented
  • buyer.require_auth() is called
  • Returns Error::EventNotFound if event doesn't exist
  • Returns Error::EventNotActive if event is not in Active status
  • Returns Error::EventSoldOut if no capacity remains
  • Transfers ticket_price from buyer to contract
  • Creates and stores a Ticket record; indexes it under event and owner
  • Decrements event remaining capacity
  • Emits a purchase event
  • Code compiles with cargo build

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions