Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jleightonbrown committed Apr 7, 2017
1 parent ab4c764 commit b87b66f
Show file tree
Hide file tree
Showing 4,713 changed files with 1,057,206 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
40 changes: 40 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

# Created by .gitignore support plugin (hsz.mobi)
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm

## Directory-based project format
.idea/
/*.iml
# if you remove the above rule, at least ignore user-specific stuff:
# .idea/workspace.xml
# .idea/tasks.xml
# .idea/dictionaries
# and these sensitive or high-churn files:
# .idea/dataSources.ids
# .idea/dataSources.xml
# .idea/sqlDataSources.xml
# .idea/dynamic.xml
# and, if using gradle::
# .idea/gradle.xml
# .idea/libraries

## File-based project format
*.ipr
*.iws

## Additional for IntelliJ
out/

# generated by mpeltonen/sbt-idea plugin
.idea_modules/

# generated by JIRA plugin
atlassian-ide-plugin.xml

# generated by Crashlytics plugin (for Android Studio and Intellij)
com_crashlytics_export_strings.xml

.DS_Store
Thumbs.db
.DS_Store
30 changes: 30 additions & 0 deletions CODING_STANDARDS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Coding Standards
================


* Use git flow for branching.
* Never hardcode a hsotname. There are a couple things at your disposal:
* The WEBSITE_HOSTNAME symbolic constant.
* The jsite_url() function. This is in helpers/jonathan_helper.php. Use it instead of writing code like this:

<pre>
$new_assets_url = ( isset($_SERVER['HTTPS']) ) ? ("https://" . WEBSITE_HOSTNAME . "/qatesting/newassets/") : ("http://" . WEBSITE_HOSTNAME . "/qatesting/newassets/");
</pre>

Isn't this cleaner?
<pre>
$new_assets_url = jsite_url("/qatestings/newassets/");
</pre>

* Always provide a meaningful alternate tag for images. At worst, put in [Image]. Don't put your name or company name in there.
* Put composer requirements in core.
* If you keep doing something, put it in a helper. Don't copy and paste code. You can make functions in application/helper/jonathan_helper.php; you can also make your own function helper if you prefer. If you make your own, please use your name or something similar to prevent namespace collision. Make sure to add your helper to the application/config/autoload.php file to autoload so people can use your functions.
* Use 4 spaces instead of hard tabs.
* I'm going to use PHPStorm for all coding. Please use it or use similar settings. Don't just reformat a file and check it in with the change being to every line because you changed the tab stops.
* Make sure that words like this don't show up to customers: MotoMonster, motomonster.com, MM, Cloverfield Communications, Benzaitens, or any similar variation.
* Make sure you don't hardcode PST or Power Sport Technologist or PowerSport or any similar variation.
* Only write files in the customer web directory to html/media.
* Do not make inline styles. Use the style sheets. There is a new stylesheet, basebranding.css. Put stuff there for the default appearance.
* Do not change views just to change colors for a customer. Put in styles in custom.css.
* If you have custom JavaScript for a customer, you can include it in custom.js, but know that it loads last.

Empty file added CREATING_A_STORE.md
Empty file.
9 changes: 9 additions & 0 deletions Checkout/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The MIT License (MIT)

Copyright (c) 2015 PayPal

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 changes: 14 additions & 0 deletions Checkout/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
CHECKOUT WITH PAYPAL REST API DEMO

1) Download PHP server.
Use a server such as XAMPP (https://www.apachefriends.org/index.html) to be able to host the Demo code sample.

2) Browse to the htdocs directory of xampp. Unzip the downloaded demo code folder and place it in this htdocs directory.

3) Start the Apache server in XAMPP from the XAMPP control panel.

4) Open the website in the browser and access it as: http://my_domain/php_code_folder_name/index.php
Here, my_domain will be localhost if hosting on your own machine.
The php_code_folder_name is the name of the folder under which the downloaded code resides ('Checkout' folder in case you have not changed the default name).

5) Read further instructions on the above page you open.
102 changes: 102 additions & 0 deletions Checkout/apiCallsData.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?php

if (session_id() !== "") {
session_unset();
session_destroy();
}
session_start();
$_SESSION['csrf'] = bin2hex(openssl_random_pseudo_bytes(32));
/*
* Data for REST API calls.
* $_SESSION['expressCheckoutPaymentData'] is used in the Express Checkout flow
* $_SESSION['markFlowPaymentData'] is used for the Proceed to Checkout/Mark flow
*/
$hostName = $_SERVER['HTTP_HOST'];
$appName = explode("/", $_SERVER['REQUEST_URI'])[1];
$cancelUrl= "http://".$hostName."/".$appName."/cancel.php";
$payUrl = "http://".$hostName."/".$appName."/pay.php";
$placeOrderUrl = "http://".$hostName."/".$appName."/placeOrder.php";

