Skip to content

Commit

Permalink
add PayTabs
Browse files Browse the repository at this point in the history
  • Loading branch information
NafezlyDotCom committed Oct 2, 2022
1 parent 5704624 commit c04afdb
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Classes/FawryPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,14 @@ public function verify(Request $request)
if ($response->offsetGet('statusCode') == 200 && $response->offsetGet('paymentStatus') == "PAID") {
return [
'success' => true,
'payment_id'=>$reference_id,
'message' => __('messages.PAYMENT_DONE'),
'process_data' => $request->all()
];
} else if ($response->offsetGet('statusCode') != 200) {
return [
'success' => false,
'payment_id'=>$reference_id,
'message' => __('messages.PAYMENT_FAILED'),
'process_data' => $request->all()
];
Expand Down
2 changes: 2 additions & 0 deletions src/Classes/HyperPayPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,14 @@ public function verify(Request $request)
if (in_array($final_result["result"]["code"], ["000.000.000", "000.100.110", "000.100.111", "000.100.112"])) {
return [
'success' => true,
'payment_id'=>$request['id'],
'message' => __('messages.PAYMENT_DONE'),
'process_data' => $final_result
];
} else {
return [
'success' => false,
'payment_id'=>$request['id'],
'message' => __('messages.PAYMENT_FAILED_WITH_CODE', ['CODE' => $final_result["result"]["code"]]),
'process_data' => $final_result
];
Expand Down
3 changes: 3 additions & 0 deletions src/Classes/KashierPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,22 @@ public function verify(Request $request): array
if ($signature == $request["signature"]) {
return [
'success' => true,
'payment_id'=>$request['transactionId'],
'message' => __('messages.PAYMENT_DONE'),
'process_data' => $request->all()
];
} else {
return [
'success' => false,
'payment_id'=>$request['transactionId'],
'message' => __('messages.PAYMENT_FAILED'),
'process_data' => $request->all()
];
}
} else {
return [
'success' => false,
'payment_id'=>$request['transactionId'],
'message' => __('messages.PAYMENT_FAILED'),
'process_data' => $request->all()
];
Expand Down
2 changes: 2 additions & 0 deletions src/Classes/OpayPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,15 @@ public function verify(Request $request): array
if($response['code']=="00000" && isset($response['data']['status']) && $response['data']['status']){
return [
'success' => true,
'payment_id'=>$request->reference_id,
'message' => __('messages.PAYMENT_DONE'),
'process_data' => $response
];

}else{
return [
'success' => false,
'payment_id'=>$request->reference_id,
'message' => __('messages.PAYMENT_FAILED_WITH_CODE',['CODE'=>$response['message']]),
'process_data' => $response
];
Expand Down
3 changes: 3 additions & 0 deletions src/Classes/PayPalPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,20 +111,23 @@ public function verify(Request $request): array
if ($result['result']['intent'] == "CAPTURE" && $result['result']['status'] == "APPROVED") {
return [
'success' => true,
'payment_id'=>$request['token'],
'message' => __('messages.PAYMENT_DONE'),
'process_data' => $result
];

} else {
return [
'success' => false,
'payment_id'=>$request['token'],
'message' => __('messages.PAYMENT_FAILED'),
'process_data' => $result
];
}
} catch (Exception $e) {
return [
'success' => false,
'payment_id'=>$request['token'],
'message' => __('messages.PAYMENT_FAILED'),
'process_data' => $e
];
Expand Down
3 changes: 3 additions & 0 deletions src/Classes/PaymobPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,14 @@ public function verify(Request $request): array
if ($request['success'] == "true") {
return [
'success' => true,
'payment_id'=>$request['order'],
'message' => __('messages.PAYMENT_DONE'),
'process_data' => $request->all()
];
} else {
return [
'success' => false,
'payment_id'=>$request['order'],
'message' => __('messages.PAYMENT_FAILED'),
'process_data' => $request->all()
];
Expand All @@ -112,6 +114,7 @@ public function verify(Request $request): array
} else {
return [
'success' => false,
'payment_id'=>$request['order'],
'message' => __('messages.PAYMENT_FAILED'),
'process_data' => $request->all()
];
Expand Down
3 changes: 3 additions & 0 deletions src/Classes/PaymobWalletPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,14 @@ public function verify(Request $request): array
if ($request['success'] == "true") {
return [
'success' => true,
'payment_id'=>$request['order'],
'message' => __('messages.PAYMENT_DONE'),
'process_data' => $request->all()
];
} else {
return [
'success' => false,
'payment_id'=>$request['order'],
'message' => __('messages.PAYMENT_FAILED'),
'process_data' => $request->all()
];
Expand All @@ -125,6 +127,7 @@ public function verify(Request $request): array
} else {
return [
'success' => false,
'payment_id'=>$request['order'],
'message' => __('messages.PAYMENT_FAILED'),
'process_data' => $request->all()
];
Expand Down
2 changes: 2 additions & 0 deletions src/Classes/PaytabsPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,15 @@ public function verify(Request $request ) : array {
if(isset($response['payment_result']['response_status']) && $response['payment_result']['response_status']=="A"){
return [
'success' => true,
'payment_id'=>Cache::get('tran_ref'),
'message' => __('messages.PAYMENT_DONE'),
'process_data' => $response
];

}else{
return [
'success' => false,
'payment_id'=>Cache::get('tran_ref'),
'message' => __('messages.PAYMENT_FAILED'),
'process_data' => $response
];
Expand Down
2 changes: 2 additions & 0 deletions src/Classes/TapPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,14 @@ public function verify(Request $request): array
if(isset($response['status']) && $response['status']=="CAPTURED"){
return [
'success' => true,
'payment_id'=>$request->tap_id,
'message' => __('messages.PAYMENT_DONE'),
'process_data' => $response
];
}else{
return [
'success' => false,
'payment_id'=>$request->tap_id,
'message' => __('messages.PAYMENT_FAILED'),
'process_data' => $response
];
Expand Down
2 changes: 2 additions & 0 deletions src/Classes/ThawaniPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,14 @@ public function verify(Request $request): array
if ($response['data']['payment_status'] == "paid") {
return [
'success' => true,
'payment_id'=>$request['payment_id'],
'message' => __('messages.PAYMENT_DONE'),
'process_data' => $response
];
} else {
return [
'success' => false,
'payment_id'=>$request['payment_id'],
'message' => __('messages.PAYMENT_FAILED'),
'process_data' => $response
];
Expand Down

0 comments on commit c04afdb

Please sign in to comment.