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

cURL error 28: Operation timed out after 5001 milliseconds with 0 out of 0 bytes received #48

Closed
mrspect opened this issue Dec 1, 2020 · 1 comment

Comments

@mrspect
Copy link

mrspect commented Dec 1, 2020

The payment can't be started on the page since 2020.11.27.
(iskolaevkonyv.hu)

I've stopped all of the plugins except the woocommerce and the simple gateway.
I still getting this error code.
Simple pay page doesn't open.

woocommerce version: 4.7.1
Gateway version: 2.4.6
wordpress version: 5.5.3

I've already checked, the wordpress healt, is OK
DNS is working, firewall in on, but when it's off the problem is still exists.

Simple Pay IT support replied that the call for the transaction page is not started when this issue occures.

Please help me to resolve this issue!

@szepeviktor
Copy link
Contributor

szepeviktor commented Dec 1, 2020

Hello @mrspect! Please consider running this shell script every 10 minutes to get a picture on how Simplepay operates.
simplepay-ping.sh

#!/bin/bash
#
# Ping SimplePay API.
#
# DOCS          :http://simplepartner.hu/download.php?target=dochu
# DEPENDS       :apt-get install wget apg openssl

# SIMPLEPAY_* variables come from here
source <(grep -F 'SIMPLEPAY_' "$(dirname "${BASH_SOURCE[0]}")/code/.env")

# EDIT !!!
TRANSACTION_ID="79465682"
SDK_VERSION="wget_v1.20.1:d41d8cd98f00b204e9800998ecf8427e"
SALT="$(apg -a 1 -n 1 -m 32 -x 32 -M NCL)"
# EDIT !!!
RESPONSE_HASH="a7cc045780964bd61110726c30134206"

printf -v MESSAGE '{"merchant":"%s","transactionIds":["%s"],"salt":"%s","sdkVersion":"%s"}' \
    "$SIMPLEPAY_MERCHANT_ID" "$TRANSACTION_ID" "$SALT" "$SDK_VERSION"
MESSAGE_HASH="$(echo -n "$MESSAGE" | openssl dgst -sha384 -hmac "$SIMPLEPAY_SECRET_KEY" -binary | openssl base64)"

RESPONSE="$(wget -q --tries=1 --timeout=10 -O- "https://secure.simplepay.hu/payment/v2/query" \
  --header="Content-Type: application/json" \
  --header="Accept-Language: en" \
  --header="Signature: $MESSAGE_HASH" \
  --user-agent "$SDK_VERSION" \
  --post-data "$MESSAGE" 2>&1)"
EXIT_STATUS="$?"
if [ "$EXIT_STATUS" -ne 0 ]; then
    echo "wget HTTP error: ${EXIT_STATUS}" 1>&2
    echo "--- RETRY ---" 1>&2
    wget -v -S --tries=1 --timeout=10 -O- "https://secure.simplepay.hu/payment/v2/query" \
        --header="Content-Type: application/json" \
        --header="Accept-Language: en" \
        --header="Signature: $MESSAGE_HASH" \
        --user-agent "$SDK_VERSION" \
        --post-data "$MESSAGE" 1>&2
    echo "--- RETRY ---" 1>&2
    exit 10
fi

# Remove salts from response
if [ "$(echo -n "$RESPONSE" | sed -e 's#"salt":"[^"]\{32\}"#"salt":"!"#g' | md5sum | cut -d " " -f 1)" != "$RESPONSE_HASH" ]; then
    echo "Response error! ${RESPONSE}" 1>&2
    exit 11
fi

exit 0

@iamgergo iamgergo closed this as completed Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants