Properties

$_responseType

$_responseType : string

The type of response (customers or plans or promotions or error)

Type

string

$_array

$_array : array

An array representation of the response obj

Type

array

Methods

__construct()

__construct(mixed $response)

Constructor

Parameters

mixed $response

string well formed xml

Throws

\CheddarGetter_Response_Exception

in the event the xml is not well formed

__sleep()

__sleep() : array

Sleep

This is run when the object is serialized, for example. See PHP magic __sleep method docs.

Returns

array

__wakeup()

__wakeup()

Wakeup

This is run when the object is unserialized, for example. See PHP magic __wakeup method docs.

getResponseType()

getResponseType() : string

Get the response type for this request object -- usually corresponds to the root node name

Returns

string

hasEmbeddedErrors()

hasEmbeddedErrors() : boolean

Determine whether or not the response doc contains embedded errors

Returns

boolean

getEmbeddedErrors()

getEmbeddedErrors() : array|false

Get embedded errors if any

Returns

array|false

toArray()

toArray() : array

Get a nested array representation of the response doc

Returns

array

toJson()

toJson() : string

Get a JSON encoded string representation of the response doc

Returns

string

getPlan()

getPlan(mixed $code) : array

Get an array representation of a single plan node

Parameters

mixed $code

string your code for the plan - required if more than one plan is in the response

Throws

\CheddarGetter_Response_Exception

if the response type is incompatible or if a $code is not provided and the response contains more than one plan

Returns

array

getPlanItems()

getPlanItems(mixed $code) : array

Get an array representation of all of the plan items

Parameters

mixed $code

string your code for the plan - required if more than one plan is in the response

Throws

\CheddarGetter_Response_Exception

if the response type is incompatible or if a $code is not provided and the response contains more than one plan

Returns

array

getPlanItem()

getPlanItem(mixed $code, mixed $itemCode) : array

Get an array representation of a single plan item node

Parameters

mixed $code

string your code for the plan - required if more than one plan is in the response

mixed $itemCode

your code for the item - required if more than one item is in the response

Throws

\CheddarGetter_Response_Exception

if the response type is incompatible or if a $code is not provided and the response contains more than one plan

Returns

array

getPromotion()

getPromotion(mixed $couponCode) : array

Get an array representation of a single promotion node

Parameters

mixed $couponCode

string your code for the coupon within the promotion - required if more than one promotion is in the response

Throws

\CheddarGetter_Response_Exception

if the response type is incompatible or if a $code is not provided and the response contains more than one promotion

Returns

array

getCustomer()

getCustomer(mixed $code) : array

Get an array representation of a single customer node

Parameters

mixed $code

string your code for the customer - required if more than one customer is in the response

Throws

\CheddarGetter_Response_Exception

if the response type is incompatible or if a $code is not provided and the response contains more than one customer

Returns

array

getCustomerSubscription()

getCustomerSubscription(mixed $code) : array

Get an array representation of a single customer's current subscription

Parameters

mixed $code

string your code for the customer - required if more than one customer is in the response

Throws

\CheddarGetter_Response_Exception

if the response type is incompatible or if a $code is not provided and the response contains more than one customer

Returns

array

getCustomerIsActive()

getCustomerIsActive(mixed $code, mixed $remainActiveThroughEndOfPeriod) : array

Whether or not a customer's subscription is active and in good standing

Parameters

mixed $code

string your code for the customer - required if more than one customer is in the response

mixed $remainActiveThroughEndOfPeriod

bool Set to true if you'd like the account to remain active until the end of the current payment period rather than inactive at the moment of cancelation

Throws

\CheddarGetter_Response_Exception

if the response type is incompatible or if a $code is not provided and the response contains more than one customer

Returns

array

getCustomerIsWaitingForPayPal()

getCustomerIsWaitingForPayPal(mixed $code) : array

Is this customer's account pending paypal preapproval confirmation?

Parameters

mixed $code

string your code for the customer - required if more than one customer is in the response

Throws

\CheddarGetter_Response_Exception

if the response type is incompatible or if a $code is not provided and the response contains more than one customer

Returns

array

getCustomerSubscriptions()

getCustomerSubscriptions(mixed $code) : array

Get an array representation of a single customer's subscriptions (history)

Parameters

mixed $code

string your code for the customer - required if more than one customer is in the response

Throws

\CheddarGetter_Response_Exception

if the response type is incompatible or if a $code is not provided and the response contains more than one customer

Returns

array

getCustomerPlan()

getCustomerPlan(mixed $code) : array

Get an array representation of a single customer's currently subscribed plan

Parameters

mixed $code

string your code for the customer - required if more than one customer is in the response

Throws

\CheddarGetter_Response_Exception

if the response type is incompatible or if a $code is not provided and the response contains more than one customer

Returns

array

getCustomerInvoice()

getCustomerInvoice(mixed $code) : array

Get an array representation of a single customer's current invoice

Parameters

mixed $code

string your code for the customer - required if more than one customer is in the response

Throws

\CheddarGetter_Response_Exception

if the response type is incompatible or if a $code is not provided and the response contains more than one customer

Returns

array

