Skip to content

Commit

Permalink
Make use of request attribute as an array
Browse files Browse the repository at this point in the history
  • Loading branch information
bryceandy committed Jun 18, 2020
1 parent 71a6462 commit b8ea2d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Http/Controllers/PaymentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function store(Request $request)

Payment::create($request->except(['type', '_token']));

$iframe_src = Pesapal::getIframeSource($request);
$iframe_src = Pesapal::getIframeSource($request->all());

return view ('laravel_pesapal::iframe', compact('iframe_src'));
}
Expand Down
4 changes: 3 additions & 1 deletion src/Pesapal.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Bryceandy\Laravel_Pesapal\OAuth\OAuthRequest;
use Bryceandy\Laravel_Pesapal\OAuth\OAuthSignatureMethod_HMAC_SHA1;
use Illuminate\Config\Repository;
use Illuminate\Support\Facades\Log;

class Pesapal
{
Expand Down Expand Up @@ -81,7 +82,8 @@ public function __construct(OAuthSignatureMethod_HMAC_SHA1 $signature)
public function getIframeSource($request)
{
// Pesapal params
$postXml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><PesapalDirectOrderInfo xmlns:xsi=\"http://www.w3.org/2001/XMLSchemainstance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" Currency=\"".$request->currency."\" Amount=\"".number_format($request->amount, 2)."\" Description=\"".$request->description."\" Type=\"".$request->type."\" Reference=\"".$request->reference."\" FirstName=\"".$request->first_name?:''."\" LastName=\"".$request->last_name?:''."\" Email=\"".$request->email?:''."\" PhoneNumber=\"".$request->phone_number?:''."\" xmlns=\"http://www.pesapal.com\" />";
$postXml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><PesapalDirectOrderInfo xmlns:xsi=\"http://www.w3.org/2001/XMLSchemainstance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" Currency=\"".$request['currency']."\" Amount=\"".number_format($request['amount'], 2)."\" Description=\"".$request['description']."\" Type=\"".$request['type']."\" Reference=\"".$request['reference']."\" FirstName=\"".$request['first_name']?:''."\" LastName=\"".$request['last_name']?:''."\" Email=\"".$request['email']?:''."\" PhoneNumber=\"".$request['phone_number']?:''."\" xmlns=\"http://www.pesapal.com\" />";
Log::info($postXml);
$postXml = htmlentities($postXml);

// Post transaction to PesaPal
Expand Down

0 comments on commit b8ea2d1

Please sign in to comment.