Download the PHP package khalyomede/systempay without Composer
On this page you can find all versions of the php package khalyomede/systempay. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download khalyomede/systempay
More information about khalyomede/systempay
Files in khalyomede/systempay
Package systempay
Short Description Generates form fields for payment and process payment notifications (IPN) for Systempay.
License MIT
Informations about the package systempay
khalyomede/systempay
Generates form fields for payment and process payment notifications (IPN) for Systempay.
Summary
- About
- Requirements
- Installation
- Examples
- API
- Run the tests
- Compatibility table
About
I created this package to be able to use it in my Laravel shop application.
I have seen the packages of others folks, but I either did not found every tools I need, or the tools were untested.
I hope to provide folks with a tested library so you can use it with confidence.
This package respects the Semantic versioning.
Requirements
- Composer
- PHP version 7.1+ (corresponds to Laravel 5.6+)
Installation
In the root of your folder project, run this command:
Examples
- 1. Generating form payment hidden fields
- 2. Processing a payment notification (IPN)
1. Generating form payment hidden fields
In this example, we will only fill mandatories fields before generating the hidden HTML inputs to inject in an HTML page.
2. Processing a payment notification (IPN)
In this example, we will provide with the raw POST response from the Systempay server to proces the notification.
API
Khalyomede\Systempay\Payment::class
Payment::__construct
Payment::getHashAlgorithm
Payment::getTotalAmount
Payment::getFormTotalAmount
Payment::getSiteId
Payment::getContextMode
Payment::getCurrencyNumericCode
Payment::getPaymentConfiguration
Payment::getTransactionDate
Payment::getFormTransactionDate
Payment::getTransactionId
Payment::getVersion
Payment::getActionMode
Payment::getPageAction
Payment::getHtmlFormFields
Payment::getKey
Payment::getFormUrl
Payment::setHashAlgorithm
Payment::setTotalAmount
Payment::setSiteId
Payment::setContextMode
Payment::setCurrency
Payment::setPaymentConfiguration
Payment::setTransactionDate
Payment::setTransactionId
Khalyomede\Systempay\ContextMode::class
ContextMode::__construct
ContextMode::isAllowed
ContextMode::getAllowedToString
Khalyomede\Systempay\HashAlgorithm::class
HashAlgorithm::__construct
HashAlgorithm::isSupported
HashAlgorithm::isAllowed
HashAlgorithm::getAllowedToString
Khalyomede\Systempay\PaymentConfiguration::class
PaymentConfiguration::__construct
PaymentConfiguration::isAllowed
PaymentConfiguration::getAllowedToString
Khalyomede\Systempay\PaymentNotification::class
PaymentNotification::construct
PaymentNotification::setKey
PaymentNotification::setHashAlgorithm
- getHashAlgorithm
- getKey
- getPaymentResultData
- hasValidSignature
- getEventSource
- getContextMode
- getTransactionStatus
- getTransactionId
- getTransactionDate
- getPaymentConfiguration
- getNumberOfPaymentAttempt
- getNumberOfDaysBeforeBanqueDeposit
- getPaymentAmount
- getAuthorizationResult
Khalyomede\Systempay\AuthorizationResult::class
- __construct
- requiresToContactCardIssuer
- detectsSuccess
- detectsInvalidAcceptor
- detectsInvalidTransaction
- detectsInvalidAmount
- detectsInvalidCardHolderNumber
- detectsShopperCanceled
- detectsResponseError
- detectsExpiredCard
- detectsUnsufficientProvision
- detectsWrongPin
- detectsTransactionNotPermitted
- detectsPinAttemptsExceeded
- requiresToKeepTheCard
- requiresToNotHonor
- requiresToApproveAfterIdentification
- requiresToRepeatTransactionLater
- requiresToContactAcquirer
- isFraudulentResult
Payment::__construct
The constructor will automatically fill the following data:
- Currency to "EUR"
- Payment configuration to "SINGLE"
- The transaction date to now
- A random secure transaction id
- The context mode to "TEST"
Payment::getHashAlgorithm
Get the hash algorithm.
Payment::getTotalAmount
Get the total amount.
Payment::getFormTotalAmount
Get the total amount, formatted to fit Systempay requirements (e.g., no decimal separators). For example, if the amount is 199.99, the value returned by this method will be 19999.
Payment::getSiteId
Get the site id. Check the Systempay documentation to know where to find your site id.
Payment::getContextMode
Get the context mode.
Payment::getCurrencyNumericCode
Get the 3 digits numeric code of the currency.
Payment::getPaymentConfiguration
Get the payment configuration.
Payment::getTransactionDate
Get the transaction date.
Payment::getFormTransactionDate
Get the transaction date formatted for the form. It is formatted with the DateTime format "YmdHis" according to the Systempay transaction date format requirement.
Payment::getTransactionId
Get the transaction id.
Payment::getVersion
Get the payment protocol version.
Payment::getActionMode
Get the payment action mode.
Payment::getPageAction
Get the payment page paction.
Payment::getHtmlFormFields
Get the html form fields that corresponds to your payment. Each fields is an <input type="hidden" />
.
Payment::getKey
Get your site key. Check the Systempay documentation to know where to find your site key.
Payment::getFormUrl
Get the form URL.
Payment::setHashAlgorithm
Set the hash algorithm between sha1 and (hmac) sha256.
throws
InvalidArgumentException
: If the hash algorithm is not supported by the machine that runs the script.InvalidArgumentException
: If the hash algorithm is not one of "SHA1" or "SHA256".
Payment::setTotalAmount
Set the total amount of the payment.
Payment::setSiteId
Set the site id (check the Systempay documentation to know where to find your site id).
throws
InvalidArgumentException
: If the provided site id exceed 8 characters.InvalidArgumentException
: If the provided site id is not a valid UTF-8 string.
Payment::setContextMode
Set the context mode (either "TEST" or "PRODUCTION"). You can use the ContextMode
class constants to avoid hard writing the mode.
throws
InvalidArgumentException
: If the context mode is not one of "TEST" or "PRODUCTION".
Payment::setCurrency
Set the currency using the alpha-3 currency code (like "EUR"). You can use the Currency
class constants to avoid hard writing the currency.
throws
InvalidArgumentException
: If the currency is not a valid ISO4217 currency.
Payment::setPaymentConfiguration
Set the payment configuration (either "SINGLE" or "MULTI"). You can use the PaymentConfiguration
class constants to avoid hard writing the configuration.
throws
InvalidArgumentException
: If the payment configuration is not one of "SINGLE" or "MULTI".
Payment::setTransactionDate
Set the transaction date.
Payment::setTransactionId
Set the transaction id.
throws
InvalidArgumentException
: If the transaction id is not 6 characters long.InvalidArgumentException
: If the transaction id is not a valid UTF-8 string.
Payment::setKey
Set the key, that is used to generate the signature and validating the authenticity of the request.
ContextMode::__construct
Constructor the context mode with the given mode.
`ContextMode::isAllowed
Returns true if the context mode is allowed, else returns false.
`ContextMode::getAllowedToString
Get the allowed context mode in a string, separated by a coma.
HashAlgorithm::__construct
Construct with the given algorithm.
HashAlgorithm::isSupported
Return true if the algorithm is supported by the machine running the current script, else return false.
HashAlgorithm::isAllowed
Return true if the algorithm is either SHA1 or SHA256, else returns false.
HashAlgorithm::getAllowedToString
Get the allowed algorithm as a string separated by a coma.
PaymentConfiguration::__construct
Construct with the given payment configuration.
PaymentConfiguration::isAllowed
Returns true if the payment configuration is allowed, else return false.
PaymentConfiguration::getAllowedToString
Returns the allowed payment configuration as a string separated by a coma.
PaymentNotification::construct
Constructor that takes in general the raw $_POST
(or $request->all()
for the Laravel users).
PaymentNotification::setKey
Set the (private) key. You can find your key in your back office.
PaymentNotification::setHashAlgorithm
Set the hash algorithm. You can pass in the value using the HashAlgorithm
class if you do not want to use hard coded strings.
Run the tests
Execute this command in the root folder of this project:
Compatibility table
?: Untested
7.1 | 7.2 | 7.3 | 7.4 | 8.0 | |
---|---|---|---|---|---|
v0 | pass | pass | pass | pass | ? |
You can counter check these results by following this procedure:
- Checkout to the desired branch:
git checkout v1.2.3
- Start the Docker containers:
docker-compose up -d
- In the file
docker-compose.yml
, change the version of PHP in thebuild
key of thephp
service with the one that fits your need - Run the tests:
docker-compose exec php composer run test