Either merchants that fully integrate js api and use the default cashier, or merchants that use their own forms, they will need to interact and use the given public methods to retrieve account data, to perform an account registration etc.
EPGJS includes three main public objects merchants can make use of:
This object manages most of the rendering available methods to render a cashier or methods that control the flow such as rendering callback success/errors, field function validations, etc.
The following table will go over all the public methods, showing their params and the method explanation:
|renderCashier||authToken, containerDiv||This method will be called whenever we want to render the cashier in a div provided as parameter. It takes two parameters:
|renderRegisterAccount||publicMerchantToken, paysol, containerDiv||This method will be used to render an anonymous cashier. This will be specially useful for ecom business where they don’t keep track or register their customers information. It takes three parameters.
|setRenderCashierErrorCallback||merchantFunction||This method will allow the merchant to set a function that will be fired whenever an error renderingTheCashier is raised. The unique param that it takes is a function to be fired when an error is raised|
|setPrePayAccountErrorCallback||merchantFunction||This method will allow the merchant to set a function that will be fired whenever an error calling to a prepay action is raised.|
|setRemoveAccountErrorCallback||merchantFunction||This method will allow the merchant to set a function that will be fired whenever an error removing an account is raised.|
|setQuickPayErrorCallback||merchantFunction||This method will allow the merchant to set a function that will be fired whenever an error performing a quickDeposit is raised.|
|setOnFormSubmit||merchantfunction||This method will allow the merchant to override the formSubmit behavior which is triggered on all the communications actions. By default this function takes a resumeMethod and dataParam as paremters and resumeMethod will be called with dataParam|
|setTranslate||merchantFunction||This method will allow the merchant to override the translate function that epgjs uses by default.|
|getLang||Gets the language setted in the epgjs object to render the cashier|
|setLang||lang||Sets the language to be used by the epgjs object to render the cashier|
|getI18n||Gets the internationalization object used to render the cashier. This object is grouped by languages and has the label translations for the objects of the cashier|
|setI18n||i18n||Sets the internationalization object used to render the cashier. This allows to extend the cashier’s translation to other languages|
|setShowAllPaysolToRegisterAndQuickDeposit||allow||Sets a flag to tell the api whether it will draw the anonymous available payments solutions under the register or the quickpay options or not|
|getTranslate||Gets the translation function used to render the cashier|
|setOnBlurOverrideValidationError||merchantFunction||This method will allow the merchant to override the validation function that epgjs uses by default to detect whether a field has errors or not|
|getRegisterAccountErrorCallback||merchantFunction||This function will allow the merchant to override the function that will be triggered whenever an error is raised registering an account|
|getPaymentMethod||This function will return all the payment solutions configured for the merchant and product used in the authToken|
This object is meant to manage all the communications against EPGJS integration endpoints, allowing the merchant to override some of the functions that will be called after this calls.
|callForRetrieveCashierData||authToken, successCallback, errorCallback||Function that will be used by epgjs api to get all the info to render a cashier.
|callForRetrieveRegisterCashierData||publicMerchantToken, paysol, successCallback, errorCallback||Function used to draw an specific paysol form for an anonymous user.
|callForDisableAccount||accountId, authToken, successCallback, errorCallback||Function used to disable a specific account.
|callForPrePay||accountId, authToken, jsonData, successCallback, errorCallback||Function that will call an specific endpoint to perform a prepay operation.
|callForRegisterAccount||jsonData, paysol, authToken, successCallback, errorCallback||Function that will call an specific endpoint to register a customer account.
|callForQuickPay||jsonData, paysol, authToken, successCallback, errorCallback||Function that will call to an specific endpoint to perform a quickpay operation (register + prepay).
|setCallMethod||callFunction||Method that will override the call function with a personalized function|
|getEpgBaseUrl||Function that will return an EPG base url used for different functions to call to several endpoints|
|setEpgBaseUrl||url||Method that will set the EPG base url to call to different endpoints|
|getMerchantRegisterAccountCallback||Function that will return the function to be called on a success registered account|
|setMerchantRegisterAccountCallback||merchantFunction||Method that will set a function to be called on a success register account|
|setRegisterAccountErrorCallback||merchantFunction||Method that will set a function to be called on an error register account|
|getRegisterAccountErrorCallback||Function that will get the function used on an account registration error result|
|getMerchantPrepayCallback||Function that will get the function used on a prepay operation success result.|
|setMerchantPrepayCallback||merchantFunction||Method that will set a function to be called on a prepay success operation result|
|getShowOnlyCardRegister||Function that will return whether option to register a credit card will appear or not|
|setShowOnlyCardRegister||showOnlyCardReg||Method that will set whether credit card registration will appear or not|
|getOnlyRegisteredAccounts||Function that will return whether option to register accounts will appear or not|
|setOnlyRegisteredAccounts||onlyRegisteredAccounts||Method that will set whether account registration will appear or not|
This object will allow merchants to customize the default css styles for the rendered cashier elements.
|getClass||key||Function that will return the style class used for an specific theme.|
|getCssTheme||Function that will return the setted css theme|
|setCssTheme||theme||Sets the theme to be used by the cashier|