1. Go to this page and download the library: Download krzysiekpiasecki/dotphpay library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
krzysiekpiasecki / dotphpay example snippets
composer
class BusinessPaymentHandler implements \Dotpay\Server\Handler\PaymentHandlerInterface
{
public function handle(Payment $payment)
{
// TODO: Implement handle() method.
}
}
$urlcMiddleware = new \Dotpay\Server\Payment();
$httpResponse = $urlcMiddleware->process(
$psrRequest,
new \Dotpay\Server\Handler\URLCHandler(
'Np3n4QmXxp6MOTrLCVs905fdrGf3QIGm',
new BusinessURLCHandler()
)
);
$emitter = new \Zend\Diactoros\Response\SapiEmitter();
$emitter->emit($httpResponse);
class BusinessErrorCodeHandler implements \Dotpay\Server\Handler\ErrorCodeHandlerInterface {
public function handle(string $errorCode)
{
// TODO: Implement handle() method with custom logic
}
}
$errorCodeMiddleware = new \Dotpay\Server\ErrorCode();
$httpResponse = $errorCodeMiddleware->process(
$psrRequest,
new \Dotpay\Server\Handler\ErrorCodeHandler(
new BusinessErrorCodeHandler()
)
);
use Symfony\Component\Validator\Validation;
$validator = Validation::createValidator();
$violations = $validator->validate('-1',
new \Dotpay\Request\Validator\Constraint\IdConstraint()
);
if (0 !== count($violations)) {
// there are errors, now you can show them
foreach ($violations as $violation) {
echo $violation->getMessage().'<br>';
// Output: The value "-1" is not a valid 'id' parameter
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.