22
33namespace Codeboxr \Upay \Managers ;
44
5+ use Illuminate \Http \JsonResponse ;
6+ use Illuminate \Routing \Redirector ;
57use Illuminate \Support \Facades \Http ;
8+ use Illuminate \Http \RedirectResponse ;
69use Codeboxr \Upay \Exception \UpayException ;
10+ use Illuminate \Contracts \Foundation \Application ;
711
812class Payment extends BaseApi
913{
@@ -15,12 +19,12 @@ class Payment extends BaseApi
1519 * @param string $txnId
1620 * @param string $date
1721 *
18- * @return \Illuminate\Http\ JsonResponse
22+ * @return JsonResponse
1923 * @throws UpayException
2024 */
2125 public function createPayment ($ amount , $ invoiceId , $ txnId , $ date )
2226 {
23- $ upayResponse = Http:: withHeaders ( $ this ->headers () )
27+ $ upayResponse = $ this ->request ( )
2428 ->post ($ this ->baseUrl . "payment/merchant-payment-init/ " , [
2529 "date " => $ date ,
2630 "txn_id " => $ txnId ,
@@ -61,7 +65,7 @@ public function createPayment($amount, $invoiceId, $txnId, $date)
6165 * @param string $txnId
6266 * @param string $date
6367 *
64- * @return \Illuminate\Contracts\Foundation\ Application|\Illuminate\Http\ RedirectResponse|\Illuminate\Routing\ Redirector|void
68+ * @return Application|RedirectResponse|Redirector|void
6569 * @throws UpayException
6670 */
6771 public function executePayment ($ amount , $ invoiceId , $ txnId , $ date )
@@ -75,13 +79,12 @@ public function executePayment($amount, $invoiceId, $txnId, $date)
7579 *
7680 * @param string $txnId
7781 *
78- * @return \Illuminate\Http\ JsonResponse
82+ * @return JsonResponse
7983 * @throws UpayException
8084 */
8185 public function queryPayment (string $ txnId )
8286 {
83- $ upayResponse = Http::withHeaders ($ this ->headers ())
84- ->get ($ this ->baseUrl . "payment/single-payment-status/ {$ txnId }/ " );
87+ $ upayResponse = $ this ->request ()->get ($ this ->baseUrl . "payment/single-payment-status/ {$ txnId }/ " );
8588
8689 $ result = json_decode ($ upayResponse ->body ());
8790 if ($ upayResponse ->failed ()) {
@@ -106,12 +109,12 @@ public function queryPayment(string $txnId)
106109 *
107110 * @param array $txnIds
108111 *
109- * @return \Illuminate\Http\ JsonResponse
112+ * @return JsonResponse
110113 * @throws UpayException
111114 */
112115 public function getMultiStatus (array $ txnIds )
113116 {
114- $ upayResponse = Http:: withHeaders ( $ this ->headers () )
117+ $ upayResponse = $ this ->request ( )
115118 ->post ($ this ->baseUrl . "payment/bulk-payment-status/ " , [
116119 "txn_id_list " => $ txnIds
117120 ]);
0 commit comments