Skip to content

Commit

Permalink
Easypaisa Tests and Validation added
Browse files Browse the repository at this point in the history
Easypaisa Tests and Validation added
  • Loading branch information
zfhassaan committed May 27, 2023
1 parent 00f973e commit 596d7a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Easypaisa.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -80,4 +80,4 @@ public function sendHostedRequest($request)
}

}
}
}
4 changes: 1 addition & 3 deletions tests/unit/EasypaisaDirectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit 596d7a2

Please sign in to comment.