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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for v3 #1

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/phplint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Lint Code Base
uses: github/super-linter/slim@v4
env:
DEFAULT_BRANCH: master
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SSH_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
VALIDATE_PHP: true
Expand Down
31 changes: 25 additions & 6 deletions samples/Exchange.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
// phpcs:ignore Generic.Files.OneClassPerFile

# This is a minimal example on how to handle a Pay. exchange call and process an order
declare(strict_types=1);
Expand All @@ -11,20 +12,21 @@

$exchange = new Exchange();


try {
# Process the exchange request
$payOrder = $exchange->process();

switch ($payOrder->getStateId()) {
case PayStatus::PENDING :
case PayStatus::PENDING:
$responseResult = yourCodeToProcessPendingOrder($payOrder->getReference());
$responseMessage = 'Processed pending';
break;
case PayStatus::PAID :
case PayStatus::PAID:
$responseResult = yourCodeToProcessPaidOrder($payOrder->getReference());
$responseMessage = 'Processed paid. Order: ' . $payOrder->getReference();
break;
default :
default:
$responseResult = true;
$responseMessage = 'No action defined for payment state ' . $payOrder->getStateId();
}
Expand All @@ -33,7 +35,24 @@
$responseMessage = $exception->getMessage();
}

function yourCodeToProcessPendingOrder($orderId) { return true; }
function yourCodeToProcessPaidOrder($orderId) { return true; }
/**
* @phpcs:ignore
* @param string $orderId
* @return true
*/
function yourCodeToProcessPendingOrder($orderId)
{
return true;
}

/**
* @phpcs:ignore
* @param string $orderId
* @return true
*/
function yourCodeToProcessPaidOrder(string $orderId)
{
return true;
}

$exchange->setResponse($responseResult, $responseMessage);
$exchange->setResponse($responseResult, $responseMessage);
2 changes: 2 additions & 0 deletions src/Model/CheckoutOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ public function addCheckoutOption(CheckoutOption $checkoutoption): self
}

/**
* @phpcs:disable
* @inheritDoc
*/
public function getCollectionName(): string
{
return 'checkoutoptions';
}
/** @phpcs:enable */
}
Loading