Skip to content

Commit

Permalink
update paytr
Browse files Browse the repository at this point in the history
  • Loading branch information
quocnguyen2001 committed Oct 17, 2024
1 parent 56375ae commit f9a3c77
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 33 deletions.
105 changes: 78 additions & 27 deletions resources/views/paytr.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,51 +6,102 @@
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>{{ __('PayTR') }}</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<style>
body{
padding: 0;
margin:0;
}
.header{
display: flex;
padding: 20px;
margin-bottom: -15px;
position: relative;
z-index: 99;
pointer-events: none;
}
.custom-bg-green {
background-color: #5db634;
}
.custom-text-white {
color: white;
}
.custom-padding {
padding: 0.5rem;
}
.custom-text-center {
text-align: center;
}
.custom-font-size-13 {
font-size: 13px;
font-family: Verdana, Geneva, Tahoma, sans-serif
}
.custom-flex {
display: flex;
align-items: center;
justify-content: center;
}
.custom-position-absolute {
position: absolute;
}
.custom-checkout-logo {
display: inline-block;
margin-left: auto;
margin-right: auto;
}
.custom-iframe {
width: 100%;
}
</style>

</head>
<body>
<div class="container" id="main-checkout-product-info">
<div class="row">
<div class="col-12 left" style="border-right: 0;padding-right:0;padding-bottom:0;padding-left:0;">
<div class="d-block" style="text-align: center;margin-bottom:-16px;">

<div class="custom-bg-green custom-text-white custom-padding custom-flex">
<p class="mb-0 custom-text-center custom-font-size-13">
{{ __('All purchases you make on this site are protected with 256 bit SSL..') }}
</p>
</div>
<div id="main-checkout-product-info">
<div>
<div class=" header">
@php
$logo = theme_option('logo_in_the_checkout_page') ?: theme_option('logo');
@endphp

@if ($logo)
<div class="checkout-logo">
<a
href="{{ BaseHelper::getHomepageUrl() }}"
title="{{ theme_option('site_title') }}"
>
<img
src="{{ RvMedia::getImageUrl($logo) }}"
alt="{{ theme_option('site_title') }}"
/>
</a>
</div>
<hr class="border-dark-subtle" />
<div class="custom-checkout-logo">
<img
src="{{ RvMedia::getImageUrl($logo) }}"
alt="{{ theme_option('site_title') }}"
/>
</div>
@endif

</div>
<div style="background:#5db634;margin-bottom:15px;" class="text-white ps-3 pe-3 pt-1 pb-1 d-flex align-items-center justify-content-center">
<p class="mb-0">
<i class="fas fa-lock mr-1"></i>&nbsp;Bu sitede yapacağınız tüm alışverişler 256 bit SSL ile korunmaktadır. <i class="fas fa-question-circle ml-1" data-toggle="tooltip" data-placement="top" title="Bilgileriniz orijinal haliyle değil SSL ile şifrelenerek güvenli bir şekilde gönderilir."></i>
</p>

</div>
<script>
$(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip();
});
</script>
<div class="col-12">
<div>
<script src="https://www.paytr.com/js/iframeResizer.min.js"></script>
<iframe src="https://www.paytr.com/odeme/guvenli/{{ $token }}" id="paytriframe" frameborder="0" scrolling="no" style="width: 100%;"></iframe>
<iframe src="https://www.paytr.com/odeme/guvenli/{{ $token }}" id="paytriframe" frameborder="0" scrolling="no" class="custom-iframe"></iframe>
<script>iFrameResize({},'#paytriframe');</script>
</div>
</div>
</div>
</div>




<script type="text/javascript" src="{{ asset('vendor/core/core/js-validation/js/js-validation.js') }}"></script>

Expand Down
4 changes: 3 additions & 1 deletion src/Http/Controllers/PayTrController.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ public function webhook(Request $request)
//# 3) 1. ADIM'da gönderilen payment_amount sipariş tutarı taksitli alışveriş yapılması durumunda
//# değişebilir. Güncel tutarı $post['total_amount'] değerinden alarak muhasebe işlemlerinizde kullanabilirsiniz.

$currency = $request['currency'] == 'TL' ? 'TRY' : $request['currency'];

do_action(PAYMENT_ACTION_PAYMENT_PROCESSED, [
'amount' => $request['total_amount'] / 100,
'currency' => $request['currency'],
'currency' => $currency,
'charge_id' => $chargeId = $request['merchant_oid'],
'payment_channel' => PAYTR_PAYMENT_METHOD_NAME,
'status' => PaymentStatusEnum::COMPLETED,
Expand Down
1 change: 1 addition & 0 deletions src/Models/Currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
class Currency
{
public const TL = 'TL';
public const TRY = 'TRY';
public const EUR = 'EUR';
public const USD = 'USD';
public const GBP = 'GBP';
Expand Down
10 changes: 5 additions & 5 deletions src/Providers/HookServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function boot(): void
$testMode = get_payment_setting('sandbox', PAYTR_PAYMENT_METHOD_NAME) ? 1 : 0;
$noInstallment = 0;
$maxInstallment = 0;
$currency = $paymentData['currency'];
$currency = ($paymentData['currency'] == 'TRY' ? 'TL' : $paymentData['currency']);

$hash = sprintf(
'%s%s%s%s%d%s%d%d%s%d',
Expand All @@ -137,7 +137,7 @@ public function boot(): void
'payment_amount' => $amount,
'paytr_token' => $token,
'user_basket' => $basket,
'debug_on' => 1,
'debug_on' => $testMode,
'no_installment' => $noInstallment,
'max_installment' => $maxInstallment,
'currency' => $currency,
Expand All @@ -157,9 +157,9 @@ public function boot(): void
$data['message'] = $response['reason'];

return $data;
}

echo view('plugins/paytr::paytr', [
}
echo view('plugins/paytr::paytr', [
'token' => $response['token'],
]);

Expand Down
1 change: 1 addition & 0 deletions src/Services/Gateways/PayTrPaymentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public function supportedCurrencyCodes(): array
{
return [
Currency::TL,
Currency::TRY,
Currency::EUR,
Currency::USD,
Currency::GBP,
Expand Down

0 comments on commit f9a3c77

Please sign in to comment.