SilverCart\Paypal\Model\Paypal
Paypal payment modul
- Author: Sebastian Diel <sdiel@pixeltricks.de>, Sascha Koehler <skoehler@pixeltricks.de>
- Copyright: 2018 pixeltricks GmbH
- License: see license file in modules root directory
Synopsis
class Paypal
extends PaymentMethod
{
- // constants
- const SESSION_KEY = 'Silvercart.Paypal';
- const TOKEN_SESSION_KEY = self::SESSION_KEY . '.Token;
- const PAYERID_SESSION_KEY = self::SESSION_KEY . '.PayerID;
- const BEFORE_PAYMENT_PROVIDER_IS_PROCESSED_SESSION_KEY = self::SESSION_KEY . '.ProcessedBeforePaymentProvider;
- const AFTER_PAYMENT_PROVIDER_IS_PROCESSED_SESSION_KEY = self::SESSION_KEY . '.ProcessedAfterPaymentProvider;
- // members
- private static array $db = ;
- private static array $casting = ;
- private static array $defaults = ;
- private static array $has_many = ;
- private static string $table_name = 'SilvercartPaymentPaypal';
- protected string $moduleName = 'Paypal';
- protected string $sharedSecretVariableName = 'sh';
- public array $failedPaypalStatus = ;
- public array $successPaypalStatus = ;
- public array $refundedPaypalStatus = ;
- public array $pendingPaypalStatus = ;
- // methods
- public array fieldLabels()
- protected void getFieldsForAPI()
- protected void getFieldsForPaymentStatus()
- public FieldList getCMSFields()
- public void requireDefaultRecords()
- public void requireTable()
- public string getOrderConfirmationSubmitButtonTitle()
- public string getPaypalCheckoutUrl()
- public string getCheckoutUrl()
- public string getApiUsername()
- public string getApiPassword()
- public string getApiSignature()
- public string getNvpApiServerUrl()
- public string getSoapApiServerUrl()
- public string getApiVersion()
- public string getIPNTargetURL()
- public array getIPNRequestVariables()
- public array getIPNCustomVariables()
- public string getPayerID()
- public string getPaypalToken()
- public bool canProcessBeforePaymentProvider()
- public bool canProcessAfterPaymentProvider()
- public bool canPlaceOrder()
- public bool canProcessAfterOrder()
- protected void processBeforePaymentProvider()
- public void processAfterPaymentProvider()
- protected void processAfterOrder()
- protected string processNotification()
- public void resetProgress()
- public void clearSession()
- protected bool beforePaymentProviderIsProcessed()
- protected bool afterPaymentProviderIsProcessed()
- public string|boolean fetchPaypalToken()
- protected array initPaypalTokenParameters()
- protected void addPositionParameters()
- protected void addChargesAndDiscountsForProductsParameters()
- protected void addChargesAndDiscountsForTotalParameters()
- protected void addTaxAmountParameters()
- public bool validateSharedSecret()
- public bool isValidPaypalIPNCall()
- public void getExpressCheckoutDetails()
- public boolean doExpressCheckoutPayment()
- protected array initPaypalExpressPaymentParameters()
- public string generateUrlParams()
- public array callPaypalAPI()
- protected void deformatNVP()
- public void saveToken()
- public void savePayerID()
Hierarchy
Extends
- SilverCart\Model\Payment\PaymentMethod
Constants
Name | Value |
---|---|
SESSION_KEY | 'Silvercart.Paypal' |
TOKEN_SESSION_KEY | self::SESSION_KEY . '.Token |
PAYERID_SESSION_KEY | self::SESSION_KEY . '.PayerID |
BEFORE_PAYMENT_PROVIDER_IS_PROCESSED_SESSION_KEY | self::SESSION_KEY . '.ProcessedBeforePaymentProvider |
AFTER_PAYMENT_PROVIDER_IS_PROCESSED_SESSION_KEY | self::SESSION_KEY . '.ProcessedAfterPaymentProvider |
Members
private
- $casting
—
array
Casted attributes - $db
—
array
db field definitions - $defaults
—
array
Default db values. - $has_many
—
array
1:n relationships. - $table_name
—
string
DB table name
protected
- $moduleName
—
string
contains module name for display in the admin backend
public
- $failedPaypalStatus
—
array
contains all strings of the paypal answer which declare the transaction status false - $pendingPaypalStatus
—
array
contains all strings of the paypal answer which declare the transaction status pending - $refundedPaypalStatus
—
array
contains all strings of the paypal answer of a withdrawn payment - $successPaypalStatus
—
array
contains all strings of the paypal answer which declare the transaction status true
Methods
protected
- addChargesAndDiscountsForProductsParameters() — Adds the charges and discounts for cart positions to the Paypal token parameters.
- addChargesAndDiscountsForTotalParameters() — Adds the charges and discounts for the total amount to the Paypal token parameters.
- addPositionParameters() — Adds the shopping cart positions to the Paypal token parameters.
- addTaxAmountParameters() — Adds the charges and discounts for the total amount to the Paypal token parameters.
- afterPaymentProviderIsProcessed() — Returns whether self::processAfterPaymentProvider() is already processed.
- beforePaymentProviderIsProcessed() — Returns whether self::processBeforePaymentProvider() is already processed.
- deformatNVP() — This method will take a NVPString and convert it to an Associative Array and it will decode the response.
- getFieldsForAPI() — Adds the fields for the PayPal API
- getFieldsForPaymentStatus() — Adds the fields for the PayPal order status
- initPaypalExpressPaymentParameters() — Initializes the Paypal token parameters to send via API.
- initPaypalTokenParameters() — Initializes the Paypal token parameters to send via API.
- processAfterOrder() — Is called by default checkout right after placing an order.
- processBeforePaymentProvider() — Is called by default checkout right before placing an order.
- processNotification() — Is called when a payment provider sends a background notification to the shop.
public
- callPaypalAPI() — processes a method call via paypals NVP-API
- canPlaceOrder() — Is called by default checkout right before placing an order.
- canProcessAfterOrder() — Returns whether the checkout is ready to call self::processAfterOrder().
- canProcessAfterPaymentProvider() — Returns whether the checkout is ready to call self::processAfterPaymentProvider().
- canProcessBeforePaymentProvider() — Returns whether the checkout is ready to call self::processBeforePaymentProvider().
- clearSession() — Clears the PayPal session data.
- doExpressCheckoutPayment() — Finalizes the PayPal expres payment.
- fetchPaypalToken() — Fetches a paypal token via API-call (SetExpressCheckout) which is used for identification in further steps;
- fieldLabels() — i18n for field labels
- generateUrlParams() — Creates and returns a string ("key=value&key=value&...") from an associative array.
- getApiPassword() — Returns the PayPal API password.
- getApiSignature() — Returns the PayPal API signature.
- getApiUsername() — Returns the PayPal API username.
- getApiVersion() — Returns the PayPal SOAP API server URL.
- getCMSFields() — returns CMS fields
- getCheckoutUrl() — Returns the PayPal checkout URL.
- getExpressCheckoutDetails() — returns payment and shipping information from paypal
- getIPNCustomVariables() — returns an associative array with data passed to the field "Custom".
- getIPNRequestVariables() — accepts the variables and values sent via IPN and saves them to an associative array.
- getIPNTargetURL() — Returns the PayPal IPN target URL.
- getNvpApiServerUrl() — Returns the PayPal NVP API server URL.
- getOrderConfirmationSubmitButtonTitle() — Set the title for the submit button on the order confirmation step.
- getPayerID() — retireves paypal PayerID from the URL; IPN notification variable is different from the checkout notification.
- getPaypalCheckoutUrl() — Returns the PayPal checkout URL.
- getPaypalToken() — returns the Paypal token saved to the session
- getSoapApiServerUrl() — Returns the PayPal SOAP API server URL.
- isValidPaypalIPNCall() — called via IPN script; processes the request confirmation and adjusts the order status; paypal calls this IPN script and sends all data relevant for the request.
- processAfterPaymentProvider() — Is called right after returning to the checkout after being redirected to PayPal.
- requireDefaultRecords() — Creates and relates required order status and logo images.
- requireTable() — Renames some DB fields if necessary and then calls parent::requireTable().
- resetProgress() — Resets the payment progress hold in session.
- savePayerID() — writes the PayerID to the session
- saveToken() — saves the paypal token to the session