CustomerController

CustomerController

Controller for customers.

Constructor

new CustomerController()

Source:

Methods

addFavouriteItem(id, item_id) → {Promise.<any>}

Add a favourite item for customer

Source:
Parameters:
Name Type Description
id string

The id of the Customer

item_id int

The id of the item

Returns:
Type:
Promise.<any>
  • The id of customer whose favourite item was updated

addFavouriteVendor(id, vendor_id) → {Promise.<any>}

Add a favourite vendor for customer

Source:
Parameters:
Name Type Description
id string

The id of the Customer

vendor_id int

The id of the vendor

Returns:
Type:
Promise.<any>
  • The id of customer whose favourite vendor was updated

create(customer) → {Promise.<any>}

Create a new customer, return customer ID if successful

Source:
Parameters:
Name Type Description
customer Object

The Customer object to be created

Returns:
Type:
Promise.<any>
  • The id of the Customer object that was created

createWallet(id) → {Promise.<any>}

Create Customer Wallet

Source:
Parameters:
Name Type Description
id string

The id of the Customer Object

Returns:
Type:
Promise.<any>
  • The id of the wallet that was created

createWalletTransaction(id, transaction_type, amount, description) → {Promise.<any>}

Create a wallet transaction for customer

Source:
Parameters:
Name Type Default Description
id string

The id of the Customer

transaction_type int

Transaction type, either 'reload' or 'purchase'

amount string

The amount in cents

description string null

Optional description for transaction

Returns:
Type:
Promise.<any>
  • The id of the wallet that was reloaded

enrollApnsToken(id, token) → {Promise.<any>}

Enroll a new APNs token

Source:
Parameters:
Name Type Description
id string

The id of the Customer Object

token string

The APNS Token

Returns:
Type:
Promise.<any>

enrollFcmToken(id, token) → {Promise.<any>}

Enroll a new FCM token

Source:
Parameters:
Name Type Description
id string

The id of the Customer Object

token string

The FCM Token

Returns:
Type:
Promise.<any>

refundWallet(id, vendor_id, amount, order_id) → {Promise.<any>}

Refund customer wallet by vendor

Source:
Parameters:
Name Type Default Description
id string

The id of the Customer

vendor_id int

ID of the Vendor issuing the refund

amount string

The amount to refund the wallet (in cents)

order_id String null

Optional orderId selected payment method

Returns:
Type:
Promise.<any>
  • The id of the wallet that was reloaded

reloadWallet(id, amount, payment_method) → {Promise.<any>}

Reload customer wallet

Source:
Parameters:
Name Type Description
id string

The id of the Customer Object

amount int

The amount to load the wallet (in cents)

payment_method string

The selected payment method

Returns:
Type:
Promise.<any>
  • The id of the wallet that was reloaded

removeFavouriteItem(id, item_id) → {Promise.<any>}

Remove a favourite item for customer

Source:
Parameters:
Name Type Description
id string

The id of the Customer

item_id int

The id of the item

Returns:
Type:
Promise.<any>
  • The id of customer whose favourite item was updated

removeFavouriteVendor(id, vendor_id) → {Promise.<any>}

Remove a favourite vendor for customer

Source:
Parameters:
Name Type Description
id string

The id of the Customer

vendor_id int

The id of the vendor

Returns:
Type:
Promise.<any>
  • The id of customer whose favourite vendor was updated

resetPassword(email_address, code, password)

Reset Customer Password

Source:
Parameters:
Name Type Description
email_address string

The email address of the customer

code string

Temporary Code for Password Resets

password string

The new password

revokeApnsToken(id, token) → {Promise.<any>}

Revoke an APNs token

Source:
Parameters:
Name Type Description
id string

The id of the Customer Object

token string

The APNS Token

Returns:
Type:
Promise.<any>

revokeFcmToken(id, token) → {Promise.<any>}

Revoke an FCM token

Source:
Parameters:
Name Type Description
id string

The id of the Customer Object

token string

The FCM Token

Returns:
Type:
Promise.<any>

sendPasswordResetCode(email_address, method)

Send password reset code to customer

Source:
Parameters:
Name Type Default Description
email_address string

The email address of the customer

method string EMAIL

The method to receive the code on, either EMAIL (default) or SMS

update(id, customer) → {Promise.<any>}

Update a customer

Source:
Parameters:
Name Type Description
id string

The id of the Customer object

customer Object

The updated Customer object

Returns:
Type:
Promise.<any>
  • The id of the Customer Object that was updated

updateCreditCard(id, token) → {Promise.<any>}

Update a customer's credit card

Source:
Parameters:
Name Type Description
id string

The id of the Customer Object

token string

The Stripe Token

Returns:
Type:
Promise.<any>