Skip to content

Commit

Permalink
Merge pull request #571 from alma/chore/rename-variable
Browse files Browse the repository at this point in the history
chore(naming): rename function to be clearer
  • Loading branch information
Benjamin-Freoua-Alma authored Sep 30, 2024
2 parents 38454b8 + 831d45c commit e37cfd0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions alma/lib/Helpers/PaymentOptionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,15 @@ public function getEuCompliance($params)
/**
* @param int $installementCount
* @param int $duration
* @param bool $isPnxPlus4
* @param bool $isCredit
* @param bool $isDeferred
* @param bool $isPayNow
*
* @return array
*/
public function getTextsByTypes($installementCount, $duration, $isPnxPlus4, $isDeferred, $isPayNow)
public function getTextsByTypes($installementCount, $duration, $isCredit, $isDeferred, $isPayNow)
{
if ($isPnxPlus4) {
if ($isCredit) {
return $this->getTexts(
$installementCount,
PaymentButtonAdminFormBuilder::ALMA_PNX_AIR_BUTTON_TITLE,
Expand Down
2 changes: 1 addition & 1 deletion alma/lib/Helpers/PlanHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function __construct(
*
* @return bool
*/
public function isPnxPlus4($plan)
public function isCredit($plan)
{
return $plan->installmentsCount > 4;
}
Expand Down
6 changes: 3 additions & 3 deletions alma/lib/Services/PaymentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class PaymentService
/**
* @var bool
*/
protected $isPnxPlus4;
protected $isCredit;

/**
* @var MediaHelper
Expand Down Expand Up @@ -264,15 +264,15 @@ public function createPaymentOptions($params)

$this->isPayNow = $this->configurationHelper->isPayNow($key);
$this->isDeferred = $this->planHelper->isDeferred($plan);
$this->isPnxPlus4 = $this->planHelper->isPnxPlus4($plan);
$this->isCredit = $this->planHelper->isCredit($plan);

$plans = $this->planHelper->buildDates($plans, $locale, $feePlans, $key, $this->isPayNow);
$duration = $this->settingsHelper->getDuration($plan);

list($textPaymentButton, $descPaymentButton) = $this->paymentOptionHelper->getTextsByTypes(
$plan->installmentsCount,
$duration,
$this->isPnxPlus4,
$this->isCredit,
$this->isDeferred,
$this->isPayNow
);
Expand Down
8 changes: 4 additions & 4 deletions alma/tests/Unit/Helper/PlanHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,22 @@ protected function setUp()
}

/**
* @dataProvider provideIsPnxPlus4
* @dataProvider provideisCredit
*
* @return void
*/
public function testIsPnxPlus4($expected, $installmentsCount)
public function testisCredit($expected, $installmentsCount)
{
$plan = new FeePlan(
[
'installmentsCount' => $installmentsCount,
]
);

$this->assertEquals($expected, $this->planHelper->isPnxPlus4($plan));
$this->assertEquals($expected, $this->planHelper->isCredit($plan));
}

public function provideIsPnxPlus4()
public function provideisCredit()
{
return [
'test 4 installments' => [
Expand Down

0 comments on commit e37cfd0

Please sign in to comment.