From 596d7a241b85c3cc8fc723457266d015e6587ed0 Mon Sep 17 00:00:00 2001 From: Hassaan Ali Date: Sat, 27 May 2023 11:54:49 +0500 Subject: [PATCH] Easypaisa Tests and Validation added Easypaisa Tests and Validation added --- src/Easypaisa.php | 4 ++-- tests/unit/EasypaisaDirectTest.php | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Easypaisa.php b/src/Easypaisa.php index 18c4f67..d379b8a 100644 --- a/src/Easypaisa.php +++ b/src/Easypaisa.php @@ -23,7 +23,7 @@ public function sendRequest($request) try{ $email = $request['emailAddress']; if (intval($request['transactionAmount']) < 0 || empty($request['orderId']) || empty($request['mobileAccountNo'])) { - return response()->json(['status' => false, 'message' => 'Invalid Arguments Passed'], Response::HTTP_CONFLICT); + return response()->json(['status' => false, 'message' => 'Missing Arguments.'], Response::HTTP_NOT_ACCEPTABLE); } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) { return response()->json(['status' => false, 'message' => 'Email format is incorrect'], Response::HTTP_CONFLICT); @@ -80,4 +80,4 @@ public function sendHostedRequest($request) } } -} +} \ No newline at end of file diff --git a/tests/unit/EasypaisaDirectTest.php b/tests/unit/EasypaisaDirectTest.php index 223c7c7..9b9bb0f 100644 --- a/tests/unit/EasypaisaDirectTest.php +++ b/tests/unit/EasypaisaDirectTest.php @@ -26,9 +26,7 @@ public function testSendDirectRequestWithValidData() $easypaisa = new Easypaisa(); // Action $result = $easypaisa->sendRequest($requestData); - $expectedUrl = 'https://easypaystg.easypaisa.com.pk'; - $this->assertTrue(Str::contains($result, $expectedUrl)); - } + $this->assertInstanceOf(JsonResponse::class, $result); } /** * Test Sending a Direct Request with missing orderId */