Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from bitpay/master
Browse files Browse the repository at this point in the history
Sync with Bitpay
ionux committed Feb 20, 2015
2 parents 3e98f0b + 7e28307 commit 8914e74
Showing 19 changed files with 911 additions and 59 deletions.
31 changes: 31 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# The MIT License (MIT)
#
# Copyright (c) 2011-2014 BitPay
#
# 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.

# These files/directories are not included when making
# an archive of this repository.
/build export-ignore
/tests export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.travis.yml export-ignore
build.xml export-ignore
composer.json export-ignore
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# The MIT License (MIT)
#
# Copyright (c) 2011-2014 BitPay
#
# 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.
/bin/
/build/cache/
/build/docs/
/build/logs/
/vendor/
composer.lock
composer.phar
33 changes: 33 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# The MIT License (MIT)
#
# Copyright (c) 2011-2014 BitPay
#
# 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.
language: php
php:
- 5.5
- 5.4
- 5.3
install:
- composer install
script: ./bin/phing -propertyfile build/travis.properties build-travis
cache:
directories:
- build/cache/
- vendor/
11 changes: 11 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Version 4
* Fix to use server error handling

Version 3
* Added new HTTP header for version tracking

Version 2
* Updated to support API key instead of SSL files. Tested against Zen Cart 1.5.1.

Version 1
* Initial version, tested against Zen Cart 1.3.9h
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2011-2014 BitPay

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.
68 changes: 36 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
<strong>©2012,2013,2014 BITPAY, INC.</strong>
bitpay/zencart-plugin
=====================

Permission is hereby granted to any person obtaining a copy of this software
and associated documentation for use and/or modification in association with
the bitpay.com service.
# Installation

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.
Copy these files into the ZenCart directory on your webserver.

Bitcoin payment module for ZenCart using the bitpay.com service.
# Configuration

Installation
------------
Copy these files into your Zen Cart directory.

