gopaycommunity / gopay-php-api Goto Github PK
View Code? Open in Web Editor NEWGoPay's PHP SDK for Payments REST API
License: MIT License
GoPay's PHP SDK for Payments REST API
License: MIT License
Hi
I have this error after Error after upgrading 1.7.0 to 1.7.3:
[2023-12-24 13-21-44] PHP Warning: Undefined array key "gatewayUrl" in endor/gopay/payments-sdk-php/src/GoPay.php:42 @ /order/status?id=117885
[2023-12-24 13-21-44] PHP Deprecated: rtrim(): Passing null to parameter #1 ($string) of type string is deprecated in endor/gopay/payments-sdk-php/src/GoPay.php:42 @ /order/status?id=117885
[2023-12-24 13-21-45] PHP Warning: Undefined array key "gatewayUrl" in endor/gopay/payments-sdk-php/src/GoPay.php:28 @ /order/status?id=117885
[2023-12-24 13-21-45] PHP Warning: Undefined array key "gatewayUrl" in endor/gopay/payments-sdk-php/src/GoPay.php:42 @ /order/status?id=117885
[2023-12-24 13-21-45] PHP Deprecated: rtrim(): Passing null to parameter #1 ($string) of type string is deprecated in endor/gopay/payments-sdk-php/src/GoPay.php:42 @ /order/status?id=117885
[2023-12-24 13-21-45] GoPay Response: @ /order/status?id=117885
[2023-12-24 13-21-45] GoPay\Http\Response #230 rawBody: 'cURL error 3: (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for /api/oauth2/token' statusCode: 500 json: array (0) @ /order/status?id=117885
How to fix it?
Dle dokumnetace https://doc.gopay.com/cs/ je testovaci bazova url adresa API: https://gw.sandbox.gopay.com/api
Ale kdyz jsem patral proc se mi stale ukazuje error pri zalozeni platby: Could not resolve host: gopay-gw [statusCode] => 500 tak jsem skoncil jsem zde:
ve vendor\gopay\payments-sdk-php\src\GoPay.php fce buildUrl() ktera tvori API call
adresu s 'http://gopay-gw:8180/gp/' kdyz jsem zamenil za https://gw.sandbox.gopay.com/api vse zaclo fungovat. Muzete poradit co delam spatne? diky.
I have this code:
$gopay = GoPay\payments(array(
'goid' => GOPAY_GOID,
'clientId' => GOPAY_CLIENT_ID,
'clientSecret' => GOPAY_CLIENT_SECRET,
'isProductionMode' => false,
'scope' => TokenScope::ALL,
'language' => Language::SLOVAK,
'timeout' => 30,
));
$response = $gopay->createPayment(array(
'payer' => array(
'default_payment_instrument' => PaymentInstrument::PAYMENT_CARD,
'allowed_payment_instruments' => array(PaymentInstrument::PAYMENT_CARD, PaymentInstrument::GOPAY),
'contact' => ...,
),
'amount' => $total,
'currency' => Currency::EUROS,
'order_number' => $orderId,
'order_description' => $orderName,
'items' => ...,
'lang' => 'sk',
'callback' => array(
'return_url' => CALLBACK_URL,
'notification_url' => CALLBACK_URL
)
));
This is what I get:
GoPay\Http\Response Object
(
[rawBody:GoPay\Http\Response:private] => Server error: `POST https://gw.sandbox.gopay.com/api/payments/payment` resulted in a `500 Internal Server Error` response:
{"date_issued":"2018-05-10T11:06:52.208+0200","errors":[{"scope":"G","error_code":500}]}
[statusCode] =>
[json] => Array
(
)
[status_code] => 500
)
What's wrong? There is nothing in the response telling me what I'm missing.
Hello,
GoPay\Payments doesn't include all available methods and GoPay\Payments::api is private. It would be nice, to have all available methods included here or at least make api method public, so you can call other methods easily.
When refunding payments in the test environment I sometimes get an error from $statusResult = $this->client->refundPayment($paymentId, round($entity->amount * 100));
-> (string)$statusResult
cURL error 28: Operation timed out after 30001 milliseconds with 0 out of -1 bytes received (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
Subsequent payment status check shows the payment as REFUNDED.
Other operations seem to work fine and the refund call does too sometimes, but not always.
The gateway does not load with the Slovenian localization.
Here instead of SI
should be SL
gopay-php-api/src/Definition/Language.php
Line 24 in 3daba4f
Hi,
I have an error possibly related to daylight savings time (CET):
[Sun Oct 30 02:52:08.380692 2022] [php:error] PHP Fatal error: Uncaught Exception: Failed to parse time string (now + -1799 seconds) at position 4 (+): Unexpected character in .../vendor/gopay/payments-sdk-php/src/OAuth2.php:31\nStack trace:\n#0 .../vendor/gopay/payments-sdk-php/src/OAuth2.php(31): DateTime->__construct()\n#1 /var/www/html/mclab/account/assets/vendor/gopay/payments-sdk-php/src/Token/CachedOAuth.php(24): GoPay\\OAuth2->authorize()\n#2 .../vendor/gopay/payments-sdk-php/src/Payments.php(116): GoPay\\Token\\CachedOAuth->authorize()\n#3 .../vendor/gopay/payments-sdk-php/src/Payments.php(27): GoPay\\Payments->post()\n#4 .../index.php(109): GoPay\\Payments->createPayment()\n#5 {main}\n thrown in /.../vendor/gopay/payments-sdk-php/src/OAuth2.php on line 31, referer: ---
Why is in Examples:
$gopay = GoPay\payments
and Basic usage Readme:
$gopay = GoPay\Api::payments
?
Aktuální verze vyžaduje Guzzle 5, který už je ale poměrně zastaralý. Pokud je cílem podporovat dávno mrtvé PHP 5.4, nebylo by lepší použít buď nějaký jiný balíček nebo udělat podporou obou verzí (tak to řeší například AWS SDK https://github.com/aws/aws-sdk-php/blob/master/composer.json)?
Aktuálně totiž GoPay sice v nové verzi podporuje historické aplikace na PHP 5.4 (zajímalo by mě, kolik jich reálně používá poslední verzi), ale my z tohoto století už neupdatujeme a musíme používat starou verzi kvůli konfliktu s aktuálním Guzzle 6
It's tough to understand what was done in what version and why. The releases page on Github is missing a large number of versions and changelog.md file was not updated for two years.
The last version breaks the application with the necessity of specifying the gateway URL, but it's nearly impossible to find this information somewhere.
Implementation of partial capture method
Installed latest plugin in shopware and entered our details. This is our log. What to do now? I've set mode to production. Do you need GoID or Cliend Id to investigate?
json_decode jednou vrací array a jindy object
Is this library compatible with announced GoPay transition to TLS 1.2?
https://help.gopay.com/cs/tema/bezpecnost/gopay-prechod-na-protokol-tls-1-2
Hi,
according to documentation there are more SWIFT/BIC codes supported by GoPay (AirBank, Moneta Money Bank etc.):
Is it possible to add them to BankSwiftCode.php ?
Thanks
Allow use of Guzzle 7 with this package, please.
After upgrading to 1.7.0 I get error Failed to parse time string (now + seconds) at position 4 (+): Unexpected character
at gopay/payments-sdk-php/src/OAuth2.php:31
Looks like the variable $response->json['expires_in']
is empty, should contain a number maybe?
Thank you
test2
Hi,
https://github.com/gopaycommunity/gopay-php-api/blob/v1.7.1/src/GoPay.php#L53 contains "!==" condition check but "===" is right.
there is a wrong call of the method - missing $this->strEndsWith
Line 70 in ddc20d7
When i install gopay-php-api wia composer:
composer require gopay/payments-sdk-php
And do simple scipt like:
<?php
require_once "vendor/autoload.php";
And run it i get this error:
Fatal error: Class 'PHPUnit_Framework_TestCase' not found in vendor/gopay/payments-sdk-php/tests/remote/GivenGoPay.php on line 9
This is because composer.json
loads tests/remote/GivenGoPay.php
for non-dev installation, but phpunit is installed only when dev is used.
tests/remote/GivenGoPay.php
should not be autoloaded at all it is test not something we need to run from our code
Hello,
got this warning:
Warning: curl_setopt_array(): CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set in /***/vendor/mashape/unirest-php/src/Unirest/Request.php on line 430
Open_basedir is pretty common on shared hosting. In fact this broke payment. Most ridiculous is that, it's look like we don't need this option set to TRUE, or not? What's optimal fix for this issue?
Krásná dokumentace i třída... velmi chválím!
Vše funguje jak má!
Toto opravdu není zvykem 👍 ❤
Version 1.2.0 is missing on packagist
Fatal error: Call to undefined function GuzzleHttp\Handler\curl_reset() in ...
More details:
https://stackoverflow.com/questions/25523004/fatal-error-curl-reset-undefined-why
Pls add actually Languagies to API
on PHP 8.1
PHP Deprecated: http_build_query(): Passing null to parameter #2 ($numeric_prefix) of type string is deprecated in /src/GoPay.php:75
gopay-php-api/src/Http/JsonBrowser.php
Line 42 in 8ce477a
The documentation promises that $response->json
is an associative array. But if the response is unsuccessful, $response->json
is an object (of stdClass
).
In the line above, json_decode()
is missing its second argument.
The potential bugfix breaks compatibility for all who process Gopay response errors.
Edit: Ahh, I see the same issue is mentioned in #21
I have guzzle 6.3.0
may be you must use double pipe in composer.json
- Installation request for gopay/payments-sdk-php ^1.3 -> satisfiable by gopay/payments-sdk-php[v1.3.0].
- gopay/payments-sdk-php v1.3.0 requires guzzlehttp/guzzle ~5.0 -> satisfiable by guzzlehttp/guzzle[5.0.0, 5.0.1, 5.0.2, 5.0.3, 5.1.0, 5.2.0, 5.3.0, 5.3.1, 5.3.x-dev] but these conflict with your requirements or minimum-stability.
Problém: Při nastavení isProductionMode
na false
se použije produkční prostředí v novém Symfony, které používá .env
na konfiguraci.
Proč: Ve třídě GoPay
v metodě buildUrl()
na řádku 49
se používá (bool)$this->getConfig('isProductionMode')
. To je v novém symfony problém, protože parametry z .env
souboru jsou by default přetypovány na string a (bool) 'false'
vrací true
. Samozřejmě programátor může pole přetypovat, ale není to moc typické a v Symfony dokumentaci je to docela utopené.
Řešení: Předělat funkci buildUrl
například takto. Pravděpodobně se najde i hezčí řešení.
public function buildUrl($urlPath)
{
$isProductionMode = $this->getConfig('isProductionMode');
if (!(bool) $isProductionMode || $isProductionMode === 'false') {
return 'https://gw.sandbox.gopay.com/';
}
return 'https://gate.gopay.cz/';
}
Dobrý den,
nevím kde jinde se zeptat, takže píšu sem.
Proč GoPay chce údaje o zákazníkovi při vytvoření platby(hlavně jméno, příjemní, adresa, telefon)?
Ptám se kvůli GDPR a popř. jak to řešit.
Díky
Line 52 in 75a7e44
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.