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

Class not found : ApplicationConfiguration #8

Closed
prasadsupare opened this issue Feb 21, 2019 · 7 comments
Closed

Class not found : ApplicationConfiguration #8

prasadsupare opened this issue Feb 21, 2019 · 7 comments

Comments

@prasadsupare
Copy link

prasadsupare commented Feb 21, 2019

I've created an index file from where i'am using SumUp class of SumUp.php file from sumup folder, And i'am getting the following error from SumUp.php file:

Fatal error: Uncaught Error: Class 'SumUp\Application\ApplicationConfiguration' not found in /mnt/stor1-wc1-dfw1/388632/www.xyz.com/web/content/wilson/sumup/sumup/SumUp.php:54 Stack trace: #0 /mnt/stor1-wc1-dfw1/388632/www.xyz.com/web/content/wilson/sumup/index.php(23): SumUp\SumUp->__construct(Array) #1 {main} thrown in /mnt/stor1-wc1-dfw1/388632/www.xyz.com/web/content/wilson/sumup/sumup/SumUp.php on line 54

@lyubomir-sumup
Copy link
Contributor

The recommended way for using the SDK is through composer. Do you use it that way?
Can you provide some example code so we could help you?

@lyubomir-sumup
Copy link
Contributor

Please don't provide sensitive data (such as credit details, emails, codes, secrets, etc.)

@prasadsupare
Copy link
Author

Please don't provide sensitive data (such as credit details, emails, codes, secrets, etc.)

sir, these are the fake card details used for sandbox testing..

@prasadsupare
Copy link
Author

This is my index file:

require_once 'sumup/SumUp.php';


try {
			    $sumup = new \SumUp\SumUp ([
			    'app_id'     => 'Xxxxxxxxxxxxxxxxxxxxxx',
			    'app_secret' => 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
			    'grant_type' => 'client_credentials'
			]);
			$accessToken = $sumup->getAccessToken();
			$value = $accessToken->getValue();

    $checkoutService = $sumup->getCheckoutService();
    $checkoutResponse = $checkoutService->create($amount, $currency, $checkoutRef, $payToEmail);
    $checkoutId = $checkoutResponse->getBody()->id;
//  pass the $chekoutId to the front-end to be processed
} catch (\SumUp\Exceptions\SumUpAuthenticationException $e) {
    echo 'Authentication error: ' . $e->getMessage();
} catch (\SumUp\Exceptions\SumUpResponseException $e) {
    echo 'Response error: ' . $e->getMessage();
} catch(\SumUp\Exceptions\SumUpSDKException $e) {
    echo 'SumUp SDK error: ' . $e->getMessage();
}



$headers = array(
     sprintf('Authorization: Bearer %s', $accessToken),
    'Content-Type' => 'application/json'
);
$data = '{
        "payment_type": "card",
        "card": {
          "name": "'.$card_name.'",
          "number": "'.$card_number.'",
          "expiry_month": "'.$expiry_month.'",
          "expiry_year": "'.$expiry_year.'",
          "cvv": "'.$cvv.'"
        }
      }';
$url="https://api.sumup.com/v0.1/checkouts/".$checkoutId;
 $packet_json = json_encode($data);
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
        curl_setopt($ch, CURLOPT_POSTFIELDS, $packet_json);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        $output = curl_exec($ch);
        $output = json_decode($output, true);

		if (!$output) 
		{
		    return false;
		}

@lyubomir-sumup
Copy link
Contributor

The recommended way of using the SDK is by composer.
Obviously you don't want to use it so you need to implement autoloader yourself or to 'require' all files from the SDK one by one.

NOTE: you must not process (in production) any checkouts with card details from your backend if you are not PCI DSS certified.

@prasadsupare
Copy link
Author

Thank you sir! that helped!! :)

@baris22
Copy link

baris22 commented Feb 11, 2022

How did you fix this issue? I have the same problem. How can I call the classes?

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