-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to 3DSv2 and implement recovery, cancel and refund (#13)
- Loading branch information
1 parent
1689a16
commit f265bd8
Showing
38 changed files
with
3,312 additions
and
338 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
service_name: travis-ci | ||
coverage_clover: build/clover.xml | ||
json_path: build/coveralls.json |
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 |
---|---|---|
|
@@ -7,4 +7,5 @@ composer.phar | |
# composer.lock | ||
tests/Credentials.php | ||
coverage | ||
build | ||
.php_cs.cache |
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,23 @@ | ||
filter: | ||
excluded_paths: [tests/*] | ||
|
||
checks: | ||
php: | ||
remove_extra_empty_lines: true | ||
remove_php_closing_tag: true | ||
remove_trailing_whitespace: true | ||
fix_use_statements: | ||
remove_unused: true | ||
preserve_multiple: false | ||
preserve_blanklines: true | ||
order_alphabetically: true | ||
fix_php_opening_tag: true | ||
fix_linefeed: true | ||
fix_line_ending: true | ||
fix_identation_4spaces: true | ||
fix_doc_comments: true | ||
|
||
tools: | ||
external_code_coverage: | ||
timeout: 600 | ||
runs: 4 |
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,17 @@ | ||
language: php | ||
|
||
php: | ||
- 7.2 | ||
|
||
before_script: | ||
- travis_retry composer self-update | ||
- travis_retry composer update --no-interaction --prefer-source | ||
- composer require --dev scrutinizer/ocular --no-interaction | ||
- composer require --dev php-coveralls/php-coveralls --no-interaction | ||
|
||
script: | ||
- vendor/bin/phpunit | ||
|
||
after_script: | ||
- php vendor/bin/ocular code-coverage:upload --format=php-clover build/clover.xml | ||
- php vendor/bin/php-coveralls |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,28 @@ | ||
<?php | ||
|
||
namespace DansMaCulotte\Monetico; | ||
|
||
trait BaseMethod | ||
{ | ||
public function generateSeal($securityKey, $fields) | ||
{ | ||
ksort($fields); | ||
|
||
$query = http_build_query($fields, null, '*'); | ||
$query = urldecode($query); | ||
|
||
return strtoupper(hash_hmac( | ||
'sha1', | ||
$query, | ||
$securityKey | ||
)); | ||
} | ||
|
||
public function generateFields($seal, $fields) | ||
{ | ||
return array_merge( | ||
$fields, | ||
['MAC' => $seal] | ||
); | ||
} | ||
} |
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,39 @@ | ||
<?php | ||
|
||
namespace DansMaCulotte\Monetico\Cancel; | ||
|
||
use DansMaCulotte\Monetico\Exceptions\Exception; | ||
use DansMaCulotte\Monetico\Recovery\Recovery; | ||
use DateTime; | ||
|
||
class Cancel extends Recovery | ||
{ | ||
public function __construct(array $data = []) | ||
{ | ||
$data['amountLeft'] = 0; | ||
$data['amountToRecover'] = 0; | ||
parent::__construct($data); | ||
} | ||
|
||
/** | ||
* @throws Exception | ||
*/ | ||
public function validate() | ||
{ | ||
if (!$this->dateTime instanceof DateTime) { | ||
throw Exception::invalidDatetime(); | ||
} | ||
|
||
if (!$this->orderDate instanceof DateTime) { | ||
throw Exception::invalidOrderDate(); | ||
} | ||
|
||
if (strlen($this->reference) > 12) { | ||
throw Exception::invalidReference($this->reference); | ||
} | ||
|
||
if (strlen($this->language) != 2) { | ||
throw Exception::invalidLanguage($this->language); | ||
} | ||
} | ||
} |
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,9 @@ | ||
<?php | ||
|
||
namespace DansMaCulotte\Monetico\Cancel; | ||
|
||
use DansMaCulotte\Monetico\Recovery\Response as RecoveryResponse; | ||
|
||
class Response extends RecoveryResponse | ||
{ | ||
} |
Oops, something went wrong.