Skip to content

Latest commit

 

History

History
394 lines (217 loc) · 9.25 KB

CdvPurchase.Braintree.Adapter.md

File metadata and controls

394 lines (217 loc) · 9.25 KB

Class: Adapter

CdvPurchase.Braintree.Adapter

Adapter for a payment or in-app purchase platform

Implements

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Adapter(context, options)

Parameters

Name Type
context AdapterContext
options AdapterOptions

Properties

_receipts

_receipts: BraintreeReceipt[] = []


androidBridge

Optional androidBridge: Bridge


id

id: Platform = Platform.BRAINTREE

Platform identifier

Implementation of

Adapter.id


iosBridge

Optional iosBridge: Bridge


log

log: Logger


name

name: string = 'BrainTree'

Nice name for the adapter

Implementation of

Adapter.name


options

options: AdapterOptions


products

products: Product[] = []

Implementation of

Adapter.products


ready

ready: boolean = false

true after the platform has been successfully initialized.

The value is set by the "Adapters" class (which is responsible for initializing adapters).

Implementation of

Adapter.ready

Accessors

isSupported

get isSupported(): boolean

Returns true is the adapter is supported on this device.

Returns

boolean

Implementation of

CdvPurchase.Adapter.isSupported


receipts

get receipts(): Receipt[]

List of purchase receipts.

Returns

Receipt[]

Implementation of

CdvPurchase.Adapter.receipts

Methods

checkSupport

checkSupport(functionality): boolean

Returns true if the platform supports the given functionality.

Parameters

Name Type
functionality PlatformFunctionality

Returns

boolean

Implementation of

Adapter.checkSupport


finish

finish(transaction): Promise<undefined | IError>

Finish a transaction.

For non-consumables, this will acknowledge the purchase. For consumable, this will acknowledge and consume the purchase.

Parameters

Name Type
transaction Transaction

Returns

Promise<undefined | IError>

Implementation of

Adapter.finish


handleReceiptValidationResponse

handleReceiptValidationResponse(receipt, response): Promise<void>

Handle platform specific fields from receipt validation response.

Parameters

Name Type
receipt Receipt
response Payload

Returns

Promise<void>

Implementation of

Adapter.handleReceiptValidationResponse


initialize

initialize(): Promise<undefined | IError>

Initialize the Braintree Adapter.

Returns

Promise<undefined | IError>

Implementation of

Adapter.initialize


load

load(products): Promise<(IError | Product)[]>

Load product definitions from the platform.

Parameters

Name Type
products IRegisterProduct[]

Returns

Promise<(IError | Product)[]>

Implementation of

Adapter.load


manageBilling

manageBilling(): Promise<undefined | IError>

Open the platforms' billing management interface.

Returns

Promise<undefined | IError>

Implementation of

Adapter.manageBilling


manageSubscriptions

manageSubscriptions(): Promise<undefined | IError>

Open the platforms' subscription management interface.

Returns

Promise<undefined | IError>

Implementation of

Adapter.manageSubscriptions


order

order(offer): Promise<undefined | IError>

Initializes an order.

Parameters

Name Type
offer Offer

Returns

Promise<undefined | IError>

Implementation of

Adapter.order


receiptValidationBody

receiptValidationBody(receipt): undefined | Body

Prepare for receipt validation

Parameters

Name Type
receipt BraintreeReceipt

Returns

undefined | Body

Implementation of

Adapter.receiptValidationBody


requestPayment

requestPayment(paymentRequest, additionalData?): Promise<undefined | IError | Transaction>

Request a payment from the user

Parameters

Name Type
paymentRequest PaymentRequest
additionalData? AdditionalData

Returns

Promise<undefined | IError | Transaction>

Implementation of

Adapter.requestPayment


restorePurchases

restorePurchases(): Promise<void>

Replay the queue of transactions.

Might ask the user to login.

Returns

Promise<void>

Implementation of

Adapter.restorePurchases