diff --git a/src/Endpoints/Merchants.php b/src/Endpoints/Merchants.php index 59c9aef..8ff4156 100644 --- a/src/Endpoints/Merchants.php +++ b/src/Endpoints/Merchants.php @@ -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() diff --git a/src/Entities/DTO/MerchantBusinessEvent/AbstractBusinessEvent.php b/src/Entities/DTO/MerchantBusinessEvent/AbstractBusinessEvent.php index 17a855b..3e561c5 100644 --- a/src/Entities/DTO/MerchantBusinessEvent/AbstractBusinessEvent.php +++ b/src/Entities/DTO/MerchantBusinessEvent/AbstractBusinessEvent.php @@ -19,4 +19,4 @@ public function getEventType() return $this->eventType; } -} \ No newline at end of file +} diff --git a/src/Entities/DTO/MerchantBusinessEvent/CartInitiatedBusinessEvent.php b/src/Entities/DTO/MerchantBusinessEvent/CartInitiatedBusinessEvent.php index 42e6c63..e485693 100644 --- a/src/Entities/DTO/MerchantBusinessEvent/CartInitiatedBusinessEvent.php +++ b/src/Entities/DTO/MerchantBusinessEvent/CartInitiatedBusinessEvent.php @@ -33,4 +33,4 @@ public function getCartId() { return $this->cartId; } -} \ No newline at end of file +} diff --git a/src/Entities/DTO/MerchantBusinessEvent/OrderConfirmedBusinessEvent.php b/src/Entities/DTO/MerchantBusinessEvent/OrderConfirmedBusinessEvent.php index a4a10b9..b2f05b1 100644 --- a/src/Entities/DTO/MerchantBusinessEvent/OrderConfirmedBusinessEvent.php +++ b/src/Entities/DTO/MerchantBusinessEvent/OrderConfirmedBusinessEvent.php @@ -11,11 +11,11 @@ class OrderConfirmedBusinessEvent extends AbstractBusinessEvent /** * @var bool */ - private $isAlmaP1X; + private $almaP1XStatus; /** * @var bool */ - private $isAlmaBNPL; + private $almaBNPLStatus; /** * @var bool */ @@ -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; @@ -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; } @@ -112,7 +114,7 @@ public function getAlmaPaymentId() */ public function isAlmaPayment() { - return $this->isAlmaP1X || $this->isAlmaBNPL; + return $this->almaP1XStatus || $this->almaBNPLStatus; } /** @@ -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) || @@ -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) ) { diff --git a/tests/Unit/Endpoints/MerchantsTest.php b/tests/Unit/Endpoints/MerchantsTest.php index d65ea68..99b87d1 100644 --- a/tests/Unit/Endpoints/MerchantsTest.php +++ b/tests/Unit/Endpoints/MerchantsTest.php @@ -170,4 +170,4 @@ public function testSendOrderConfirmedBusinessEventForAlmaPayment() $this->requestObject->shouldReceive('post')->once()->andReturn($this->responseMock); $this->assertNull($this->merchantEndpoint->sendOrderConfirmedBusinessEvent($orderConfirmedBusinessEvent)); } -} \ No newline at end of file +} diff --git a/tests/Unit/Entities/DTO/MerchantBusinessEvent/CartInitiatedBusinessEventTest.php b/tests/Unit/Entities/DTO/MerchantBusinessEvent/CartInitiatedBusinessEventTest.php index 2585751..bd20997 100644 --- a/tests/Unit/Entities/DTO/MerchantBusinessEvent/CartInitiatedBusinessEventTest.php +++ b/tests/Unit/Entities/DTO/MerchantBusinessEvent/CartInitiatedBusinessEventTest.php @@ -38,4 +38,4 @@ public static function invalidDataForBusinessEventDataProvider() ]; } -} \ No newline at end of file +} diff --git a/tests/Unit/Entities/DTO/MerchantBusinessEvent/OrderConfirmedBusinessEventTest.php b/tests/Unit/Entities/DTO/MerchantBusinessEvent/OrderConfirmedBusinessEventTest.php index 8c3d6ed..935b34d 100644 --- a/tests/Unit/Entities/DTO/MerchantBusinessEvent/OrderConfirmedBusinessEventTest.php +++ b/tests/Unit/Entities/DTO/MerchantBusinessEvent/OrderConfirmedBusinessEventTest.php @@ -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()); @@ -273,4 +273,4 @@ public static function invalidDataForBusinessEventDataProvider() ], ]; } -} \ No newline at end of file +}