Controller that displays credit card and other payment information and lets the user change it.
Members
(static) Add
Adds a new credit card payment instrument to the saved payment instruments of the current customer.
- Source:
- See:
(static) Delete
Deletes a saved credit card payment instrument.
- Source:
- See:
(static) List
Renders a list of the saved credit card payment instruments of the current customer.
- Source:
- See:
(static) PaymentForm
Handles the submitted form for creating payment instruments.
- Source:
- See:
Methods
(inner) add(clearForm)
Adds a new credit card payment instrument to the saved payment instruments of the current customer. Sets the ContinueURL to PaymentInstruments-PaymentForm and renders the payment instrument details page (account/payment/paymentinstrumentdetails template). Note:this function is called by the handlePaymentForm function.
Parameters:
Name | Type | Description |
---|---|---|
clearForm |
boolean |
true or missing clears the form before displaying the page, false skips it |
(inner) create() → {boolean}
Creates a new payment instrument. Verifies the credit card and checks if it is a duplicate of a card already in the current customer's payment instruments. In a transaction, the function attempts to save the credit card to the customer's payment instruments. If a duplicate card was detected, the original card is removed after the new card is created. If the card cannot be created successfully, the transaction is rolled back. Whether successful or not, the paymentinstruments form is cleared.
Returns:
true if the credit card can be verified, false otherwise
- Type
- boolean
(inner) Delete()
Form handler for the paymentinstruments form. Handles the following actions:
- remove - uses the form and action supplied by the FormModel to remove a customer payment instrument in a transaction.
- error - does nothing.
In either case, redirects to the List function.
- Source:
- To Do:
-
- Should be moved into handlePaymentForm
(inner) handlePaymentForm()
Form handler for the paymentinstruments form. Handles the following actions:
(inner) list()
Displays a list of customer payment instruments.
Gets customer payment instrument information. Clears the paymentinstruments form and adds the customer payment information to it. Updates the page metadata. Renders a list of the saved credit card payment instruments of the current customer (account/payment/paymentinstrumentlist template).
(inner) save(params)
Saves a customer credit card payment instrument.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
params |
Object |
Properties
|
(inner) verifyCreditCard() → {boolean}
Verifies if the entered credit card details are valid.
Returns:
true in case of success, otherwise false.
- Type
- boolean