PayPalController
extends HttpViewController
in package
Class PayPalController
Table of Contents
- $assets : AssetCollectionInterface
- $configurationStorage : PayPalConfigurationStorage
- $contentView : ContentViewInterface
- $httpContextReader : HttpContextReaderInterface
- $httpResponseProcessor : HttpResponseProcessorInterface
- $logger : PayPalLogger
- $paypalText : PayPalText
- $postDataArray : array<string|int, mixed>
- $queryParametersArray : array<string|int, mixed>
- $serverDataArray : array<string|int, mixed>
- __construct() : mixed
- Initialize the Controller with required properties
- actionBankTxnPending() : mixed
- dummy action for the bank transaction pending URL.
- actionCancelECS() : mixed
- invalidates session data when the user cancels an ECS login
- actionCartECS() : mixed
- sets the ECS shopping cart flag to true.
- actionDefault() : HttpControllerResponseInterface
- Run the actionDefault method.
- actionLogoffECSCustomer() : mixed
- called by a CheckoutSuccessExtender to end an ECS guest session
- actionPaylink() : mixed
- Endpoint for paylink processing.
- actionPaylinkReturn() : mixed
- action used in return URLs for the paylink feature.
- actionPrepareECS() : mixed
- creates a PayPal payment for the ECS flow and redirects the customer to the ECS login page.
- actionReturnFromECS() : mixed
- called as the return URL when a customer returns from an ECS login.
- actionSetPayment() : mixed
- called by the third party payments integration in PayPal Plus, this action simply sets one of the supported payment methods as the selected method and invalidates the PayPal payment which has been created for the paywall.
- actionStatusUpdate() : mixed
- This action can be called from a cronjob to update orders still in pending state.
- actionWebhook() : mixed
- called by PayPal to deliver Webhook notifications.
- proceed() : mixed
- Processes a http response object which is get by invoking an action method.
- _callActionMethod() : HttpControllerResponseInterface
- Invokes an action method by the given action name.
- _findCountryByID() : mixed
- _getPostData() : string|null
- Returns the expected $_POST value by the given key name.
- _getPostDataCollection() : KeyValueCollection
- Creates and returns a key value collection which represent the global $_POST array.
- _getQueryParameter() : mixed|null
- Returns the expected $_GET value by the given key name.
- _getQueryParametersCollection() : KeyValueCollection
- Creates and returns a key value collection which represent the global $_GET array.
- _getServerData() : string|null
- Returns the expected $_SERVER value by the given key name.
- _isValidPayment() : bool
- determines if a payment module is currently installed.
- _render() : string
- Renders and returns a template file.
- _validatePageToken() : mixed
- Check if the $_POST['pageToken'] or $_GET['pageToken'] variable is provided and if it's valid.
- getCustomerByEmail() : mixed
- getCustomerCountryIdByIso2() : mixed
- getLocale() : mixed
- determines LocaleCode from session data
- getQueryBuilder() : CI_DB_query_builder
- returns a QueryBuilder instance for database access.
- getTemplateFile() : ExistingFile
- Searches the GXModules directory and admin/html directory for a template file, wich can be useed inside the AdminLayoutHttpControllerResponse object for the template parameter.
- loginCustomer() : mixed
- splitStreet() : array<string|int, mixed>
- Heuristically splits up a street address into its component street name and house number
- updateOrdersStatus() : mixed
- updates order status and adds entry to status history
Properties
$assets
protected
AssetCollectionInterface
$assets
$configurationStorage
protected
PayPalConfigurationStorage
$configurationStorage
$contentView
protected
ContentViewInterface
$contentView
$httpContextReader
protected
HttpContextReaderInterface
$httpContextReader
$httpResponseProcessor
protected
HttpResponseProcessorInterface
$httpResponseProcessor
$logger
protected
PayPalLogger
$logger
$paypalText
protected
PayPalText
$paypalText
$postDataArray
protected
array<string|int, mixed>
$postDataArray
$queryParametersArray
protected
array<string|int, mixed>
$queryParametersArray
$serverDataArray
protected
array<string|int, mixed>
$serverDataArray
Methods
__construct()
Initialize the Controller with required properties
public
__construct(HttpContextReaderInterface $httpContextReader, HttpResponseProcessorInterface $httpResponseProcessor, ContentViewInterface $contentView) : mixed
Parameters
- $httpContextReader : HttpContextReaderInterface
- $httpResponseProcessor : HttpResponseProcessorInterface
- $contentView : ContentViewInterface
Tags
Return values
mixed —actionBankTxnPending()
dummy action for the bank transaction pending URL.
public
actionBankTxnPending() : mixed
The flow that used to require this has recently been deprecated by PayPal.
Return values
mixed —actionCancelECS()
invalidates session data when the user cancels an ECS login
public
actionCancelECS() : mixed
Return values
mixed —actionCartECS()
sets the ECS shopping cart flag to true.
public
actionCartECS() : mixed
The flag is used in ECSButton.js as an indication that the customer is to be redirected to PayPal for an ECS login. This is required for the ECS button on products pages to work as intended.
Return values
mixed —actionDefault()
Run the actionDefault method.
public
actionDefault() : HttpControllerResponseInterface
Return values
HttpControllerResponseInterface —actionLogoffECSCustomer()
called by a CheckoutSuccessExtender to end an ECS guest session
public
actionLogoffECSCustomer() : mixed
Return values
mixed —actionPaylink()
Endpoint for paylink processing.
public
actionPaylink() : mixed
Paylinks created from the order details page are directed at this action. If the paycode hash is valid a payment will be created and the customer redirected to PayPal to approve the payment.
Return values
mixed —actionPaylinkReturn()
action used in return URLs for the paylink feature.
public
actionPaylinkReturn() : mixed
Takes the PayerID from the query parameters and executes the payment created by actionPaylink(), then displays a quick thank you note.
Return values
mixed —actionPrepareECS()
creates a PayPal payment for the ECS flow and redirects the customer to the ECS login page.
public
actionPrepareECS() : mixed
Return values
mixed —actionReturnFromECS()
called as the return URL when a customer returns from an ECS login.
public
actionReturnFromECS() : mixed
If the customer is not logged in, a guest account will be created from data provided by PayPal.
Return values
mixed —actionSetPayment()
called by the third party payments integration in PayPal Plus, this action simply sets one of the supported payment methods as the selected method and invalidates the PayPal payment which has been created for the paywall.
public
actionSetPayment() : mixed
Return values
mixed —actionStatusUpdate()
This action can be called from a cronjob to update orders still in pending state.
public
actionStatusUpdate() : mixed
Supposed to be used as a replacement for Webhooks in cases where the shop is inaccessible for PayPal, e.g. due to missing TLS accessibility.
Return values
mixed —actionWebhook()
called by PayPal to deliver Webhook notifications.
public
actionWebhook() : mixed
Any incoming notification will be recorded in the order status history of the corresponding order. If the HMAC signature check fails, a warning will be added. Notifications of type PAYMENT.SALE.COMPLETED cause the order to be transferred to the status for completed orders.
Return values
mixed —proceed()
Processes a http response object which is get by invoking an action method.
public
proceed(HttpContextInterface $httpContext) : mixed
The action method is determined by the http context reader instance and the current request context. Re-implement this method in child classes to enable XSS and CSRF protection on demand.
Parameters
- $httpContext : HttpContextInterface
-
Http context object which hold the request variables.
Tags
Return values
mixed —_callActionMethod()
Invokes an action method by the given action name.
protected
_callActionMethod(string $actionName) : HttpControllerResponseInterface
Parameters
- $actionName : string
-
Name of action method to call, without 'action'-Suffix.
Tags
Return values
HttpControllerResponseInterface —Response message.
_findCountryByID()
protected
_findCountryByID(mixed $country_id) : mixed
Parameters
- $country_id : mixed
Return values
mixed —_getPostData()
Returns the expected $_POST value by the given key name.
protected
_getPostData(string $keyName) : string|null
This method is the object oriented layer for $_POST[$keyName].
Parameters
- $keyName : string
-
Expected key of post parameter.
Return values
string|null —Either the expected value or null, of not found.
_getPostDataCollection()
Creates and returns a key value collection which represent the global $_POST array.
protected
_getPostDataCollection() : KeyValueCollection
Return values
KeyValueCollection —_getQueryParameter()
Returns the expected $_GET value by the given key name.
protected
_getQueryParameter(string $keyName) : mixed|null
This method is the object oriented layer for $_GET[$keyName].
Parameters
- $keyName : string
-
Expected key of query parameter.
Return values
mixed|null —Either the expected value or null, of not found.
_getQueryParametersCollection()
Creates and returns a key value collection which represent the global $_GET array.
protected
_getQueryParametersCollection() : KeyValueCollection
Return values
KeyValueCollection —_getServerData()
Returns the expected $_SERVER value by the given key name.
protected
_getServerData(string $keyName) : string|null
This method is the object oriented layer for $_SERVER[$keyName].
Parameters
- $keyName : string
-
Expected key of server parameter.
Return values
string|null —Either the expected value or null, of not found.
_isValidPayment()
determines if a payment module is currently installed.
protected
_isValidPayment(mixed $paymentCode) : bool
Caveat: This only works for modules where the filename (plus '.php') is identical with the module code.
Parameters
- $paymentCode : mixed
Return values
bool —true if module is installed
_render()
Renders and returns a template file.
protected
_render(string $templateFile, array<string|int, mixed> $contentArray) : string
Parameters
- $templateFile : string
-
Template file to render.
- $contentArray : array<string|int, mixed>
-
Content array which represent the variables of the template.
Return values
string —Rendered template.
_validatePageToken()
Check if the $_POST['pageToken'] or $_GET['pageToken'] variable is provided and if it's valid.
protected
_validatePageToken([string $customExceptionMessage = null ]) : mixed
Example: public function proceed(HttpContextInterface $httpContext) { parent::proceed($httpContext); // proceed http context from parent class if($_SERVER['REQUEST_METHOD'] === 'POST') { $this->_validatePageToken(); // CSRF Protection } }
Parameters
- $customExceptionMessage : string = null
-
(optional) You can specify a custom exception message.
Tags
Return values
mixed —getCustomerByEmail()
protected
getCustomerByEmail(mixed $email_address) : mixed
Parameters
- $email_address : mixed
Return values
mixed —getCustomerCountryIdByIso2()
protected
getCustomerCountryIdByIso2(mixed $iso2) : mixed
Parameters
- $iso2 : mixed
Return values
mixed —getLocale()
determines LocaleCode from session data
protected
getLocale() : mixed
Return values
mixed —getQueryBuilder()
returns a QueryBuilder instance for database access.
protected
getQueryBuilder() : CI_DB_query_builder
Return values
CI_DB_query_builder —Returns a database driver that can be used for db operations.
getTemplateFile()
Searches the GXModules directory and admin/html directory for a template file, wich can be useed inside the AdminLayoutHttpControllerResponse object for the template parameter.
protected
getTemplateFile(string $templateFile) : ExistingFile
Parameters
- $templateFile : string
-
The relative path and filename to search for
Tags
Return values
ExistingFile —containing absolute file path to the given template file
loginCustomer()
protected
loginCustomer(Customer $customer) : mixed
Parameters
- $customer : Customer
Return values
mixed —splitStreet()
Heuristically splits up a street address into its component street name and house number
protected
splitStreet(mixed $street_address) : array<string|int, mixed>
Parameters
- $street_address : mixed
Return values
array<string|int, mixed> —with keys 'street' and 'house_no'
updateOrdersStatus()
updates order status and adds entry to status history
protected
updateOrdersStatus(mixed $orders_id[, mixed $orders_status_id = null ][, mixed $comments = '' ]) : mixed
Parameters
- $orders_id : mixed
- $orders_status_id : mixed = null
- $comments : mixed = ''