From f6c441b381e08c34d3238b18539c0e0b94c7cf60 Mon Sep 17 00:00:00 2001 From: musikele Date: Thu, 2 Mar 2017 19:16:34 +0100 Subject: [PATCH] gestpay starter --- functions.php | 21 +++++++++ index.php | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++ phpinfo.php | 3 ++ response.php | 69 +++++++++++++++++++++++++++++ 4 files changed, 211 insertions(+) create mode 100644 functions.php create mode 100644 index.php create mode 100644 phpinfo.php create mode 100644 response.php diff --git a/functions.php b/functions.php new file mode 100644 index 0000000..79e2921 --- /dev/null +++ b/functions.php @@ -0,0 +1,21 @@ +IP for Gestpay configuration: $externalContent

"; + +} + +function displayErrors() +{ + ini_set('display_errors', 1); + ini_set('display_startup_errors', 1); + error_reporting(E_ALL); +} diff --git a/index.php b/index.php new file mode 100644 index 0000000..a634015 --- /dev/null +++ b/index.php @@ -0,0 +1,118 @@ + + + +

Test Payment

+ + $shopLogin +,'uicCode' => $currency +,'amount' => $amount +,'shopTransactionId' => $shopTransactionID +); + +//instantiate a SoapClient from Gestpay Wsdl +$client = new SoapClient($wsdl); +$objectResult = null; + +//do the call to Encrypt method +try { + $objectResult = $client->Encrypt($param); +} +//catch SOAP exceptions +catch (SoapFault $fault) { + trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR); +} + +//parse the XML result +$result = simplexml_load_string($objectResult->EncryptResult->any); + +// if there is an error trying to contact Gestpay Server +// (e.g. your IP address is not recognized, or the shopLogin is invalid) you'll see it here. + +$errCode= $result->ErrorCode; +$errDesc= $result->ErrorDescription; +if($errCode != 0){ + echo "

Error: $errCode - $errDesc

"; + echo '

check the error in the API

'; + die(); +} + + +//finally, we will define the variable $encString that will contain a string to pass to Gestpay upon payment. +//See the form below how it is used. +$encString= $result->CryptDecryptString; + +?> + +We will start a payment with this data:
+shopLogin:
+amount: € + +
+ + + +
+ + \ No newline at end of file diff --git a/phpinfo.php b/phpinfo.php new file mode 100644 index 0000000..968c8df --- /dev/null +++ b/phpinfo.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/response.php b/response.php new file mode 100644 index 0000000..68f4f1c --- /dev/null +++ b/response.php @@ -0,0 +1,69 @@ + + + +

Test Payment

+ +Objects sent by Gestpay via QueryParams:

'; + +echo '

Shop Login: '. $shopLogin . '

'; + +echo '

Crypted String: '. $CryptedString . '

'; + +$params = array('shopLogin' => $shopLogin, 'CryptedString' => $CryptedString); + + +$client = new SoapClient($wsdl); +$objectResult = null; +try { + $objectResult = $client->Decrypt($params); +} catch(SoapFault $fault) { + trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR); +} + +//parse the XML result +$result = simplexml_load_string($objectResult->DecryptResult->any); + +$err = (string) $result->ErrorCode; +$errorDescription = (string) $result->ErrorDescription; + +if ($err) { + + // Display the error + echo '

Error:

'; + echo '
' . $err . '
'; + echo '
' . $errorDescription . '
'; + +} +else { + + // Display the result + echo '

status of the transaction:

'; + echo '

Transaction correctly done!

'; + echo '

Down below you\'ll see the output of the \$result object.

'; + + echo '
';
+	print_r ($result);
+	echo '
'; + +} + + +?> \ No newline at end of file