Skip to content

Commit

Permalink
fix: change getIs by is
Browse files Browse the repository at this point in the history
  • Loading branch information
Francois-Gomis committed Jan 21, 2025
1 parent 8de3d9d commit 990eb0a
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 24 deletions.
6 changes: 3 additions & 3 deletions src/Endpoints/Merchants.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ public function sendOrderConfirmedBusinessEvent(OrderConfirmedBusinessEvent $ord
{
$cartEventDataPayload = [
'event_type' => $orderConfirmedBusinessEvent->getEventType(),
'is_alma_p1x' => $orderConfirmedBusinessEvent->getIsAlmaP1X(),
'is_alma_bnpl' => $orderConfirmedBusinessEvent->getIsAlmaBNPL(),
'was_bnpl_eligible' => $orderConfirmedBusinessEvent->getWasBNPLEligible(),
'is_alma_p1x' => $orderConfirmedBusinessEvent->isAlmaP1X(),
'is_alma_bnpl' => $orderConfirmedBusinessEvent->isAlmaBNPL(),
'was_bnpl_eligible' => $orderConfirmedBusinessEvent->wasBNPLEligible(),
'order_id' => $orderConfirmedBusinessEvent->getOrderId(),
'cart_id' => $orderConfirmedBusinessEvent->getCartId(),
'alma_payment_id' => $orderConfirmedBusinessEvent->getAlmaPaymentId()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ public function getEventType()
return $this->eventType;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ public function getCartId()
{
return $this->cartId;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ class OrderConfirmedBusinessEvent extends AbstractBusinessEvent
/**
* @var bool
*/
private $isAlmaP1X;
private $almaP1XStatus;
/**
* @var bool
*/
private $isAlmaBNPL;
private $almaBNPLStatus;
/**
* @var bool
*/
Expand Down Expand Up @@ -48,8 +48,8 @@ class OrderConfirmedBusinessEvent extends AbstractBusinessEvent
public function __construct($isAlmaP1X, $isAlmaBNPL, $wasBNPLEligible, $orderId, $cartId, $almaPaymentId = null)
{
$this->eventType = 'order_confirmed';
$this->isAlmaP1X = $isAlmaP1X;
$this->isAlmaBNPL = $isAlmaBNPL;
$this->almaP1XStatus = $isAlmaP1X;
$this->almaBNPLStatus = $isAlmaBNPL;
$this->wasBNPLEligible = $wasBNPLEligible;
$this->orderId = $orderId;
$this->cartId = $cartId;
Expand All @@ -60,23 +60,25 @@ public function __construct($isAlmaP1X, $isAlmaBNPL, $wasBNPLEligible, $orderId,
/**
* @return bool
*/
public function getIsAlmaP1X()
public function isAlmaP1X()
{
return $this->isAlmaP1X;
return $this->almaP1XStatus;
}

/**
* @return bool
*/
public function getIsAlmaBNPL()
public function isAlmaBNPL()
{
return $this->isAlmaBNPL;
return $this->almaBNPLStatus;
}

/**
* Was eligible at the time of payment
*
* @return bool
*/
public function getWasBNPLEligible()
public function wasBNPLEligible()
{
return $this->wasBNPLEligible;
}
Expand Down Expand Up @@ -112,7 +114,7 @@ public function getAlmaPaymentId()
*/
public function isAlmaPayment()
{
return $this->isAlmaP1X || $this->isAlmaBNPL;
return $this->almaP1XStatus || $this->almaBNPLStatus;
}

/**
Expand All @@ -122,8 +124,8 @@ public function isAlmaPayment()
protected function validateData()
{
if(
!is_bool($this->isAlmaP1X) ||
!is_bool($this->isAlmaBNPL) ||
!is_bool($this->almaP1XStatus) ||
!is_bool($this->almaBNPLStatus) ||
!is_bool($this->wasBNPLEligible) ||
!is_string($this->orderId) ||
!is_string($this->cartId) ||
Expand All @@ -136,7 +138,7 @@ protected function validateData()

//Alma payment id for Alma payment, Must be a string
if(
($this->isAlmaPayment()) &&
$this->isAlmaPayment() &&
!is_string($this->almaPaymentId)
)
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Endpoints/MerchantsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,4 @@ public function testSendOrderConfirmedBusinessEventForAlmaPayment()
$this->requestObject->shouldReceive('post')->once()->andReturn($this->responseMock);
$this->assertNull($this->merchantEndpoint->sendOrderConfirmedBusinessEvent($orderConfirmedBusinessEvent));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ public static function invalidDataForBusinessEventDataProvider()
];
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ public function testOrderConfirmedBusinessEventDataForNonAlmaPayment()
$cartId = "54";
$event = new OrderConfirmedBusinessEvent($isAlmaP1X, $isAlmaBNPL, $wasBNPLEligible, $orderId, $cartId);
$this->assertEquals('order_confirmed', $event->getEventType());
$this->assertEquals($isAlmaP1X, $event->getIsAlmaP1X());
$this->assertEquals($isAlmaBNPL, $event->getIsAlmaBNPL());
$this->assertEquals($wasBNPLEligible, $event->getWasBNPLEligible());
$this->assertEquals($isAlmaP1X, $event->isAlmaP1X());
$this->assertEquals($isAlmaBNPL, $event->isAlmaBNPL());
$this->assertEquals($wasBNPLEligible, $event->wasBNPLEligible());
$this->assertEquals($orderId, $event->getOrderId());
$this->assertEquals($cartId, $event->getCartId());
$this->assertNull($event->getAlmaPaymentId());
Expand Down Expand Up @@ -273,4 +273,4 @@ public static function invalidDataForBusinessEventDataProvider()
],
];
}
}
}

0 comments on commit 990eb0a

Please sign in to comment.