$_SESSION['expressCheckoutPaymentData'] = '{
"transactions":[
{
"amount":{
"currency":"USD",
"total":"320",
"details":{
"shipping":"2",
"subtotal":"300",
"tax":"5",
"insurance":"10",
"handling_fee":"5",
"shipping_discount":"-2"
}
},
"description":"creating a payment",
"item_list":{
"items":[
{
"name":"Camera",
"quantity":"1",
"price":"300",
"sku":"1",
"currency":"USD"
}
]
}
}
],
"payer":{
"payment_method":"paypal"
},
"intent":"sale",
"redirect_urls":{
"cancel_url":"'.$cancelUrl.'",
"return_url":"'.$placeOrderUrl.'"
}
}';


$_SESSION['markFlowPaymentData'] = '{
"intent":"sale",
"payer":{
"payment_method":"paypal"
},
"transactions":[
{
"amount":{
"currency":"USD",
"total":"320",
"details":{
"shipping":"2",
"subtotal":"300",
"tax":"5",
"insurance":"10",
"handling_fee":"5",
"shipping_discount":"-2"
}
},
"description":"This is the payment transaction description ---->.",
"custom":"Nouphal Custom",
"item_list":{
"items":[
{
"name":"Camera",
"quantity":"1",
"price":"300",
"sku":"1",
"currency":"USD"
}
]
}
}
],
"redirect_urls":{
"return_url":"'.$payUrl.'",
"cancel_url":"'.$cancelUrl.'"
}
}';



?>
24 changes: 24 additions & 0 deletions Checkout/cancel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/*
* Cancel Order page
*/

if (session_id() == "")
session_start();

include('header.php');
?>
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<h4>
You cancelled the order.
</h4>
<br/>
Return to <a href="index.php">home page</a>.
</div>
<div class="col-md-4"></div>
</div>
<?php
include('footer.php');
?>
9 changes: 9 additions & 0 deletions Checkout/css/bootstrap-responsive.min.css

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions Checkout/css/bootstrap.min.css

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions Checkout/error.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/*
* Cancel Order page
*/

if (session_id() == "")
session_start();

include('header.php');

$arr = $_SESSION["error"];

?>
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<div class="alert alert-danger" role="alert">
<p class="text-center"><strong>The payment could not be completed.</strong></p>
</div>

<br />
<strong>Reason: </strong> <?php echo $arr["json"]["name"]; ?> <br />
<br />
<strong>Message: </strong> <?php echo $arr["json"]["message"]; ?> <br />

<br />
<br />

Return to <a href="index.php">home page</a>.
</div>
<div class="col-md-4"></div>
</div>
<?php
include('footer.php');
?>
7 changes: 7 additions & 0 deletions Checkout/footer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="js/jquery-1.11.3.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>
14 changes: 14 additions & 0 deletions Checkout/header.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Checkout with PayPal Demo</title>
<!--Including Bootstrap style files-->
<link href="css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container-fluid">
<div class="well">
<h2 class="text-center">PayPal Checkout REST API Demo</h2>
</div>
Binary file added Checkout/img/camera.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Checkout/img/logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit b87b66f

Please sign in to comment.