getCustomerLastBilledInvoice()

getCustomerLastBilledInvoice(mixed $code) : array

Get an array representation of a single customer's last billed invoice

Returns the most recent subscription invoice that is billable before now. This could be a successfully billed invoice, one that has been transacted unsuccessfully, or one that has not yet been transacted at all. Includes all invoice types ('one-time' and 'subscription')

Parameters

mixed $code

string your code for the customer - required if more than one customer is in the response

Throws

\CheddarGetter_Response_Exception

if the response type is incompatible or if a $code is not provided and the response contains more than one customer

Returns

array

getCustomerInvoices()

getCustomerInvoices(mixed $code) : array|false

Get an array representation of a single customer's invoices

Parameters

mixed $code

string your code for the customer - required if more than one customer is in the response

Throws

\CheddarGetter_Response_Exception

if the response type is incompatible or if a $code is not provided and the response contains more than one customer

Returns

array|false

getCustomerTransactions()

getCustomerTransactions(mixed $code) : array|false

Get an array representation of a single customer's transactions

Parameters

mixed $code

string your code for the customer - required if more than one customer is in the response

Throws

\CheddarGetter_Response_Exception

if the response type is incompatible or if a $code is not provided and the response contains more than one customer

Returns

array|false

getCustomerLastTransaction()

getCustomerLastTransaction(mixed $code) : array|false

Get an array representation of a single customer's last transaction (successful or otherwise)

Parameters

mixed $code

string your code for the customer - required if more than one customer is in the response

Throws

\CheddarGetter_Response_Exception

if the response type is incompatible or if a $code is not provided and the response contains more than one customer

Returns

array|false

getCustomerOutstandingInvoices()

getCustomerOutstandingInvoices(mixed $code) : array|false

Get an array representation of a single customer's outstanding invoices

Parameters

mixed $code

string your code for the customer - required if more than one customer is in the response

Throws

\CheddarGetter_Response_Exception

if the response type is incompatible or if a $code is not provided and the response contains more than one customer

Returns

array|false

getCustomerItemQuantity()

getCustomerItemQuantity(mixed $code, mixed $itemCode) : array

Get an array of a customer's item quantity and quantity included

Parameters

mixed $code

string your code for the plan - required if more than one plan is in the response

mixed $itemCode

your code for the item - required if more than one item is in the response

Throws

\CheddarGetter_Response_Exception

if the response type is incompatible or if a $code is not provided and the response contains more than one customer or if a $itemCode is not provided and the plan contains more than one tracked item

Returns

array —

2 keys: 'item' (item config for this plan) and 'quantity' the customer's current quantity usage

getCustomerItemQuantityRemaining()

getCustomerItemQuantityRemaining(mixed $code, mixed $itemCode) : string

Get remaining quantity (quantity included minus current quantity)

Parameters

mixed $code

string your code for the plan - required if more than one plan is in the response

mixed $itemCode

your code for the item - required if more than one item is in the response

Throws

\CheddarGetter_Response_Exception

if the response type is incompatible or if a $code is not provided and the response contains more than one customer or if a $itemCode is not provided and the plan contains more than one tracked item

Returns

string

getCustomerItemQuantityOverage()

getCustomerItemQuantityOverage(mixed $code, mixed $itemCode) : string

Get quantity usage greater than included quantity

Parameters

mixed $code

string your code for the plan - required if more than one plan is in the response

mixed $itemCode

your code for the item - required if more than one item is in the response

Throws

\CheddarGetter_Response_Exception

if the response type is incompatible or if a $code is not provided and the response contains more than one customer or if a $itemCode is not provided and the plan contains more than one tracked item

Returns

string

getCustomerItemQuantityOverageCost()

getCustomerItemQuantityOverageCost(mixed $code, mixed $itemCode) : string

Get current item overage cost

Parameters

mixed $code

string your code for the plan - required if more than one plan is in the response

mixed $itemCode

your code for the item - required if more than one item is in the response

Throws

\CheddarGetter_Response_Exception

if the response type is incompatible or if a $code is not provided and the response contains more than one customer or if a $itemCode is not provided and the plan contains more than one tracked item

Returns

string

handleError()

handleError() : bool

Handle an error if there is one

Throws

\CheddarGetter_Response_Exception

Throws CheddarGetter_Response_Exception if an error is found in the response

Returns

bool

handleEmbeddedErrors()

handleEmbeddedErrors() : boolean

Checks for embedded errors and if found, throws an exception containing the first error

Embedded errors typically occur when some transaction-related action is performed as part of another request. For example, if a customer is created and subscribed to a paid plan with a setup fee, the customer is created and the credit card is validated and then a transaction is run for the amount of the setup fee. If the transaction fails, there will be an embedded error with information about the failed transaction.

Throws

\CheddarGetter_Response_Exception

if there are embedded errors in the response

Returns

boolean —

false if no embedded errors

__toString()

__toString() : string

Implementation of the magic __toString method

Returns

string —

The XML string

_toArray()

_toArray(\DOMNodeList $nodes) : array

Recursive method to traverse the dom and produce an array

Parameters

\DOMNodeList $nodes

Returns

array