Permalink
Browse files

initial setup

  • Loading branch information...
FabriZZio committed Jul 6, 2011
0 parents commit 160b657360544a8f046e38ddd5d92428059382b8
Showing with 15,222 additions and 0 deletions.
  1. +6 −0 .buildpath
  2. +22 −0 .project
  3. +5 −0 .settings/org.eclipse.php.core.prefs
  4. +9 −0 autoload.php
  5. +108 −0 lib/Ogone/OgoneConfirmationRequest.php
  6. +23 −0 lib/Ogone/ShaComposer/.svn/all-wcprops
  7. +130 −0 lib/Ogone/ShaComposer/.svn/entries
  8. +27 −0 lib/Ogone/ShaComposer/.svn/text-base/AbstractShaComposer.php.svn-base
  9. +28 −0 lib/Ogone/ShaComposer/.svn/text-base/AllParametersShaComposer.php.svn-base
  10. +28 −0 lib/Ogone/ShaComposer/.svn/text-base/MainParametersShaComposer.php.svn-base
  11. +27 −0 lib/Ogone/ShaComposer/AbstractShaComposer.php
  12. +28 −0 lib/Ogone/ShaComposer/AllParametersShaComposer.php
  13. +28 −0 lib/Ogone/ShaComposer/MainParametersShaComposer.php
  14. +38 −0 phpunit.xml.dist
  15. +27 −0 phpunit_.xml
  16. +82 −0 tests/Ogone/Tests/OgoneConfirmationRequestTest.php
  17. +17 −0 tests/Ogone/Tests/ShaComposer/.svn/all-wcprops
  18. +96 −0 tests/Ogone/Tests/ShaComposer/.svn/entries
  19. +37 −0 tests/Ogone/Tests/ShaComposer/.svn/text-base/AllParametersShaComposerTest.php.svn-base
  20. +41 −0 tests/Ogone/Tests/ShaComposer/.svn/text-base/MainParametersShaComposerTest.php.svn-base
  21. +37 −0 tests/Ogone/Tests/ShaComposer/AllParametersShaComposerTest.php
  22. +41 −0 tests/Ogone/Tests/ShaComposer/MainParametersShaComposerTest.php
  23. +7 −0 tests/TestCase.php
  24. +5 −0 tests/bootstrap.php
  25. +5 −0 vendors/Symfony/.svn/all-wcprops
  26. +31 −0 vendors/Symfony/.svn/entries
  27. +5 −0 vendors/Symfony/Component/.svn/all-wcprops
  28. +37 −0 vendors/Symfony/Component/.svn/entries
  29. +35 −0 vendors/Symfony/Component/ClassLoader/.svn/all-wcprops
  30. +198 −0 vendors/Symfony/Component/ClassLoader/.svn/entries
  31. +47 −0 vendors/Symfony/Component/ClassLoader/.svn/text-base/ApcUniversalClassLoader.php.svn-base
  32. +220 −0 vendors/Symfony/Component/ClassLoader/.svn/text-base/ClassCollectionLoader.php.svn-base
  33. +19 −0 vendors/Symfony/Component/ClassLoader/.svn/text-base/LICENSE.svn-base
  34. +82 −0 vendors/Symfony/Component/ClassLoader/.svn/text-base/MapFileClassLoader.php.svn-base
  35. +261 −0 vendors/Symfony/Component/ClassLoader/.svn/text-base/UniversalClassLoader.php.svn-base
  36. +47 −0 vendors/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php
  37. +220 −0 vendors/Symfony/Component/ClassLoader/ClassCollectionLoader.php
  38. +19 −0 vendors/Symfony/Component/ClassLoader/LICENSE
  39. +82 −0 vendors/Symfony/Component/ClassLoader/MapFileClassLoader.php
  40. +261 −0 vendors/Symfony/Component/ClassLoader/UniversalClassLoader.php
  41. +23 −0 vendors/Symfony/Component/Console/.svn/all-wcprops
  42. +148 −0 vendors/Symfony/Component/Console/.svn/entries
  43. +809 −0 vendors/Symfony/Component/Console/.svn/text-base/Application.php.svn-base
  44. +19 −0 vendors/Symfony/Component/Console/.svn/text-base/LICENSE.svn-base
  45. +136 −0 vendors/Symfony/Component/Console/.svn/text-base/Shell.php.svn-base
  46. +809 −0 vendors/Symfony/Component/Console/Application.php
  47. +23 −0 vendors/Symfony/Component/Console/Command/.svn/all-wcprops
  48. +130 −0 vendors/Symfony/Component/Console/Command/.svn/entries
  49. +576 −0 vendors/Symfony/Component/Console/Command/.svn/text-base/Command.php.svn-base
  50. +82 −0 vendors/Symfony/Component/Console/Command/.svn/text-base/HelpCommand.php.svn-base
  51. +67 −0 vendors/Symfony/Component/Console/Command/.svn/text-base/ListCommand.php.svn-base
  52. +576 −0 vendors/Symfony/Component/Console/Command/Command.php
  53. +82 −0 vendors/Symfony/Component/Console/Command/HelpCommand.php
  54. +67 −0 vendors/Symfony/Component/Console/Command/ListCommand.php
  55. +29 −0 vendors/Symfony/Component/Console/Formatter/.svn/all-wcprops
  56. +164 −0 vendors/Symfony/Component/Console/Formatter/.svn/entries
  57. +243 −0 vendors/Symfony/Component/Console/Formatter/.svn/text-base/OutputFormatter.php.svn-base
  58. +83 −0 vendors/Symfony/Component/Console/Formatter/.svn/text-base/OutputFormatterInterface.php.svn-base
  59. +217 −0 vendors/Symfony/Component/Console/Formatter/.svn/text-base/OutputFormatterStyle.php.svn-base
  60. +77 −0 ...ors/Symfony/Component/Console/Formatter/.svn/text-base/OutputFormatterStyleInterface.php.svn-base
  61. +243 −0 vendors/Symfony/Component/Console/Formatter/OutputFormatter.php
  62. +83 −0 vendors/Symfony/Component/Console/Formatter/OutputFormatterInterface.php
  63. +217 −0 vendors/Symfony/Component/Console/Formatter/OutputFormatterStyle.php
  64. +77 −0 vendors/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php
  65. +35 −0 vendors/Symfony/Component/Console/Helper/.svn/all-wcprops
  66. +198 −0 vendors/Symfony/Component/Console/Helper/.svn/entries
  67. +110 −0 vendors/Symfony/Component/Console/Helper/.svn/text-base/DialogHelper.php.svn-base
  68. +91 −0 vendors/Symfony/Component/Console/Helper/.svn/text-base/FormatterHelper.php.svn-base
  69. +42 −0 vendors/Symfony/Component/Console/Helper/.svn/text-base/Helper.php.svn-base
  70. +49 −0 vendors/Symfony/Component/Console/Helper/.svn/text-base/HelperInterface.php.svn-base
  71. +102 −0 vendors/Symfony/Component/Console/Helper/.svn/text-base/HelperSet.php.svn-base
  72. +110 −0 vendors/Symfony/Component/Console/Helper/DialogHelper.php
  73. +91 −0 vendors/Symfony/Component/Console/Helper/FormatterHelper.php
  74. +42 −0 vendors/Symfony/Component/Console/Helper/Helper.php
  75. +49 −0 vendors/Symfony/Component/Console/Helper/HelperInterface.php
  76. +102 −0 vendors/Symfony/Component/Console/Helper/HelperSet.php
  77. +53 −0 vendors/Symfony/Component/Console/Input/.svn/all-wcprops
  78. +300 −0 vendors/Symfony/Component/Console/Input/.svn/entries
  79. +307 −0 vendors/Symfony/Component/Console/Input/.svn/text-base/ArgvInput.php.svn-base
  80. +194 −0 vendors/Symfony/Component/Console/Input/.svn/text-base/ArrayInput.php.svn-base
  81. +211 −0 vendors/Symfony/Component/Console/Input/.svn/text-base/Input.php.svn-base
  82. +132 −0 vendors/Symfony/Component/Console/Input/.svn/text-base/InputArgument.php.svn-base
  83. +508 −0 vendors/Symfony/Component/Console/Input/.svn/text-base/InputDefinition.php.svn-base
  84. +103 −0 vendors/Symfony/Component/Console/Input/.svn/text-base/InputInterface.php.svn-base
  85. +182 −0 vendors/Symfony/Component/Console/Input/.svn/text-base/InputOption.php.svn-base
  86. +78 −0 vendors/Symfony/Component/Console/Input/.svn/text-base/StringInput.php.svn-base
  87. +307 −0 vendors/Symfony/Component/Console/Input/ArgvInput.php
  88. +194 −0 vendors/Symfony/Component/Console/Input/ArrayInput.php
  89. +211 −0 vendors/Symfony/Component/Console/Input/Input.php
  90. +132 −0 vendors/Symfony/Component/Console/Input/InputArgument.php
  91. +508 −0 vendors/Symfony/Component/Console/Input/InputDefinition.php
  92. +103 −0 vendors/Symfony/Component/Console/Input/InputInterface.php
  93. +182 −0 vendors/Symfony/Component/Console/Input/InputOption.php
  94. +78 −0 vendors/Symfony/Component/Console/Input/StringInput.php
  95. +19 −0 vendors/Symfony/Component/Console/LICENSE
  96. +35 −0 vendors/Symfony/Component/Console/Output/.svn/all-wcprops
  97. +198 −0 vendors/Symfony/Component/Console/Output/.svn/entries
  98. +46 −0 vendors/Symfony/Component/Console/Output/.svn/text-base/ConsoleOutput.php.svn-base
  99. +34 −0 vendors/Symfony/Component/Console/Output/.svn/text-base/NullOutput.php.svn-base
  100. +186 −0 vendors/Symfony/Component/Console/Output/.svn/text-base/Output.php.svn-base
  101. +107 −0 vendors/Symfony/Component/Console/Output/.svn/text-base/OutputInterface.php.svn-base
  102. +112 −0 vendors/Symfony/Component/Console/Output/.svn/text-base/StreamOutput.php.svn-base
  103. +46 −0 vendors/Symfony/Component/Console/Output/ConsoleOutput.php
  104. +34 −0 vendors/Symfony/Component/Console/Output/NullOutput.php
  105. +186 −0 vendors/Symfony/Component/Console/Output/Output.php
  106. +107 −0 vendors/Symfony/Component/Console/Output/OutputInterface.php
  107. +112 −0 vendors/Symfony/Component/Console/Output/StreamOutput.php
  108. +136 −0 vendors/Symfony/Component/Console/Shell.php
  109. +17 −0 vendors/Symfony/Component/Console/Tester/.svn/all-wcprops
  110. +96 −0 vendors/Symfony/Component/Console/Tester/.svn/entries
  111. +100 −0 vendors/Symfony/Component/Console/Tester/.svn/text-base/ApplicationTester.php.svn-base
  112. +100 −0 vendors/Symfony/Component/Console/Tester/.svn/text-base/CommandTester.php.svn-base
  113. +100 −0 vendors/Symfony/Component/Console/Tester/ApplicationTester.php
  114. +100 −0 vendors/Symfony/Component/Console/Tester/CommandTester.php
  115. +35 −0 vendors/Symfony/Component/EventDispatcher/.svn/all-wcprops
  116. +198 −0 vendors/Symfony/Component/EventDispatcher/.svn/entries
  117. +70 −0 vendors/Symfony/Component/EventDispatcher/.svn/text-base/Event.php.svn-base
  118. +200 −0 vendors/Symfony/Component/EventDispatcher/.svn/text-base/EventDispatcher.php.svn-base
  119. +100 −0 vendors/Symfony/Component/EventDispatcher/.svn/text-base/EventDispatcherInterface.php.svn-base
  120. +45 −0 vendors/Symfony/Component/EventDispatcher/.svn/text-base/EventSubscriberInterface.php.svn-base
  121. +19 −0 vendors/Symfony/Component/EventDispatcher/.svn/text-base/LICENSE.svn-base
  122. +70 −0 vendors/Symfony/Component/EventDispatcher/Event.php
  123. +200 −0 vendors/Symfony/Component/EventDispatcher/EventDispatcher.php
  124. +100 −0 vendors/Symfony/Component/EventDispatcher/EventDispatcherInterface.php
  125. +45 −0 vendors/Symfony/Component/EventDispatcher/EventSubscriberInterface.php
  126. +19 −0 vendors/Symfony/Component/EventDispatcher/LICENSE
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<buildpath>
+ <buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
+ <buildpathentry external="true" kind="lib" path="C:/php/apache/php-5.3.3-Win32-VC6-x86/PEAR"/>
+ <buildpathentry kind="src" path=""/>
+</buildpath>
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>marlon-ogone</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.dltk.core.scriptbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.php.core.PHPNature</nature>
+ </natures>
+</projectDescription>
@@ -0,0 +1,5 @@
+#Wed Jul 06 11:44:40 CEST 2011
+eclipse.preferences.version=1
+include_path=0;/marlon-ogone\u00051;C\:/php/apache/php-5.3.3-Win32-VC6-x86/PEAR
+phpVersion=php5.3
+use_asp_tags_as_php=false
@@ -0,0 +1,9 @@
+<?php
+use Symfony\Component\ClassLoader\UniversalClassLoader;
+require_once __DIR__ . '/vendors/Symfony/Component/ClassLoader/UniversalClassLoader.php';
+
+$loader = new UniversalClassLoader;
+$loader->registerNamespaces(array(
+ 'Ogone' => __DIR__ . '/lib/'
+));
+$loader->register();
@@ -0,0 +1,108 @@
+<?php
+namespace Ogone;
+
+use Ogone\ShaComposer\AbstractShaComposer;
+
+class OgoneConfirmationRequest
+{
+ /** @var string */
+ const SHASIGN_FIELD = 'shasign';
+
+ /**
+ * Available Ogone parameters
+ * @var array
+ */
+ private $ogoneParameters = array('aavaddress', 'aavcheck', 'aavzip', 'acceptance', 'alias', 'amount', 'bin', 'brand', 'cardno', 'cccty', 'cn',
+ 'complus', 'creation_status', 'currency', 'cvccheck', 'dcc_commpercentage', 'dcc_convamount', 'dcc_convccy', 'dcc_exchrate', 'dcc_exchratesource',
+ 'dcc_exchratets', 'dcc_indicator', 'dcc_marginpercentage', 'dcc_validhours', 'digestcardno', 'eci', 'ed', 'enccardno', 'ip', 'ipcty',
+ 'nbremailusage','nbripusage', 'nbripusage_alltx', 'nbrusage', 'ncerror', 'orderid', 'payid', 'pm', 'sco_category', 'scoring', 'status',
+ 'subscription_id', 'trxdate','vc');
+
+ /**
+ * @var array
+ */
+ private $requestParameters;
+
+ /**
+ * @var string
+ */
+ private $shaSign;
+
+ /**
+ * @var ShaComposer
+ */
+ private $shaComposer;
+
+ /**
+ * @param array $request Typically $_REQUEST
+ * @param AbstractShaComposer $shaComposer
+ * @throws \InvalidArgumentException
+ */
+ public function __construct($request, AbstractShaComposer $shaComposer)
+ {
+ if(!is_array($request)) {
+ throw new \InvalidArgumentException('Request parameter array expected.');
+ }
+
+ // set SHA composer
+ $this->shaComposer = $shaComposer;
+
+ // use lowercase internally
+ $request = array_change_key_case($request, CASE_LOWER);
+
+ // set sha sign
+ $this->shaSign = $this->setShaSign($request);
+
+ // filter request for Ogone parameters
+ $this->requestParameters = $this->filterRequestParameters($request);
+ }
+
+ /**
+ * Filter Ogone request parameters
+ * @param array $requestParameters
+ */
+ protected function filterRequestParameters($requestParameters)
+ {
+ // filter request for Ogone parameters
+ return array_intersect_key($requestParameters, array_flip($this->ogoneParameters));
+ }
+
+ /**
+ * Set Ogone SHA sign
+ * @param array $request
+ * @throws \InvalidArgumentException
+ */
+ protected function setShaSign($request)
+ {
+ if(!array_key_exists(self::SHASIGN_FIELD, $request) || $request[self::SHASIGN_FIELD] == '') {
+ throw new \InvalidArgumentException('SHASIGN parameter not present in request.');
+ }
+ return $request[self::SHASIGN_FIELD];
+ }
+
+ /**
+ * Checks if the request is valid
+ * @return bool
+ */
+ public function isValid()
+ {
+ return $this->shaComposer->compose($this->requestParameters) == $this->shaSign;
+ }
+
+ /**
+ * Retrieves a request parameter
+ * @param string $param
+ * @throws \InvalidArgumentException
+ */
+ public function getParam($param)
+ {
+ // always use lowercase internally
+ $param = strtolower($param);
+
+ if(!array_key_exists($param, $this->requestParameters)) {
+ throw new \InvalidArgumentException('Parameter ' . $param . ' does not exist.');
+ }
+
+ return $this->requestParameters[$param];
+ }
+}
@@ -0,0 +1,23 @@
+K 25
+svn:wc:ra_dav:version-url
+V 57
+/svn/m4domain/!svn/ver/292/trunk/lib/M4/Ogone/ShaComposer
+END
+MainParametersShaComposer.php
+K 25
+svn:wc:ra_dav:version-url
+V 87
+/svn/m4domain/!svn/ver/297/trunk/lib/M4/Ogone/ShaComposer/MainParametersShaComposer.php
+END
+AllParametersShaComposer.php
+K 25
+svn:wc:ra_dav:version-url
+V 86
+/svn/m4domain/!svn/ver/297/trunk/lib/M4/Ogone/ShaComposer/AllParametersShaComposer.php
+END
+AbstractShaComposer.php
+K 25
+svn:wc:ra_dav:version-url
+V 81
+/svn/m4domain/!svn/ver/296/trunk/lib/M4/Ogone/ShaComposer/AbstractShaComposer.php
+END
@@ -0,0 +1,130 @@
+10
+
+dir
+292
+http://svn.marlon.be:8080/svn/m4domain/trunk/lib/M4/Ogone/ShaComposer
+http://svn.marlon.be:8080/svn/m4domain
+
+
+
+2011-07-06T07:49:00.724750Z
+292
+dieter
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+c560fe6f-7ae4-fb44-9145-54ed49f5522c
+
+MainParametersShaComposer.php
+file
+297
+
+
+
+2011-07-06T09:33:56.083538Z
+1397bd275edec1899ba931266f91c4a4
+2011-07-06T09:32:37.521625Z
+297
+dieter
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+751
+
+AllParametersShaComposer.php
+file
+297
+
+
+
+2011-07-06T09:34:26.556880Z
+525dce08bc2b3adc77da9096cab3bee5
+2011-07-06T09:32:37.521625Z
+297
+dieter
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+649
+
+AbstractShaComposer.php
+file
+296
+
+
+
+2011-07-06T08:59:19.429290Z
+4f1ed0c9797095f948f4f5ff069da261
+2011-07-06T09:24:07.240375Z
+296
+dieter
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+460
+
@@ -0,0 +1,27 @@
+<?php
+namespace M4\Ogone\ShaComposer;
+
+/**
+ * Base class for SHA Composers
+ */
+abstract class AbstractShaComposer
+{
+ /**
+ * @var string
+ */
+ protected $passphrase;
+
+ /**
+ * @param string $passphrase
+ */
+ public function __construct($passphrase)
+ {
+ $this->passphrase = (string) $passphrase;
+ }
+
+ /**
+ * Compose SHA string based on Ogone request parameters
+ * @param array $requestParameters
+ */
+ public abstract function compose($requestParameters);
+}
@@ -0,0 +1,28 @@
+<?php
+namespace M4\Ogone\ShaComposer;
+
+/**
+ * SHA string composition the "new way", using all parameters in the request
+ */
+class AllParametersShaComposer extends AbstractShaComposer
+{
+ public function compose($requestParameters)
+ {
+ // use lowercase internally
+ $requestParameters = array_change_key_case($requestParameters, CASE_LOWER);
+
+ // sort parameters
+ ksort($requestParameters);
+
+ // compose SHA string
+ $shaString = '';
+ foreach($requestParameters as $key => $value)
+ {
+ if($value !== null) {
+ $shaString .= strtoupper($key) . '=' . trim($value) . $this->passphrase;
+ }
+ }
+
+ return strtoupper(sha1($shaString));
+ }
+}
Oops, something went wrong.

0 comments on commit 160b657

Please sign in to comment.