mitchdav / st-george-ipg Goto Github PK
View Code? Open in Web Editor NEWA PHP client implementation of the St.George Internet Payment Gateway using the WebService or Webpay extension.
License: MIT License
A PHP client implementation of the St.George Internet Payment Gateway using the WebService or Webpay extension.
License: MIT License
Looking at your code in Client.php, if it does all 3 max tries it starts at 3 and counts its way down b4 giving up but the error reported after the 3rd try and max tries has been depleted to 0 is indicating it has made 0 tries rather than 3 ...
shouldnt it just be a matter of using a old enough os for your docker/ecs for it to work ? have you tried to see at what version it stops working ?
This is something that has been a big but deceptively simple problem for our project. We would get these "CUST CONTACT THEIR BANK" errors reported by customers at times and couldn't work out what it means, and all st george could tell us was that it was a problem at the customers bank and not their problem....
Well it turns out they just reused that error message and it actually gives little guide as to that it, in this case was just incorrect CVV security code errors !!! as you will get the same text message for code 1, 2 and 5. yet 5 really should have its own message....
api docs:
05
CUST CONTACT
THEIR BANK
Failed security check, eg. CVN (Card Verification Number) on
back of card was entered incorrectly. Refer the customer to
their bank.
so if you want to get out the error code number from this library, use:
$ex->getResponseCode()
So if i put in empty cvc '' or 1 or 0 or anything less than 100 or even a string, it still completes transaction, not sure if this is problem with webservice or this library but just wanted to bring it up.
To get around this just did test,
$cvc = (intval($cvc) > 99 ? intval($cvc) : 9999);//generate failure if invalid input
Not sure what is causing this but every few days we get customers that their card fails, and the error from bank is 'check number' they try several times with no luck, they ring us up and we can pt it through our desk moto no problems, also we've had error 'under minimum transaction limit' on an order over $200.... have you heard of st george payway ? we wonder if this is meant to be the successor to webpay ??
So some of the lib versions required by this package is not compatible with php 7 or 8
the current requirements are
"inacho/php-credit-card-validator": "^1.0",
"sabre/xml": "^1.5",
"guzzlehttp/guzzle": "^6.3"
sabre needs 3.0
guzzle im not sure, but my cms already had 7.4.5
inacho has not been updated so you have to manually edit the files, or try a fork
so:
composer require "guzzlehttp/guzzle:7.4.5 as 6.3"
composer require "sabre/xml:3.0 as 1.5"
composer require "mitchdav/st-george-ipg"
then i manually update inacho lib like so:
https://github.com/inacho/php-credit-card-validator/pull/28/files
Hi, I cant work out how or if there is a way to access the error code returned from stg via the exception,
eg, we de this to get the message: $error = $ex->getMessage();
but there appears no way to get the error code number, which is in some cases, more important.
??
Hi again, i just installed this and tried running with a test transaction but the error is not very clear what is going wrong:
Fatal error: Uncaught exception 'StGeorgeIPG\Exceptions\TransactionFailedException' with message 'Transaction failed after 0 tries.' in /home/user/public_html/_composer_libs/vendor/mitchdav/st-george-ipg/src/Client.php:314 Stack trace: #0 /home/user/public_html/_composer_libs/vendor/mitchdav/st-george-ipg/src/Client.php(312): StGeorgeIPG\Client->getResponse(Object(StGeorgeIPG\Request), 0) #1 /home/user/public_html/_composer_libs/vendor/mitchdav/st-george-ipg/src/Client.php(312): StGeorgeIPG\Client->getResponse(Object(StGeorgeIPG\Request), 1) #2 /home/user/public_html/_composer_libs/vendor/mitchdav/st-george-ipg/src/Client.php(312): StGeorgeIPG\Client->getResponse(Object(StGeorgeIPG\Request), 2) #3 /home/user/public_html/_composer_libs/vendor/mitchdav/st-george-ipg/src/Client.php(347): StGeorgeIPG\Client->getResponse(Object(StGeorgeIPG\Request), 3) #4 /home/user/public_html/_webpay/_new/test.php(32): StGeorgeIPG\Client->execute(Object(StGeorgeIPG\Request)) #5 {main} thrown in /home/user/public_html/_composer_libs/vendor/mitchdav/st-george-ipg/src/Client.php on line 314
this is my code:
<?php
require __DIR__ . '/../../_composer_libs/vendor/autoload.php';
use StGeorgeIPG\Client;
use StGeorgeIPG\Providers\WebService;
$clientId = getenv('ourclientnumber');
$authenticationToken = getenv('ourauthtoken');
$webService = new WebService();
$webService->setClientId($clientId)
->setAuthenticationToken($authenticationToken);
$client = new Client($webService);
use StGeorgeIPG\Exceptions\ResponseCodes\Exception;
$amount = 1.00; // In dollars
$cardNumber = 'myrealccnumber';
$month = 1;
$year = 2021;
$purchaseRequest = $client->purchase($amount, $cardNumber, $month, $year);
try {
$purchaseResponse = $client->execute($purchaseRequest);
echo 'The charge was successful.' . "\n";
} catch (Exception $ex) {
echo 'The charge was unsuccessful.' . "\n";
echo $ex->getMessage() . "\n";
var_dump($purchaseRequest);
var_dump($ex->getResponse());
}
?>
So following your example with code here #3 its never getting to the "} catch (Exception $ex) {" bit and reporting details on the transaction and error, im just getting a fatal exception in php eg,
Fatal error: Uncaught exception 'InvalidArgumentException' with message 'The card expiry date is invalid.' in /home/user/public_html/_composer_libs/vendor/mitchdav/st-george-ipg/src/Request.php:289 Stack trace: #0 /home/user/public_html/_composer_libs/vendor/mitchdav/st-george-ipg/src/Request.php(740): StGeorgeIPG\Request::validateInputIsCardExpiryDate(1, 2000) #1 /home/user/public_html/_composer_libs/vendor/mitchdav/st-george-ipg/src/Client.php(164): StGeorgeIPG\Request->setCardExpiryDate(1, 2000) #2 /home/user/public_html/_webpay/_new/test.php(26): StGeorgeIPG\Client->purchase(1, 'ccnumber...', 1, 2000) #3 {main} thrown in /home/user/public_html/_composer_libs/vendor/mitchdav/st-george-ipg/src/Request.php on line 289
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.