DVCommerce class

Sales, refunds and store reversals.

Constructors

DVCommerce({required DVTax tax, required DVPaymentGateway gateway, required DVCommerceLedger ledger, DVPromotions? promotions, DVEntitlementGrants? grants, DateTime clock()?, DVLogger? logger})

Properties

gateway → DVPaymentGateway
final
grants → DVEntitlementGrants?
final
hashCode → int
The hash code for this object.
no setterinherited
ledger → DVCommerceLedger
final
promotions → DVPromotions?
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tax → DVTax
final

Methods

charge({required String orderId, required Object customer, required List<DVOrderLine> lines, required DVTaxAddress to, List<String> codes = const <String>[], Set<Entitlement> entitlements = const <Entitlement>{}, DVTaxBehavior behavior = DVTaxBehavior.exclusive}) → Future<DVSale>
Prices lines for customer on the server and captures the total.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refund({required String saleId, required String refundId, DVMoney? amount, String? reason, FutureOr<void> restock(DVContext context, DVRefund refund)?}) → Future<DVRefund>
Refunds amount of saleId, or everything left of it.
restoreSale(DVContext context, String saleId) → Future<Set<Entitlement>>
Gives back what revokeSale took, inside context. Returns what was granted.
revokeSale(DVContext context, String saleId) → Future<Set<Entitlement>>
Takes back what saleId granted, inside context, unless the customer holds it from another sale. Returns what was revoked.
storeRevocations(FutureOr<void> reverse(DVContext context, DVPurchaseChange change)) → Future<void> Function(DVPurchaseChange change)
A DVPurchases(onChange: ...) handler that runs reverse when a store takes a purchase back.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited