public function testLessSimple() { $data = array("client_id" => "foo", "client_secret" => "bar", "authorize_endpoint" => "http://www.example.org/authorize", "token_endpoint" => "http://www.example.org/token", "redirect_uri" => "http://www.example.org/callback", "credentials_in_request_body" => true); $c = new ClientConfig($data); $this->assertEquals("foo", $c->getClientId()); $this->assertEquals("bar", $c->getClientSecret()); $this->assertEquals("http://www.example.org/authorize", $c->getAuthorizeEndpoint()); $this->assertEquals("http://www.example.org/token", $c->getTokenEndpoint()); $this->assertEquals("http://www.example.org/callback", $c->getRedirectUri()); $this->assertTrue($c->getCredentialsInRequestBody()); }
public function __construct(array $data) { // check if array is Google configuration object if (!isset($data['web'])) { throw new ClientConfigException("no configuration 'web' found, possibly wrong client type"); } foreach (array('client_id', 'client_secret', 'auth_uri', 'token_uri', 'redirect_uris') as $key) { if (!isset($data['web'][$key])) { throw new ClientConfigException(sprintf("missing field '%s'", $key)); } } // we map Google configuration to ClientConfig configuration $clientData = array("client_id" => $data['web']['client_id'], "client_secret" => $data['web']['client_secret'], "authorize_endpoint" => $data['web']['auth_uri'], "token_endpoint" => $data['web']['token_uri'], "redirect_uri" => $data['web']['redirect_uris'][0], "credentials_in_request_body" => true); parent::__construct($clientData); }
<?php include '../../au.com.gateway.client.enums/Version.php'; ?> <?php include '../../au.com.gateway.client.enums/Operation.php'; ?> <?php include '../../au.com.gateway.client.facade/Vault.php'; ?> <?php date_default_timezone_set('Asia/Colombo'); /* ------------------------------------------------------------------------------ STEP1: Build PaycorpClientConfig object ------------------------------------------------------------------------------ */ $clientConfig = new ClientConfig(); $clientConfig->setServiceEndpoint("https://test-combank.paycorp.com.au/rest/service/proxy/"); $clientConfig->setAuthToken("912345ec-d7b5-489o-8e27-0254lopodp4aaa"); $clientConfig->setHmacSecret("Test1234"); $clientConfig->setValidateOnly(FALSE); /* ------------------------------------------------------------------------------ STEP2: Build PaycorpClient object ------------------------------------------------------------------------------ */ $client = new GatewayClient($clientConfig); /* ------------------------------------------------------------------------------ STEP3: Build PaymentCompleteRequest object ------------------------------------------------------------------------------ */ $completeRequest = new PaymentCompleteRequest(); //$completeRequest->setClientId(123); $completeRequest->setReqid($_GET['reqid']); /* ------------------------------------------------------------------------------
$clientId = (int) $_POST['clientId']; $originalTxnReference = $_POST['originalTxnReference']; $transactionType = $_POST['transactionType']; $cardType = $_POST['cardType']; $cardNo = $_POST['cardNo']; $expiryDate = $_POST['expiryDate']; $secureId = $_POST['secureId']; $totalAmount = (double) $_POST['totalAmount']; $serviceFeeAmount = (double) $_POST['serviceFeeAmount']; $paymentAmount = (double) $_POST['paymentAmount']; $currency = $_POST['currency']; date_default_timezone_set('Asia/Colombo'); /* ------------------------------------------------------------------------------ STEP1: Build PaycorpClientConfig object ------------------------------------------------------------------------------ */ $clientConfig = new ClientConfig(); $clientConfig->setServiceEndpoint("https://test-combank.paycorp.com.au/rest/service/proxy/"); $clientConfig->setAuthToken($authToken); $clientConfig->setHmacSecret($hmac); /* ------------------------------------------------------------------------------ STEP2: Build PaycorpClient object ------------------------------------------------------------------------------ */ $client = new GatewayClient($clientConfig); /* ------------------------------------------------------------------------------ STEP3: Build PaymentRealTimeRequest object ------------------------------------------------------------------------------ */ $realTimeRequest = new PaymentRealTimeRequest(); $realTimeRequest->setClientId($clientId); $realTimeRequest->setTransactionType($transactionType); $realTimeRequest->setOriginalTxnReference($originalTxnReference); $realTimeRequest->setClientRef("cvdb-123");