Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Some improvments on skeleton #799

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/Payum/Skeleton/Action/NotifyAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,23 @@ public function execute($request)

$model = ArrayObject::ensureArrayObject($request->getModel());

// This action is called when calling: $gateway->execute(new Notify($token))
// See: https://github.com/Payum/Payum/blob/master/docs/examples/notify-script.md
//
// If you created a notification token and you sent the notification URL to the bank,
// the bank should call this URL at different steps of the payment (e.g.: when payment is successful).
//
// The simplest logic to implement here is to take GET or POST parameters and use them to replace your model:

/*
$this->gateway->execute($httpRequest = new GetHttpRequest());

$model->replace($httpRequest->request); // takes POST parameters
$model->replace($httpRequest->request); // or taks GET parameters
Comment on lines +36 to +37
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue here, it can't be request for both GET and POST parameters


throw new HttpResponse('OK', 200);
*/

throw new \LogicException('Not implemented');
}

Expand Down
32 changes: 32 additions & 0 deletions src/Payum/Skeleton/Action/StatusAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,38 @@ public function execute($request)

$model = ArrayObject::ensureArrayObject($request->getModel());

// This action is called when calling: $gateway->execute($status = new GetHumanStatus($model))
// See: https://github.com/Payum/Payum/blob/master/docs/get-it-started.md#donephp
//
// This is where you can mark the request status given your model data.

/*
// When a payment has been initiated, mark the request as new
if ($model['status'] === null) {
$request->markNew();

return;
}

// When the bank will send you back payment data (e.g.: after a successful or failed payment),
// then you will able to mark the request with different status.

if ($model['status'] === 'success') {
$request->markCaptured();

return;
}

if ($model['status'] === 'error') {
$request->markFailed();

return;
}

// If the payment's status is unknown, then mark the request as unknown:
$request->markUnknown();
*/

throw new \LogicException('Not implemented');
}

Expand Down
2 changes: 1 addition & 1 deletion src/Payum/Skeleton/composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "payum/skeleton",
"type": "project",
"description": "The Payum extension. Rapid extensino development",
"description": "The Payum extension. Rapid extension development",
"keywords": ["payment"],
"homepage": "https://payum.forma-pro.com",
"license": "MIT",
Expand Down