devinweb / laravel-hyperpay

Laravel package for Hyperpay payment gateway in MENA.
https://devinweb.com
MIT License
25 stars 11 forks source link

[200.300.404] Invalid or missing parameter in production #32

Closed yahyaio closed 2 years ago

yahyaio commented 2 years ago

Hello,

First, thank you for this great package, it helps a lot.

Lately we're getting this error when submitting Card details for Visa and Mada only in production. We're not sure what the problem is. Any ideas?

{
    "ndc": "###.prod02-vm-tx07",
    "result": {
        "code": "200.300.404",
        "description": "invalid or missing parameter",
        "parameterErrors": [
            {
                "name": "customer.browser.language",
                "value": "en-US",
                "message": "was already set and cannot be overwritten"
            },
            {
                "name": "customer.browser.userAgent",
                "value": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36",
                "message": "was already set and cannot be overwritten"
            }
        ]
    },
    "status": 422,
    "message": "invalid or missing parameter",
    "timestamp": "2022-09-07 08:02:26+0000",
    "buildNumber": "2621780cf1399bc67d0207fab6d754153a4fc274@2022-08-11 07:04:50 +0000",
    "transaction_status": "cancel"
}

We've added these parameters:

class HyperPayBilling implements BillingInterface
{
    /**
     * Get the billing data.
     *
     * @return array
     */
    public function getBillingData(): array
    {
        ...
        ...

        $parameters = [
            'billing.street1'   => $address1,
            'billing.city'      => $city,
            'billing.state'     => $state,
            'billing.country'   => $countryIso,
            'billing.postcode'  => $postcode,
        ];

        return $parameters;
    }
}

This is the full parameters that we're seeing:

[
  "entityId" => "###"
  "amount" => "109.99"
  "currency" => "SAR"
  "paymentType" => "DB"
  "merchantTransactionId" => "xXGXCw4nY3ZvdRyZJNsZ3a88iDNHpV3T8mSGYkyq"
  "notificationUrl" => "http://localhost:8021/hyperpay/webhook"
  "customer.email" => "user@yopmail.com"
  "customer.givenName" => "Test"
  "customer.surname" => "Test"
  "customer.browser.userAgent" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36"
  "customer.browser.language" => "ar"
  "billing.street1" => "3651"
  "billing.city" => "Riyadh"
  "billing.state" => "Riyadh Province"
  "billing.country" => "SA"
  "billing.postcode" => "12333"
]

composer.json

{
    "php": "^7.3|^8.0",
    "barryvdh/laravel-dompdf": "^0.9.0",
    "devinweb/laravel-hyperpay": "1.2",
    "doctrine/dbal": "^3.1",
    "elfsundae/laravel-hashid": "^1.7",
    "fideloper/proxy": "^4.4",
    "fruitcake/laravel-cors": "^2.0",
    "guzzlehttp/guzzle": "^7.0.1",
    "jorenvanhocht/laravel-share": "^4.1",
    "laravel/framework": "^8.40",
    "laravel/passport": "^10.1",
    "laravel/socialite": "^5.2",
    "laravel/tinker": "^2.5",
    "league/flysystem-aws-s3-v3": "~1.0",
    "league/flysystem-cached-adapter": "~1.0",
    "maatwebsite/excel": "^3.1",
    "maxbanton/cwh": "^2.0",
    "mckenziearts/laravel-notify": "^2.2",
    "mesavolt/mdi-php": "^1.1",
    "mohannadnaj/smsa-sdk": "^1.0",
    "propaganistas/laravel-phone": "^4.3",
    "protonemedia/laravel-cross-eloquent-search": "^3.0",
    "spatie/laravel-responsecache": "^7.4"
}

Thank you in advance.

darbaoui commented 2 years ago

that issue still exist or not

darbaoui commented 2 years ago

@yahyaio Yes, that issue exists. Maybe there's an update in hyperpay api, but anyway i'm working on the Fix.

yahyaio commented 2 years ago

Thank you @darbaoui. Yes removing these parameters worked. It must've been an internal change to their API.