Skip to content

Commit

Permalink
update code style of examples directory according to CodeSniffer rules
Browse files Browse the repository at this point in the history
  • Loading branch information
nuryagdym committed May 17, 2021
1 parent 5b79fae commit 2128dec
Show file tree
Hide file tree
Showing 60 changed files with 2,400 additions and 2,234 deletions.
69 changes: 37 additions & 32 deletions examples/akbank/3d-pay/form.php
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'),
Expand All @@ -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';
93 changes: 47 additions & 46 deletions examples/akbank/3d-pay/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,55 @@

require '../../template/_header.php';

$url = $baseUrl . 'form.php';
$url = $baseUrl.'form.php';
?>

<form method="post" action="<?php echo $url; ?>" role="form">
<div class="row">
<div class="form-group col-sm-12">
<label for="name">Card holder name</label>
<input type="text" name="name" id="name" class="form-control input-lg" placeholder="Card holder name">
<form method="post" action="<?= $url; ?>" role="form">
<div class="row">
<div class="form-group col-sm-12">
<label for="name">Card holder name</label>
<input type="text" name="name" id="name" class="form-control input-lg" placeholder="Card holder name">
</div>
<div class="form-group col-sm-3">
<label for="type">Card Type</label>
<select name="type" id="type" class="form-control input-lg">
<option value="">Type</option>
<option value="visa">Visa</option>
<option value="master">MasterCard</option>
</select>
</div>
<div class="form-group col-sm-9">
<label for="number">Card Number</label>
<input type="text" name="number" id="number" class="form-control input-lg"
placeholder="Credit card number">
</div>
<div class="form-group col-sm-4">
<label for="month">Expire Month</label>
<select name="month" id="month" class="form-control input-lg">
<option value="">Month</option>
<?php for ($i = 1; $i <= 12; $i++) : ?>
<option value="<?= $i; ?>"><?= str_pad($i, 2, 0, STR_PAD_LEFT); ?></option>
<?php endfor; ?>
</select>
</div>
<div class="form-group col-sm-4">
<label for="year">Expire Year</label>
<select name="year" id="year" class="form-control input-lg">
<option value="">Year</option>
<?php for ($i = date('y'); $i <= date('y') + 20; $i++) : ?>
<option value="<?= $i; ?>"><?= 2000 + $i; ?></option>
<?php endfor; ?>
</select>
</div>
<div class="form-group col-sm-4">
<label for="cvv">Cvv</label>
<input type="text" name="cvv" id="cvv" class="form-control input-lg" placeholder="Cvv">
</div>
</div>
<div class="form-group col-sm-3">
<label for="type">Card Type</label>
<select name="type" id="type" class="form-control input-lg">
<option value="">Type</option>
<option value="visa">Visa</option>
<option value="master">MasterCard</option>
</select>
<hr>
<div class="form-group text-center">
<button type="submit" class="btn btn-lg btn-block btn-success">Payment</button>
</div>
<div class="form-group col-sm-9">
<label for="number">Card Number</label>
<input type="text" name="number" id="number" class="form-control input-lg" placeholder="Credit card number">
</div>
<div class="form-group col-sm-4">
<label for="month">Expire Month</label>
<select name="month" id="month" class="form-control input-lg">
<option value="">Month</option>
<?php for ($i = 1; $i <= 12; $i++): ?>
<option value="<?php echo $i; ?>"><?php echo str_pad($i, 2, 0, STR_PAD_LEFT); ?></option>
<?php endfor; ?>
</select>
</div>
<div class="form-group col-sm-4">
<label for="year">Expire Year</label>
<select name="year" id="year" class="form-control input-lg">
<option value="">Year</option>
<?php for ($i = date('y'); $i <= date('y') + 20; $i++): ?>
<option value="<?php echo $i; ?>"><?php echo 2000 + $i; ?></option>
<?php endfor; ?>
</select>
</div>
<div class="form-group col-sm-4">
<label for="cvv">Cvv</label>
<input type="text" name="cvv" id="cvv" class="form-control input-lg" placeholder="Cvv">
</div>
</div>
<hr>
<div class="form-group text-center">
<button type="submit" class="btn btn-lg btn-block btn-success">Payment</button>
</div>
</form>
</form>

<?php require '../../template/_footer.php'; ?>
<?php require '../../template/_footer.php';
179 changes: 91 additions & 88 deletions examples/akbank/3d-pay/response.php
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">&lt; 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">&lt; Click to payment form</a>
</div>
</div>
</div>

<?php require '../../template/_footer.php'; ?>
<?php require '../../template/_footer.php';
Loading

0 comments on commit 2128dec

Please sign in to comment.