Configuration
-------------
1. Create an API key at bitpay.com under your My Account section.
2. In Admin panel under "Modules > Payment > Bitcoins" click Install.
3. Fill out all configuration information:<br />
@@ -30,24 +17,41 @@ d. Choose a status for unpaid and paid orders (or leave the default values as de
e. Verify that the currencies displayed correspond to what you want and to those accepted by bitpay.com (the defaults are what bitpay accepts as of this writing).<br />
f. Choose a sort order for displaying this payment option to visitors. Lowest is displayed first.<br />

Usage
-----
When a shopping chooses the Bitcoin payment method, they will be presented with an order summary as the next step (prices are shown in whatever currency they've selected for shopping). Upon receiving their order, the system takes the shopper to a bitpay.com invoice where the user is presented with bitcoin payment instructions. Once payment is received, a link is presented to the shopper that will take them back to your website.
# Usage

When a shopping chooses the Bitcoin payment method, they will be presented with an order summary as the next step (prices are shown in whatever currency they've selected for shopping). Upon receiving their order, the system takes the shopper to a bitpay.com invoice where the user is presented with bitcoin payment instructions. Once payment is received, a link is presented to the shopper that will take them back to your website.

In your Admin control panel, you can see the orders made with Bitcoins just as you would any other order. The status you selected in the configuration steps above will indicate whether the order has been paid for.

Note: This extension does not provide a means of automatically pulling a current BTC exchange rate for presenting BTC prices to shoppers.
**Note:** This extension does not provide a means of automatically pulling a current BTC exchange rate for presenting BTC prices to shoppers.

# Support

## BitPay Support

* [GitHub Issues](https://github.com/bitpay/zencart-plugin/issues)
* Open an issue if you are having issues with this plugin.
* [Support](https://support.bitpay.com)
* BitPay merchant support documentation

## ZenCart Support

* [Homepage](http://www.zen-cart.com)
* [Documentation](http://www.zen-cart.com/wiki/index.php/Developers_API)
* [Support Forums](http://www.zen-cart.com/forum.php)

# Contribute

To contribute to this project, please fork and submit a pull request.

# License

The MIT License (MIT)

Change Log
----------
Version 1
- Initial version, tested against Zen Cart 1.3.9h
Copyright (c) 2011-2015 BitPay

Version 2
- Updated to support API key instead of SSL files. Tested against Zen Cart 1.5.1.
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:

Version 3
- Added new HTTP header for version tracking
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

Version 4
- Fix to use server error handling
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.
22 changes: 21 additions & 1 deletion bitpay/.htaccess
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
# The MIT License (MIT)
#
# Copyright (c) 2011-2014 BitPay
#
# 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.
Order deny,allow
Deny from all

34 changes: 33 additions & 1 deletion bitpay/bp_lib.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
<?php
/**
* The MIT License (MIT)
*
* Copyright (c) 2011-2014 BitPay
*
* 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.
*/

require_once 'bp_options.php';

@@ -107,7 +130,12 @@ function bpVerifyNotification($apiKey = false) {
return 'authentication failed (bad hash)';
$json['posData'] = $posData['posData'];

return $json;
if (!array_key_exists('id', $json))
{
return 'Cannot find invoice ID';
}

return bpGetInvoice($json['id'], $apiKey);
}

// $options can include ('apiKey')
@@ -120,6 +148,10 @@ function bpGetInvoice($invoiceId, $apiKey=false) {
if (is_string($response))
return $response; // error
$response['posData'] = json_decode($response['posData'], true);
if($bpOptions['verifyPos'])
{
$response['posData'] = $response['posData']['posData'];
}
return $response;
}

25 changes: 24 additions & 1 deletion bitpay/bp_options.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
<?php
/**
* The MIT License (MIT)
*
* Copyright (c) 2011-2014 BitPay
*
* 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.
*/

global $bpOptions;

@@ -25,4 +48,4 @@

$bpOptions['transactionSpeed'] = 'low';

?>
?>
23 changes: 23 additions & 0 deletions bitpay/index.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
<?php
/**
* The MIT License (MIT)
*
* Copyright (c) 2011-2014 BitPay
*
* 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.
*/
ob_start();
header('Location: ' . $_SERVER['SERVER_NAME']);
21 changes: 13 additions & 8 deletions bitpay_callback.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
<?php

/**
* ©2011,2012,2013,2014 BITPAY, INC.
* The MIT License (MIT)
*
* Copyright (c) 2011-2014 BitPay
*
* 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.
*
* Permission is hereby granted to any person obtaining a copy of this software
* and associated documentation for use and/or modification in association with
* the bitpay.com service.
*
* 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.
*
* Bitcoin payment plugin using the bitpay.com service.
*
*/

require 'bitpay/bp_lib.php';
200 changes: 200 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* The MIT License (MIT)
*
* Copyright (c) 2011-2014 BitPay
*
* 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.
*/
-->
<project name="bitpay/build-script" default="build">
<!--
Default properties
-->
<property file="${project.basedir}/build/build.properties" />

<!--
Default build for running a build locally
-->
<target name="build" depends="prepare"
description="Runs a full build">
<phingcall target="lint" />
<phingcall target="phpunit" />
<parallel threadCount="5">
<phingcall target="phpcs" />
<phingcall target="phpmd" />
<phingcall target="phploc" />
<phingcall target="pdepend" />
<phingcall target="build-api-docs" />
</parallel>
</target>

<!--
Build API and other documentation
-->
<target name="build-api-docs" depends="prepare"
description="Generates API docs for the project">
<delete dir="${phpdoc.target}" verbose="true" />
<exec executable="${project.bindir}/phpdoc" passthru="true">
<arg value="--directory=${phpdoc.directory}" />
<arg value="--target=${phpdoc.target}" />
<arg line="--ignore=${phpdoc.ignore}" />
</exec>
</target>

<!--
Used to run a build on Travis CI
-->
<target name="build-travis" hidden="true"
description="Runs a build that is specific to the Travis CI environment">
<phingcall target="build" />
</target>

<!--
Generates documentation that can be uploaded to a web site and is meant
to be used elsewhere by the project.
-->
<target name="build-docs"
description="Generates documentation">
<fail message="Needs to be configured" />
</target>

<!--
Generates a distribution file that can then be used for uploading to
various plugin specific sites for users to download.
-->
<target name="build-dist"
description="Builds a distribution file">
<fail message="Needs to be configured" />
</target>

<!--
Cleans up and makes sure that the build is
clean
-->
<target name="clean" hidden="true">
<delete dir="build/docs" verbose="true" />
<delete dir="build/logs" verbose="true" />
</target>

<!--
Prepares the project for a build
-->
<target name="prepare" depends="clean" hidden="true">
<mkdir dir="build/cache" />
<mkdir dir="build/logs" />
</target>

<!--
Lint check all php files, this task should be updated for each
project so it only lint checks files specific for that project
-->
<target name="lint"
description="Check the syntax of PHP files">
<phplint cachefile="${project.basedir}/build/cache/phplint.cache">
<fileset dir="${project.basedir}/">
<include name="**/*.php"/>
<exclude name="**/build/**"/>
<exclude name="**/bin/**"/>
<exclude name="**/vendor/**"/>
</fileset>
</phplint>
</target>

<!--
phpunit - Runs phpunit with the phpunit.xml.dist file
http://phpunit.de/
-->
<target name="phpunit"
description="Runs unit tests">
<exec executable="${project.bindir}/phpunit" passthru="true">
<arg value="-c" />
<arg path="${phpunit.configuration}" />
</exec>
</target>

<!--
PHP Mess Detector
http://phpmd.org
-->
<target name="phpmd"
description="Runs PHP Mess Detector">
<delete file="${phpmd.report.file}" />
<exec executable="${project.bindir}/phpmd" passthru="true">
<arg path="${phpmd.source}" />
<arg value="${phpmd.report.format}" />
<arg value="${phpmd.ruleset}" />
<arg line="--reportfile ${phpmd.report.file}" />
<arg line="--exclude ${phpmd.exclude}" />
</exec>
</target>

<!--
PHP Lines of Code - Generates a CSV and XML log of how many lines
the project is.
https://github.com/sebastianbergmann/phploc
-->
<target name="phploc"
description="Calculates the size of the code base">
<delete file="${phploc.log.csv}" />
<delete file="${phploc.log.xml}" />
<exec executable="${project.basedir}/bin/phploc" passthru="true">
<arg line="--exclude=${phploc.exclude}" />
<arg value="--log-csv=${phploc.log.csv}" />
<arg value="--log-xml=${phploc.log.xml}" />
<arg path="${phploc.source}" />
</exec>
</target>

<!--
PHP Depend
http://pdepend.org/
-->
<target name="pdepend"
description="Generates some code metrics and pretty pictures">
<delete file="${pdepend.jdepend.xml}" />
<delete file="${pdepend.summary.xml}" />
<exec executable="${project.bindir}/pdepend" passthru="true">
<arg value="--jdepend-chart=${pdepend.jdepend.chart}" />
<arg value="--jdepend-xml=${pdepend.jdepend.xml}" />
<arg value="--overview-pyramid=${pdepend.overview.pyramid}" />
<arg value="--summary-xml=${pdepend.summary.xml}" />
<arg value="--ignore=${pdepend.ignore}" />
<arg path="${pdepend.source}" />
</exec>
</target>

<!--
PHP Code Sniffer - Makes sure the code meets standards, this
needs to be updated for each project
https://github.com/squizlabs/PHP_CodeSniffer
-->
<target name="phpcs"
description="Runs PHP Code Sniffer to make sure your code doesn't smell">
<delete file="${phpcs.report.xml}" />
<exec executable="${project.bindir}/phpcs" passthru="true">
<arg value="-p" /> <!-- Show progress of run -->
<arg value="--report-xml=${phpcs.report.xml}" />
<arg line="--standard=${phpcs.standard}" />
<arg line="--ignore=${phpcs.ignore}" />
<arg path="${phpcs.source}" />
</exec>
</target>
</project>
145 changes: 145 additions & 0 deletions build/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# The MIT License (MIT)
#
# Copyright (c) 2011-2014 BitPay
#
# 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.

####
#
# This properties file is used to configure the entire build. The purpose of
# this file is so that it is easy to drop it into a project and change a few
# of these settings and have a build run successfully.
#
# NOTE: You may still need to take a look at and edit `phpunit.xml.dist`.
#

####
#
# Directory Configuration
#

# The main location of all the projects source code, this should be the only
# property that you need to change. Code can live in the root directory or it
# can live inside of it's own directory.
project.source=${project.basedir}
#project.source=${project.basedir}/src

# --- You shouldn't need to edit any of the below value ---

# Location of all executables, this is the location on the `bin-dir` that you
# have configured in `composer.json`. If you have not configured this in
# 1composer.json` the default is to put it in the `vendor` directory.
project.bindir=${project.basedir}/bin
#project.bindir=${project.basedir}/vendor/bin

# Where to put the build artifacts, cache, logs, docs, etc.
project.builddir=${project.basedir}/build

# Location of vendor directory created by composer.
project.vendordir=${project.basedir}/vendor

# build artifacts for code analysis
project.logsdir=${project.builddir}/logs

# Build artifacts that can be reused or updated, they do not need to be deleted
# every build. These would include charts and images.
project.cachedir=${project.builddir}/cache

# Location of generated documentation such as API and code coverage
project.docsdir=${project.builddir}/docs
#### directory ####

####
#
# phpunit configuration
#

# Directory that contains phpunit.xml or the phpunit.xml file itself
phpunit.configuration=${project.builddir}/phpunit.xml.dist
#### phpunit ####

####
#
# phpmd configuration
#

# php source code filename or directory. Can be a comma-separated string
phpmd.source=${project.source}

# report format, text, xml, or html
phpmd.report.format=xml

# ruleset filename or a comma-separated string of rulesetfilenames
phpmd.ruleset=${project.builddir}/rulesets/phpmd.xml

# send report output to this file
phpmd.report.file=${project.logsdir}/phpmd.xml

# comma-separated string of patterns that are used to ignore directories
phpmd.exclude=${project.bindir},${project.builddir},${project.vendordir},${project.basedir}/tests
#### phpmd ####

####
#
# phploc Configuration
#

# Source directory of project
phploc.source=${project.source}/

# Where to put the csv log
phploc.log.csv=${project.logsdir}/phploc.csv

# Location of xml log
phploc.log.xml=${project.logsdir}/phploc.xml

# Small hack to exclude multiple directories
phploc.exclude=vendor --exclude=build --exclude=bin --exclude=tests
#### phploc ####

####
#
# pdepend configuration
#
pdepend.source=${project.source}
pdepend.jdepend.chart=${project.cachedir}/jdepend_chart.svg
pdepend.jdepend.xml=${project.logsdir}/jdepend.xml
pdepend.overview.pyramid=${project.cachedir}/pyramid.svg
pdepend.summary.xml=${project.logsdir}/jdepend_summary.xml
pdepend.ignore=bin,build,vendor,tests
#### pdepend ####

####
#
# phpcs configuration
#
phpcs.source=${project.source}
phpcs.report.xml=${project.logsdir}/phpcs.xml
phpcs.standard=PSR1 --standard=PSR2
phpcs.ignore=vendor --ignore=bin --ignore=build --ignore=tests
#### phpcs ####

####
#
# phpdoc configuration
#
phpdoc.directory=${project.source}/
phpdoc.target=${project.docsdir}/api
phpdoc.ignore=vendor/,bin/,tests/
#### phpdoc ####
50 changes: 50 additions & 0 deletions build/phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* The MIT License (MIT)
*
* Copyright (c) 2011-2014 BitPay
*
* 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.
*/
-->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
backupGlobals = "false"
colors = "true"
verbose = "true"
>

<testsuites>
<testsuite name="BitPay Project Test Suite">
<directory>../tests/*Test.php</directory>
</testsuite>
</testsuites>

<filter>
<blacklist>
<directory>../build</directory>
</blacklist>
</filter>

<logging>
<log type="coverage-html" target="../build/docs/code-coverage" />
<log type="coverage-clover" target="../build/logs/clover.xml" />
</logging>
</phpunit>
43 changes: 43 additions & 0 deletions build/rulesets/phpmd.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* The MIT License (MIT)
*
* Copyright (c) 2011-2014 BitPay
*
* 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.
*/
-->
<ruleset name="PHPMD Ruleset"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>
Custom phpmd ruleset to be used with BitPay projects.
</description>

<!-- Import -->
<!--<rule ref="rulesets/cleancode.xml" />-->
<rule ref="rulesets/codesize.xml" />
<!--<rule ref="rulesets/controversial.xml" />-->
<rule ref="rulesets/design.xml" />
<rule ref="rulesets/naming.xml" />
<rule ref="rulesets/unusedcode.xml" />
</ruleset>
145 changes: 145 additions & 0 deletions build/travis.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# The MIT License (MIT)
#
# Copyright (c) 2011-2014 BitPay
#
# 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.

####
#
# This properties file is used to configure the entire build. The purpose of
# this file is so that it is easy to drop it into a project and change a few
# of these settings and have a build run successfully.
#
# NOTE: You may still need to take a look at and edit `phpunit.xml.dist`.
#

####
#
# Directory Configuration
#

# The main location of all the projects source code, this should be the only
# property that you need to change. Code can live in the root directory or it
# can live inside of it's own directory.
project.source=${project.basedir}
#project.source=${project.basedir}/src

# --- You shouldn't need to edit any of the below value ---

# Location of all executables, this is the location on the `bin-dir` that you
# have configured in `composer.json`. If you have not configured this in
# 1composer.json` the default is to put it in the `vendor` directory.
project.bindir=${project.basedir}/bin
#project.bindir=${project.basedir}/vendor/bin

# Where to put the build artifacts, cache, logs, docs, etc.
project.builddir=${project.basedir}/build

# Location of vendor directory created by composer.
project.vendordir=${project.basedir}/vendor

# build artifacts for code analysis
project.logsdir=${project.builddir}/logs

# Build artifacts that can be reused or updated, they do not need to be deleted
# every build. These would include charts and images.
project.cachedir=${project.builddir}/cache

# Location of generated documentation such as API and code coverage
project.docsdir=${project.builddir}/docs
#### directory ####

####
#
# phpunit configuration
#

# Directory that contains phpunit.xml or the phpunit.xml file itself
phpunit.configuration=${project.builddir}/phpunit.xml.dist
#### phpunit ####

####
#
# phpmd configuration
#

# php source code filename or directory. Can be a comma-separated string
phpmd.source=${project.source}

# report format, text, xml, or html
phpmd.report.format=xml

# ruleset filename or a comma-separated string of rulesetfilenames
phpmd.ruleset=${project.builddir}/rulesets/phpmd.xml

# send report output to this file
phpmd.report.file=${project.logsdir}/phpmd.xml

# comma-separated string of patterns that are used to ignore directories
phpmd.exclude=${project.bindir},${project.builddir},${project.vendordir},${project.basedir}/tests
#### phpmd ####

####
#
# phploc Configuration
#

# Source directory of project
phploc.source=${project.source}/

# Where to put the csv log
phploc.log.csv=${project.logsdir}/phploc.csv

# Location of xml log
phploc.log.xml=${project.logsdir}/phploc.xml

# Small hack to exclude multiple directories
phploc.exclude=vendor --exclude=build --exclude=bin --exclude=tests
#### phploc ####

####
#
# pdepend configuration
#
pdepend.source=${project.source}
pdepend.jdepend.chart=${project.cachedir}/jdepend_chart.svg
pdepend.jdepend.xml=${project.logsdir}/jdepend.xml
pdepend.overview.pyramid=${project.cachedir}/pyramid.svg
pdepend.summary.xml=${project.logsdir}/jdepend_summary.xml
pdepend.ignore=bin,build,vendor,tests
#### pdepend ####

####
#
# phpcs configuration
#
phpcs.source=${project.source}
phpcs.report.xml=${project.logsdir}/phpcs.xml
phpcs.standard=PSR1 --standard=PSR2
phpcs.ignore=vendor --ignore=bin --ignore=build --ignore=tests
#### phpcs ####

####
#
# phpdoc configuration
#
phpdoc.directory=${project.source}/
phpdoc.target=${project.docsdir}/api
phpdoc.ignore=vendor/,bin/,tests/
#### phpdoc ####
28 changes: 28 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "bitpay/zencart-plugin",
"description": "",
"type": "zencart-plugin",
"keywords": [],
"homepage": "https://github.com/bitpay/zencart-plugin",
"license": "MIT",
"support": {
"email": "support@bitpay.com",
"issues": "https://github.com/bitpay/zencart-plugin/issues",
"source": "https://github.com/bitpay/zencart-plugin"
},
"minimum-stability": "stable",
"require": {},
"require-dev": {
"phpmd/phpmd": "*",
"phpdocumentor/phpdocumentor": "*",
"phing/phing": "*",
"pdepend/pdepend" : "1.1.0",
"squizlabs/php_codesniffer": "*",
"phpunit/phpunit": "*",
"phploc/phploc": "*",
"phpunit/phpunit-skeleton-generator": "*"
},
"config": {
"bin-dir": "bin"
}
}
21 changes: 13 additions & 8 deletions includes/languages/english/modules/payment/bitpay.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
<?php

/**
* ©2011,2012,2013,2014 BITPAY, INC.
* The MIT License (MIT)
*
* Copyright (c) 2011-2014 BitPay
*
* 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.
*
* Permission is hereby granted to any person obtaining a copy of this software
* and associated documentation for use and/or modification in association with
* the bitpay.com service.
*
* 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.
*
* Bitcoin payment plugin using the bitpay.com service.
*
*/


21 changes: 13 additions & 8 deletions includes/modules/payment/bitpay.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
<?php

/**
* ©2011,2012,2013,2014 BITPAY, INC.
* The MIT License (MIT)
*
* Copyright (c) 2011-2014 BitPay
*
* 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.
*
* Permission is hereby granted to any person obtaining a copy of this software
* and associated documentation for use and/or modification in association with
* the bitpay.com service.
*
* 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.
*
* Bitcoin payment plugin using the bitpay.com service.
*
*/


0 comments on commit 8914e74

Please sign in to comment.