Skip to content

Commit

Permalink
Merge pull request #42 from alma/feat/add-pay-now-payment-plan-behavior
Browse files Browse the repository at this point in the history
add pay now payment plan behavior
  • Loading branch information
Benjamin-Freoua-Alma authored Feb 22, 2023
2 parents ee82c92 + 44a50cb commit 8fe2f51
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
CHANGELOG
=========

v1.10.0
-------
* Added pay now payment plan behavior

v1.9.3
-------
* Added payment cancel endpoint
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "alma/alma-php-client",
"description": "PHP API client for the Alma payments API",
"version": "1.10.0",
"type": "library",
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

class Client implements LoggerAwareInterface
{
const VERSION = '1.9.3';
const VERSION = '1.10.0';

const LIVE_MODE = 'live';
const TEST_MODE = 'test';
Expand Down
7 changes: 7 additions & 0 deletions src/Entities/PaymentPlanInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,11 @@ public function isPnXOnly();
* @return bool
*/
public function isBothPnxAndPayLater();

/**
* Check if a payment plan is "Pay Now" compliant.
*
* @return bool
*/
public function isPayNow();
}
10 changes: 10 additions & 0 deletions src/Entities/PaymentPlanTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,14 @@ public function isBothPnxAndPayLater()
{
return $this->getInstallmentsCount() > 1 && ($this->getDeferredDays() || $this->getDeferredMonths());
}

/**
* Check if a payment plan is "Pay now" compliant
*
* @return bool
*/
public function isPayNow()
{
return $this->getInstallmentsCount() === 1 && (! $this->getDeferredDays() && ! $this->getDeferredMonths());
}
}

0 comments on commit 8fe2f51

Please sign in to comment.