-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from nuocgansoi/develop
v2: + multiple shop; + helper; + amount exchange config;
- Loading branch information
Showing
12 changed files
with
204 additions
and
43 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
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
/** | ||
* Created by IntelliJ IDEA. | ||
* User: nuocgansoi | ||
* Date: 10/31/2017 | ||
* Time: 2:06 PM | ||
*/ | ||
|
||
/** | ||
* @param $model | ||
* @return \Illuminate\Foundation\Application|mixed|null | ||
*/ | ||
function getShopInstance($model) | ||
{ | ||
$model = strtolower($model); | ||
$class = config("onepay.shop.{$model}.model"); | ||
|
||
return $class ? app($class) : null; | ||
} | ||
|
||
/** | ||
* @param $model | ||
* @return \Illuminate\Config\Repository|mixed | ||
*/ | ||
function getPriceAttribute($model) | ||
{ | ||
$model = strtolower($model); | ||
|
||
return config("onepay.shop.{$model}.price"); | ||
} | ||
|
||
/** | ||
* @param $stringHashData | ||
* @return string | ||
*/ | ||
function secureHashEncode($stringHashData) | ||
{ | ||
return strtoupper(hash_hmac('SHA256', $stringHashData, pack('H*', config('onepay.secure_secret')))); | ||
} | ||
|
||
/** | ||
* @param $item | ||
* @return null | ||
*/ | ||
function getPrice($item) | ||
{ | ||
$model = strtolower(class_basename($item)); | ||
$attr = getPriceAttribute($model); | ||
|
||
return $attr ? $item->{$attr} : null; | ||
} | ||
|
||
function price2Amount($price) | ||
{ | ||
return $price * config('onepay.amount_exchange'); | ||
} |
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
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
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@extends('onepay::result') | ||
|
||
@section('message') | ||
<div style="font-size: 40px; color: red;">{{ $message }}</div> | ||
@endsection |
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,5 +1,94 @@ | ||
@extends('onepay::shop') | ||
<!doctype html> | ||
<html lang="{{ app()->getLocale() }}"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
|
||
@section('message') | ||
<div style="font-size: 40px;">{{ $message }}</div> | ||
@endsection | ||
<title>{{ config('onepay.title') }}</title> | ||
|
||
<!-- Fonts --> | ||
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" | ||
type="text/css"> | ||
|
||
<!-- Styles --> | ||
<style> | ||
html, body { | ||
background-color: #fff; | ||
color: #636b6f; | ||
font-family: 'Raleway', sans-serif; | ||
font-weight: 100; | ||
height: 100vh; | ||
margin: 0; | ||
} | ||
.full-height { | ||
height: 100vh; | ||
} | ||
.flex-center { | ||
align-items: center; | ||
display: flex; | ||
justify-content: center; | ||
} | ||
.position-ref { | ||
position: relative; | ||
} | ||
.top-right { | ||
position: absolute; | ||
right: 10px; | ||
top: 18px; | ||
} | ||
.content { | ||
text-align: center; | ||
} | ||
.title { | ||
font-size: 84px; | ||
} | ||
.links > a { | ||
color: #636b6f; | ||
padding: 0 25px; | ||
font-size: 12px; | ||
font-weight: 600; | ||
letter-spacing: .1rem; | ||
text-decoration: none; | ||
text-transform: uppercase; | ||
} | ||
.m-b-md { | ||
margin-bottom: 30px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="flex-center position-ref full-height"> | ||
@if(Route::has('login')) | ||
<div class="top-right links"> | ||
@auth | ||
<a href="{{ url('/home') }}">Home</a> | ||
@else | ||
<a href="{{ route('login') }}">Login</a> | ||
<a href="{{ route('register') }}">Register</a> | ||
@endauth | ||
</div> | ||
@endif | ||
|
||
@auth | ||
<div class="content"> | ||
<div class="title m-b-md"> | ||
User id: {{ Auth::id() }} | ||
@yield('message') | ||
</div> | ||
</div> | ||
@else | ||
<div><a href="{{ route('login') }}">Login</a></div> | ||
<div><a href="{{ route('register') }}">Register</a></div> | ||
@endauth | ||
</div> | ||
</body> | ||
</html> |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@extends('onepay::result') | ||
|
||
@section('message') | ||
<div style="font-size: 40px; color: green;">{{ $message }}</div> | ||
@endsection |