Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue with not responding API #10

Open
wants to merge 56 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
4cb94d7
Magento 2 api v2 integration without webhooks
grumpy-dog Jan 10, 2020
53619ee
Deletion of redundant functionality, preparation for testing.
grumpy-dog Jan 15, 2020
9ae071f
Fix test data & api_host
grumpy-dog Jan 15, 2020
1c067f7
dev release
grumpy-dog Jan 15, 2020
3f23da5
fix api host
grumpy-dog Jan 15, 2020
0feb091
fix js
grumpy-dog Jan 16, 2020
4f8b269
Updated invoice binding to order
grumpy-dog Jan 31, 2020
4aedeec
Fix typo
grumpy-dog Feb 1, 2020
8f98049
Fix typo
grumpy-dog Feb 1, 2020
d91bc3b
Fix docs
grumpy-dog Feb 2, 2020
5a58626
Fix var names
grumpy-dog Feb 2, 2020
9e145c9
Fix API host
grumpy-dog Feb 2, 2020
c5a954a
Fix abstract access
grumpy-dog Feb 4, 2020
8e23f87
Fix webhook validation conditions
grumpy-dog Feb 4, 2020
4ea9b25
Update readme
grumpy-dog Feb 4, 2020
ec60076
Update transaction status
grumpy-dog Feb 11, 2020
097ad4a
Fix invoices statuses
grumpy-dog Feb 13, 2020
e7c06a1
Add invoice metadata
grumpy-dog Feb 13, 2020
e3516ba
Format module code
grumpy-dog Feb 13, 2020
eda2721
Update README.md
meyburgh Apr 24, 2020
6efd31a
Fix merchant invoice response
letscode-u Jul 14, 2020
2bc2b71
fix api host
letscode-u Aug 8, 2020
d9989ad
update api domain
letscode-u Sep 25, 2020
883e0a2
Unify the naming of configuration fields
letscode-u Sep 28, 2020
4a66116
Changing api-url on checkout - url
NastyaGos Oct 23, 2020
7ff3dde
Add hostname check to webhooks notifications
letscode-u Nov 9, 2020
ca6d621
Fix merchant invoice response
letscode-u Nov 9, 2020
9646b3f
Update redirect host
letscode-u Nov 9, 2020
0a3dd0c
Changing logo
NastyaGos Dec 8, 2020
d968f27
Merge remote-tracking branch 'alpha-prod/cps_api_v2' into cps_api_v2
letscode-u Dec 8, 2020
cf13153
Ignore .idea
letscode-u Dec 8, 2020
52df4c0
Merge remote-tracking branch 'alpha-prod/Gosudarskaya_alpha_coinpayme…
letscode-u Dec 8, 2020
ef60a52
webhook notification url unique for each user & event
letscode-u Jan 28, 2021
90d2ed5
Use order link as notesToRecipient
letscode-u Feb 10, 2021
534207e
add invoice info to order
letscode-u Feb 10, 2021
059bde0
Fix invoice buyer info
letscode-u Feb 16, 2021
18fd99f
Use Paid status to confirm payment
letscode-u Feb 16, 2021
fef67fe
Add SEO description
letscode-u Feb 16, 2021
30735c5
Fix php version compatibility
letscode-u Mar 22, 2021
e60fd09
Fix invoice buyer data
letscode-u Mar 22, 2021
76806cd
Revert "Fix php version compatibility"
letscode-u Mar 25, 2021
96e6205
Fix composer php requirements
letscode-u Mar 25, 2021
aa45472
Add notesToRecipient description
letscode-u Mar 25, 2021
e951273
Update webhook url formation
letscode-u Mar 25, 2021
12aaeed
Merge pull request #18 from CoinPaymentsNet/Alpha
letscode-u Apr 19, 2021
f197fe5
Revert "Alpha"
letscode-u Apr 19, 2021
96ffe54
Merge pull request #19 from CoinPaymentsNet/revert-18-Alpha
letscode-u Apr 19, 2021
2441d15
Fix invoice taxes & discount
letscode-u May 4, 2021
fdfa516
Merge branch 'master' of github.com-coinpayments:CoinPaymentsNet/coin…
letscode-u May 4, 2021
b07997e
allow php 8.1.11 to be used with composer
timzagelow Nov 30, 2022
fc4cde1
also allow 8.0 and 8.1, version bump
timzagelow Nov 30, 2022
01204f3
cleanup
timzagelow Nov 30, 2022
2cf7250
Merge pull request #21 from CoinPaymentsNet/add-php-8-to-composer
timzagelow Nov 30, 2022
b9cdec4
Trying to fix exception
smilesrg May 22, 2023
0a2e264
Merge pull request #22 from serhii-smirnov-cps/master
serhii-smirnov-cps May 30, 2023
1211afd
Fixed issue with not responding API
Mar 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Model/Api/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ public function sendRequest($data, $cmd, $headers = [], $method = 'post', $assoc
{
$paymentConf = $this->getPaymentConfig();
$baseConf = $this->getBaseConfig();

$paymentConf['public_key'] = isset($paymentConf['public_key']) ? $paymentConf['public_key'] : '';
$paymentConf['api_version'] = isset($paymentConf['api_version']) ? $paymentConf['api_version'] : '1';

$additionalData = [
'version' => $baseConf['api_version'],
'cmd' => $cmd,
Expand All @@ -112,7 +112,7 @@ public function sendRequest($data, $cmd, $headers = [], $method = 'post', $assoc
public function generateHmac($data, $secretKey = null)
{
if (!$secretKey) {
$secretKey = $this->getPaymentConfig('secret_key');
$secretKey = $this->getPaymentConfig('secret_key') ?: '';
}
return hash_hmac('sha512', http_build_query($data), $secretKey);
}
Expand Down
33 changes: 19 additions & 14 deletions Model/CoinPaymentsConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,27 @@ public function getConfig()
$this->_curl->post($coinpaymentsApi, $data);
$response = json_decode($this->_curl->getBody());

$currencies = ['error' => $response->error];
$acceptedCurrencies = ['error' => $response->error];
if ($response->error == 'ok') {
$currencies = [];
$acceptedCurrencies = [];
foreach ($response->result as $key => $item) {
$elm = [
'value' => $key,
'body' => $item,
'name' => $item->name
];
$currencies[] = $elm;
if (isset($item->accepted) && $item->accepted == '1') {
$acceptedCurrencies[] = $elm;
if (!is_null($response) && property_exists($response, 'error') && property_exists($response, 'result')) {
$currencies = ['error' => $response->error];
$acceptedCurrencies = ['error' => $response->error];
if ($response->error == 'ok') {
$currencies = [];
$acceptedCurrencies = [];
foreach ($response->result as $key => $item) {
$elm = [
'value' => $key,
'body' => $item,
'name' => $item->name
];
$currencies[] = $elm;
if (isset($item->accepted) && $item->accepted == '1') {
$acceptedCurrencies[] = $elm;
}
}
}
} else {
$currencies = ['error' => 'Could not load currencies list.'];
$acceptedCurrencies = ['error' => 'Could not load currencies list.'];
}

return [
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"name": "coinpaymentsnet/magento2",
"description": "Add new payment method for CoinPayments.net",
"require": {
"php": "~5.5.0|~5.6.0|~7.0.0|~7.1"
"php": "~5.5.0|~5.6.0|~7.0.0|~7.1|~8.0|~8.1"
},
"type": "magento2-module",
"version": "1.6.0",
"version": "1.6.2",
"license": [
"OSL-3.0"
],
Expand Down
6 changes: 3 additions & 3 deletions view/frontend/templates/coinpayments/iframe.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ $failUrl = $block->getFailUrl();
'utf-8'
); ?>">
<input type="hidden" name="shippingf" value="<?php echo $block->getShippingAmount(); ?>">
<input type="hidden" name="taxf" value="<?php $quoteData->getShippingAddress()->getTaxAmount(); ?>">
<input type="hidden" name="amountf" value="<?php echo $quoteData->getSubtotal(); ?>">
<input type="hidden" name="taxf" value="<?php echo $quoteData->getShippingAddress()->getTaxAmount(); ?>">
<input type="hidden" name="amountf" value="<?php echo $quoteData->getSubtotalWithDiscount(); ?>">
<input type="hidden" name="success_url" value="<?php echo $successUrl; ?>">
<input type="hidden" name="cancel_url" value="<?php echo $failUrl; ?>">
<input type="hidden" name="ipn_url" value="<?php echo htmlspecialchars($block->getIpnUrl(), ENT_QUOTES, 'utf-8'); ?>">
Expand All @@ -50,4 +50,4 @@ $failUrl = $block->getFailUrl();
</form>
<script type="text/javascript">
document.coinpaymentsform.submit();
</script>
</script>