forked from mewebstudio/pos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update code style of
examples
directory according to CodeSniffer rules
- Loading branch information
Showing
60 changed files
with
2,400 additions
and
2,234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,46 @@ | ||
<?php | ||
|
||
use Mews\Pos\Entity\Card\CreditCardEstPos; | ||
use Mews\Pos\Gateways\AbstractGateway; | ||
use Mews\Pos\Gateways\EstPos; | ||
use Symfony\Component\HttpFoundation\RedirectResponse; | ||
|
||
require '_config.php'; | ||
|
||
require '../../template/_header.php'; | ||
|
||
if ($request->getMethod() !== 'POST') { | ||
echo new \Symfony\Component\HttpFoundation\RedirectResponse($baseUrl); | ||
echo new RedirectResponse($baseUrl); | ||
exit(); | ||
} | ||
|
||
$orderId = date('Ymd') . strtoupper(substr(uniqid(sha1(time())),0,4)); | ||
$orderId = date('Ymd').strtoupper(substr(uniqid(sha1(time())), 0, 4)); | ||
|
||
$amount = (double) 32.0; | ||
$instalment = '0'; | ||
$amount = (float) 32.0; | ||
$installment = '0'; | ||
|
||
$success_url = $baseUrl . 'response.php'; | ||
$fail_url = $baseUrl . 'response.php'; | ||
$successUrl = $baseUrl.'response.php'; | ||
$failUrl = $baseUrl.'response.php'; | ||
|
||
$rand = microtime(); | ||
|
||
$order = [ | ||
'id' => $orderId, | ||
'email' => '[email protected]', // optional | ||
'name' => 'John Doe', // optional | ||
'amount' => $amount, | ||
'installment' => $instalment, | ||
'currency' => 'TRY', | ||
'ip' => $ip, | ||
'success_url' => $success_url, | ||
'fail_url' => $fail_url, | ||
'lang' => \Mews\Pos\Gateways\EstPos::LANG_TR, | ||
'rand' => $rand, | ||
'id' => $orderId, | ||
'email' => '[email protected]', // optional | ||
'name' => 'John Doe', // optional | ||
'amount' => $amount, | ||
'installment' => $installment, | ||
'currency' => 'TRY', | ||
'ip' => $ip, | ||
'success_url' => $successUrl, | ||
'fail_url' => $failUrl, | ||
'lang' => EstPos::LANG_TR, | ||
'rand' => $rand, | ||
]; | ||
|
||
$redis->lPush('order', json_encode($order)); | ||
|
||
$card = new \Mews\Pos\Entity\Card\CreditCardEstPos( | ||
$card = new CreditCardEstPos( | ||
$request->get('number'), | ||
$request->get('year'), | ||
$request->get('month'), | ||
|
@@ -44,20 +49,20 @@ | |
$request->get('type') | ||
); | ||
|
||
$pos->prepare($order, \Mews\Pos\Gateways\AbstractGateway::TX_PAY, $card); | ||
$pos->prepare($order, AbstractGateway::TX_PAY, $card); | ||
|
||
$form_data = $pos->get3DFormData(); | ||
$formData = $pos->get3DFormData(); | ||
?> | ||
|
||
<form method="post" action="<?php echo $form_data['gateway']; ?>" class="redirect-form" role="form"> | ||
<?php foreach ($form_data['inputs'] as $key => $value): ?> | ||
<input type="hidden" name="<?php echo $key; ?>" value="<?php echo $value; ?>"> | ||
<?php endforeach; ?> | ||
<div class="text-center">Redirecting...</div> | ||
<hr> | ||
<div class="form-group text-center"> | ||
<button type="submit" class="btn btn-lg btn-block btn-success">Submit</button> | ||
</div> | ||
</form> | ||
|
||
<?php require '../../template/_footer.php'; ?> | ||
<form method="post" action="<?= $formData['gateway']; ?>" class="redirect-form" role="form"> | ||
<?php foreach ($formData['inputs'] as $key => $value) : ?> | ||
<input type="hidden" name="<?= $key; ?>" value="<?= $value; ?>"> | ||
<?php endforeach; ?> | ||
<div class="text-center">Redirecting...</div> | ||
<hr> | ||
<div class="form-group text-center"> | ||
<button type="submit" class="btn btn-lg btn-block btn-success">Submit</button> | ||
</div> | ||
</form> | ||
|
||
<?php require '../../template/_footer.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,106 +1,109 @@ | ||
<?php | ||
|
||
use Mews\Pos\Gateways\AbstractGateway; | ||
use Symfony\Component\HttpFoundation\RedirectResponse; | ||
|
||
require '_config.php'; | ||
|
||
require '../../template/_header.php'; | ||
|
||
if ($request->getMethod() !== 'POST') { | ||
echo new \Symfony\Component\HttpFoundation\RedirectResponse($baseUrl); | ||
echo new RedirectResponse($baseUrl); | ||
exit(); | ||
} | ||
|
||
$order = (array) json_decode($redis->lPop('order')); | ||
|
||
$pos->prepare($order, \Mews\Pos\Gateways\AbstractGateway::TX_PAY); | ||
$pos->prepare($order, AbstractGateway::TX_PAY); | ||
$payment = $pos->payment(); | ||
$response = $payment->getResponse(); | ||
?> | ||
|
||
<div class="result"> | ||
<h3 class="text-center text-<?php echo $pos->isSuccess() ? 'success' : 'danger'; ?>"> | ||
<?php echo $pos->isSuccess() ? 'Payment is successful!' : 'Payment is not successful'; ?> | ||
</h3> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Response:</dt> | ||
<dd class="col-sm-9"><?php echo $response->response; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Status:</dt> | ||
<dd class="col-sm-9"><?php echo $response->status; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Transaction:</dt> | ||
<dd class="col-sm-9"><?php echo $response->transaction; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Transaction Type:</dt> | ||
<dd class="col-sm-9"><?php echo $response->transaction_type; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Transaction Security:</dt> | ||
<dd class="col-sm-9"><?php echo $response->transaction_security; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Hash:</dt> | ||
<dd class="col-sm-9"><?php echo $response->hash; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Order ID:</dt> | ||
<dd class="col-sm-9"><?php echo $response->order_id ? $response->order_id : '-'; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">AuthCode:</dt> | ||
<dd class="col-sm-9"><?php echo $response->auth_code ? $response->auth_code : '-'; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">HostRefNum:</dt> | ||
<dd class="col-sm-9"><?php echo $response->host_ref_num ? $response->host_ref_num : '-'; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">ProcReturnCode:</dt> | ||
<dd class="col-sm-9"><?php echo $response->code ? $response->code : '-'; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">mdStatus:</dt> | ||
<dd class="col-sm-9"><?php echo $response->md_status ? $response->md_status : '-'; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Error Code:</dt> | ||
<dd class="col-sm-9"><?php echo $response->error_code ? $response->error_code : '-'; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Error Message:</dt> | ||
<dd class="col-sm-9"><?php echo $response->error_message ? $response->error_message : '-'; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Md Error Message:</dt> | ||
<dd class="col-sm-9"><?php echo $response->md_error_message ? $response->md_error_message : '-'; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-12">All Data Dump:</dt> | ||
<dd class="col-sm-12"> | ||
<pre><?php dump($response); ?></pre> | ||
</dd> | ||
</dl> | ||
<hr> | ||
<div class="text-right"> | ||
<a href="index.php" class="btn btn-lg btn-info">< Click to payment form</a> | ||
<div class="result"> | ||
<h3 class="text-center text-<?= $pos->isSuccess() ? 'success' : 'danger'; ?>"> | ||
<?= $pos->isSuccess() ? 'Payment is successful!' : 'Payment is not successful'; ?> | ||
</h3> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Response:</dt> | ||
<dd class="col-sm-9"><?= $response->response; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Status:</dt> | ||
<dd class="col-sm-9"><?= $response->status; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Transaction:</dt> | ||
<dd class="col-sm-9"><?= $response->transaction; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Transaction Type:</dt> | ||
<dd class="col-sm-9"><?= $response->transaction_type; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Transaction Security:</dt> | ||
<dd class="col-sm-9"><?= $response->transaction_security; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Hash:</dt> | ||
<dd class="col-sm-9"><?= $response->hash; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Order ID:</dt> | ||
<dd class="col-sm-9"><?= $response->order_id ? $response->order_id : '-'; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">AuthCode:</dt> | ||
<dd class="col-sm-9"><?= $response->auth_code ? $response->auth_code : '-'; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">HostRefNum:</dt> | ||
<dd class="col-sm-9"><?= $response->host_ref_num ? $response->host_ref_num : '-'; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">ProcReturnCode:</dt> | ||
<dd class="col-sm-9"><?= $response->code ? $response->code : '-'; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">mdStatus:</dt> | ||
<dd class="col-sm-9"><?= $response->md_status ? $response->md_status : '-'; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Error Code:</dt> | ||
<dd class="col-sm-9"><?= $response->error_code ? $response->error_code : '-'; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Error Message:</dt> | ||
<dd class="col-sm-9"><?= $response->error_message ? $response->error_message : '-'; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Md Error Message:</dt> | ||
<dd class="col-sm-9"><?= $response->md_error_message ? $response->md_error_message : '-'; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-12">All Data Dump:</dt> | ||
<dd class="col-sm-12"> | ||
<pre><?php dump($response); ?></pre> | ||
</dd> | ||
</dl> | ||
<hr> | ||
<div class="text-right"> | ||
<a href="index.php" class="btn btn-lg btn-info">< Click to payment form</a> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<?php require '../../template/_footer.php'; ?> | ||
<?php require '../../template/_footer.php'; |
Oops, something went wrong.