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
<?xml version="1.0" encoding="UTF-8"?> | |
<customers> | |
<customer id="89fdd0e4-c775-11de-8728-40407c9117fd" code="test_customer"> | |
<firstName>Joe</firstName> | |
<lastName>Schmoe</lastName> | |
<company/> | |
<email>[email protected]</email> | |
<notes/> | |
<gatewayToken>SIMULATED</gatewayToken> | |
<isVatExempt>0</isVatExempt> |
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
<?php | |
class HookController extends Zend_Controller_Action { | |
public function preDispatch() { | |
$this->_helper->viewRenderer->setNoRender(true); | |
if (!$this->_request->isPost()) { | |
throw new Exception('POST required'); | |
} |
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
<?php | |
if (empty($_SERVER['HTTP_X_CG_SIGNATURE'])) { | |
//invalid | |
} | |
$rawBody = file_get_contents('php://input'); | |
$token = md5($rawBody); | |
// check signature |
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
require 'openssl' | |
require 'digest' | |
product_key = 'YOUR_PRODUCT_KEY' | |
if !defined?(request) || request.nil? || request.env.nil? # not rails | |
# signature = {value of X-CG-SIGNATURE here} | |
# request_body = {value of raw request body here} | |
else # assume it's a ROR ActionController::AbstractRequest object | |
signature = request.env['X-CG-SIGNATURE'] |
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
/// Grab The Authorization Header | |
var authorizationHeader = request.Headers["X-CG-SIGNATURE"]; | |
if (string.IsNullOrEmpty(authorizationHeader)) | |
{ | |
throw new Domain.Exceptions.Exception(); | |
} | |
request.InputStream.Seek(0, SeekOrigin.Begin); |
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
#!/usr/bin/env python | |
""" | |
Server Density Supervisord plugin. | |
Track the number of processes in each state. | |
For possible states see the docs at | |
http://supervisord.org/subprocess.html#process-states | |
""" |
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
#!/usr/bin/env python | |
""" | |
Server Density Supervisord plugin. | |
Track the number of processes in each state. | |
For possible states see the docs at | |
http://supervisord.org/subprocess.html#process-states | |
""" |
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
<?php | |
$client->newCustomer([ | |
'code' => 'TEST_CUSTOMER', | |
'firstName' => 'Example', | |
'lastName' => 'Customer', | |
'email' => '[email protected]', | |
'subscription' => [ | |
'planCode' => 'PLAN_CODE' | |
] | |
]); |
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
<?php | |
declare(strict_types=1); | |
namespace Api\Middleware; | |
use Psr\Http\Message\ResponseInterface; | |
use Psr\Http\Message\ServerRequestInterface; | |
use Psr\Http\Server\MiddlewareInterface; | |
use Psr\Http\Server\RequestHandlerInterface; |
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
<?php | |
declare(strict_types=1); | |
namespace ApiTest\InputFilter; | |
use PHPUnit\Framework\TestCase; | |
use Zend\InputFilter\InputFilter; |
OlderNewer