AbstractPurchaseService
On this page
- AbstractPurchaseService ⇐
Abstract
- AbstractPurchaseService()
- getOffers([options]) ⇒
Promise.<Array>
- getMyOffers([options]) ⇒
Promise.<Array>
- getMedia(offer, content, options) ⇒
*
- getOfferDetail(offerId) ⇒
Promise.<AbstractOffer>
- purchase(offerId, options) ⇒
Promise.<string>
- cancelPurchase(offerId) ⇒
*
- confirmWatch(media, [options]) ⇒
*
- getOfferActivationStatus(offerId) ⇒
Promise.<OfferActivationStatus>
- isPaymentByCardAvailable([options]) ⇒
Promise.<*>
- _getOffers([options]) ⇒
*
- _getMyOffers([options]) ⇒
*
- _getOfferDetail(offerId) ⇒
*
- _purchase(offerId, options) ⇒
*
- _cancelPurchase(offerId) ⇒
*
- _confirmWatch(media, [options]) ⇒
*
- _getMedia(offer, content, options) ⇒
*
- _getOfferActivationStatus(offerId) ⇒
*
- “purchaseComplete” (offerId)
- “purchaseCancel” (offerId)
AbstractPurchaseService ⇐ Abstract
Kind: global abstract class
Extends: Abstract
Mixes: MServiceCache
Service:
- AbstractPurchaseService ⇐
Abstract
- new AbstractPurchaseService()
- .getOffers([options]) ⇒
Promise.<Array>
- .getMyOffers([options]) ⇒
Promise.<Array>
- .getMedia(offer, content, options) ⇒
*
- .getOfferDetail(offerId) ⇒
Promise.<AbstractOffer>
- .purchase(offerId, options) ⇒
Promise.<string>
- .cancelPurchase(offerId) ⇒
*
- .confirmWatch(media, [options]) ⇒
*
- .getOfferActivationStatus(offerId) ⇒
Promise.<OfferActivationStatus>
- .isPaymentByCardAvailable([options]) ⇒
Promise.<*>
- ._getOffers([options]) ⇒
*
- ._getMyOffers([options]) ⇒
*
- ._getOfferDetail(offerId) ⇒
*
- ._purchase(offerId, options) ⇒
*
- ._cancelPurchase(offerId) ⇒
*
- ._confirmWatch(media, [options]) ⇒
*
- ._getMedia(offer, content, options) ⇒
*
- ._getOfferActivationStatus(offerId) ⇒
*
- “purchaseComplete” (offerId)
- “purchaseCancel” (offerId)
AbstractPurchaseService()
The PurchaseService exposes the purchase API for VOD, SVOD and PayTV.
getOffers([options]) ⇒ Promise.<Array>
Get a list of available offers : -> If we have a contentId in parameter : the function return all the available offers, including this content -> Otherwise : the function return all available offers structure
Kind: instance method of AbstractPurchaseService
Returns: Promise.<Array>
- A list of models
Param | Type | Description |
---|---|---|
[options] | object | |
[options.contentId] | String | the contentId |
[options.filters] | number | possible values : byType, isPurchased, orderByPrice |
getMyOffers([options]) ⇒ Promise.<Array>
Get a list of all available offers purchased by the current user.
Kind: instance method of AbstractPurchaseService
Returns: Promise.<Array>
- A list of models
Param | Type | Description |
---|---|---|
[options] | object | |
[options.filters] | number | possible values : byType, isPurchased, orderByPrice |
getMedia(offer, content, options) ⇒ *
Get the media associated to the offer
Kind: instance method of AbstractPurchaseService
Param | Type | Description |
---|---|---|
offer | AbstractOffer | the offer |
content | AbstractContent | the content |
options | object | additional options |
getOfferDetail(offerId) ⇒ Promise.<AbstractOffer>
Get detail of the offer in parameter.
Kind: instance method of AbstractPurchaseService
Returns: Promise.<AbstractOffer>
- detail of the offer
null if the offer does not exist
Param | Type | Description |
---|---|---|
offerId | number | Id of the offer |
purchase(offerId, options) ⇒ Promise.<string>
Purchase the offer in parameter.
Kind: instance method of AbstractPurchaseService
Returns: Promise.<string>
- entitlementId the entitlementId
Param | Type | Description |
---|---|---|
offerId | number | Id of the offer |
options | Object | additional options |
options.offerType | OfferTypes | @see OfferTypes |
cancelPurchase(offerId) ⇒ *
Cancel purchase of the offer in parameter.
Kind: instance method of AbstractPurchaseService
Param | Type | Description |
---|---|---|
offerId | number | Id of the offer |
confirmWatch(media, [options]) ⇒ *
Confirm that the purchased media is being watched Some operators want to be sure that the user has started watching their video before charging the customer
Kind: instance method of AbstractPurchaseService
Param | Type | Description |
---|---|---|
media | AbstractMedia | The media being watched |
[options] | Object | Additional options |
getOfferActivationStatus(offerId) ⇒ Promise.<OfferActivationStatus>
Return the status of the offer in parameter. Lets you know if the rights have been updated after a purchase.
Kind: instance method of AbstractPurchaseService
Returns: Promise.<OfferActivationStatus>
- the status of the offer
Param | Type | Description |
---|---|---|
offerId | number | Id of the offer |
isPaymentByCardAvailable([options]) ⇒ Promise.<*>
Return Boolean to know if payment by card (prepayment card) is available
Kind: instance method of AbstractPurchaseService
Param | Type | Description |
---|---|---|
[options] | object | Additional options |
_getOffers([options]) ⇒ *
Vendor implementation for getOffers function
Kind: instance method of AbstractPurchaseService
Param | Type | Description |
---|---|---|
[options] | object | |
[options.contentId] | String | the contentId |
[options.filters] | number | possible values : byType, isPurchased, orderByPrice |
_getMyOffers([options]) ⇒ *
Vendor implementation for getMyOffers function
Kind: instance method of AbstractPurchaseService
Param | Type | Description |
---|---|---|
[options] | object | |
[options.filters] | number | possible values : byType, isPurchased, orderByPrice |
_getOfferDetail(offerId) ⇒ *
Vendor implementation for getOfferDetail function
Kind: instance method of AbstractPurchaseService
Param | Type | Description |
---|---|---|
offerId | number | Id of the offer |
_purchase(offerId, options) ⇒ *
Vendor implementation for purchase function
Kind: instance method of AbstractPurchaseService
Param | Type | Description |
---|---|---|
offerId | number | Id of the offer |
options | Object | additional options |
options.offerType | OfferTypes | @see OfferTypes |
_cancelPurchase(offerId) ⇒ *
Vendor implementation for cancelPurchase function
Kind: instance method of AbstractPurchaseService
Param | Type | Description |
---|---|---|
offerId | number | Id of the offer |
_confirmWatch(media, [options]) ⇒ *
Vendor implementation to confirm the watch of the purchase
Kind: instance method of AbstractPurchaseService
Param | Type | Description |
---|---|---|
media | AbstractMedia | The media being watched |
[options] | Object | Additional options |
_getMedia(offer, content, options) ⇒ *
Vendor implementation to get the media
Kind: instance abstract method of AbstractPurchaseService
Param | Type | Description |
---|---|---|
offer | AbstractOffer | the offer |
content | AbstractContent | the content |
options | object | additional options |
_getOfferActivationStatus(offerId) ⇒ *
Vendor implementation for getOfferStatus function
Kind: instance method of AbstractPurchaseService
Param | Type | Description |
---|---|---|
offerId | number | Id of the offer |
“purchaseComplete” (offerId)
Fired when a purchase is made
Kind: event emitted by AbstractPurchaseService
Param | Type | Description |
---|---|---|
offerId | String | offer being purchased |
“purchaseCancel” (offerId)
Fired when a purchase is cancelled
Kind: event emitted by AbstractPurchaseService
Param | Type | Description |
---|---|---|
offerId | String | offer being cancelled |