Fatal error: Uncaught Error: Class 'PaymentDetailBuilder' not found
initial code is like this:
require_once('vendor/autoload.php');
use paytmpg\merchant\models\PaymentDetail\PaymentDetailBuilder;
use paytmpg\merchant\models\PaymentStatusDetail\PaymentStatusDetailBuilder;
use paytmpg\merchant\models\RefundDetail\RefundDetailBuilder;
use paytmpg\merchant\models\RefundStatusDetail\RefundStatusDetailBuilder;
// For Staging
$environment = LibraryConstants::STAGING_ENVIRONMENT;
// For Production
// $environment = LibraryConstants::PRODUCTION_ENVIRONMENT;
// Find your mid, key, website in your Paytm Dashboard at https://dashboard.paytm.com/next/apikeys
$mid = MERCHANT_MID;
$key = MERCHANT_KEY;
$website = MERCHANT_WEBSITE;
$client_id = MERCHANT_CLIENT_ID;
$callbackUrl = MERCHANT_CALLBACK_URL;
MerchantProperties::setCallbackUrl($callbackUrl);
MerchantProperties::initialize($environment, $mid, $key, $client_id, $website);
// If you want to add log file to your project, use below code
// Config::$monologName = '[PAYTM]';
// Config::$monologLevel = MonologLogger::INFO;
// Config::$monologLogfile = 'file.log';
$channelId = EChannelId::WEB;
$orderId = "ORDER_ID".rand(0,99); // post order id
$txnAmount = Money::constructWithCurrencyAndValue(EnumCurrency::INR, "11.00"); // post amount to be paid
$userInfo = new UserInfo("CUSTID_002");
$userInfo->setAddress("CUSTOMER_ADDRESS");
$userInfo->setEmail("CUSTOMER_EMAIL_ID");
$userInfo->setFirstName("CUSTOMER_FIRST_NAME");
$userInfo->setLastName("CUSTOMER_LAST_NAME");
$userInfo->setMobile("CUSTOMER_MOBILE_NO");
$userInfo->setPincode("CUSTOMER_PINCODE");
$paymentDetailBuilder = new PaymentDetailBuilder($channelId, $orderId, $txnAmount, $userInfo);
$paymentDetail = $paymentDetailBuilder->build();
$response = Payment::createTxnToken($paymentDetail);
print_r($response);
I have copied from => https://developer.paytm.com/docs/server-sdk/php/?ref=serverSdk#SDKCode;
I'm building bigcommerce APP. But I cannot get "AuthToken". Please help. See full code below. Also attached image with NULL response.
require_once($_SERVER['DOCUMENT_ROOT'].'/config.php');
require_once($_SERVER['DOCUMENT_ROOT'].'/vendor/autoload.php');
use Bigcommerce\Api\Client as Bigcommerce;
$object = new \stdClass();
$object->client_id = BC_CLIENT_ID;
$object->client_secret = BC_CLIENT_SECRET;
$object->redirect_uri = 'https://yourwebsiteurl.com/oauth.php';
$object->code = $_GET['code'];
$object->context = $_GET['context'];
$object->scope = $_GET['scope'];
$authTokenResponse = Bigcommerce::getAuthToken($object);
I'm currently attempting to update an internal tool to handle an upgrade of our exchange servers to office 365.
I'm using the most recent version of James Armas's PHP-EWS tool. jamesiarmes/php-ews
Here is the code snippet that is inside of a function that we use to get events for a certain date range.
$email = '*email#domain*';
$password = '*password*';
$server = 'outlook.office365.com';
// Define EWS
//$ews = EWSAutodiscover::getEWS($email, $password);
$ews = new Client($server, $email, $password);
// Set init class
$request = new FindItemType();
// Use this to search only the items in the parent directory in question or use ::SOFT_DELETED
// to identify "soft deleted" items, i.e. not visible and not in the trash can.
$request->Traversal = ItemQueryTraversalType::SHALLOW;
// This identifies the set of properties to return in an item or folder response
$request->ItemShape = new ItemResponseShapeType();
$request->ItemShape->BaseShape = DefaultShapeNamesType::ALL_PROPERTIES;
// Define the timeframe to load calendar items
$request->CalendarView = new CalendarViewType();
$request->CalendarView->StartDate = $start_date;// an ISO8601 date e.g. 2012-06-12T15:18:34+03:00
$request->CalendarView->EndDate = $end_date;// an ISO8601 date later than the above
// Only look in the "calendars folder"
$request->ParentFolderIds = new NonEmptyArrayOfBaseFolderIdsType();
$request->ParentFolderIds->DistinguishedFolderId = new DistinguishedFolderIdType();
$request->ParentFolderIds->DistinguishedFolderId->Id = DistinguishedFolderIdNameType::CALENDAR;
$request->ParentFolderIds->DistinguishedFolderId->Mailbox = new StdClass;
$request->ParentFolderIds->DistinguishedFolderId->Mailbox->EmailAddress = $email_address;
// Send request
$response = $ews->FindItem($request);
When this code is run, we get a 404 from the SOAP client:
Fatal error: Uncaught exception 'Exception' with message 'SOAP client returned status of 404.' in /*dirs*/Client.php:1650 Stack trace: #0 /*dirs*/Client.php(1633): jamesiarmes\PhpEws\Client->processResponse(NULL) #1 /*dirs*/Client.php(670): jamesiarmes\PhpEws\Client->makeRequest('FindItem', Object(jamesiarmes\PhpEws\Request\FindItemType)) #2 /*dirs*/index_dev.php(64): jamesiarmes\PhpEws\Client->FindItem(Object(jamesiarmes\PhpEws\Request\FindItemType)) #3 /*dirs*/index_dev.php(269): getEventHTML('email#domain...', '2017-07-18T02:0...', '2017-07-18T21:5...') #4 {main} thrown in /*dirs*/Client.php on line 1650
I believe that I do have the connection set up correctly, because when I alter the credentials, I do get a 401.
I have looked into this page: PHP-EWS “Soap client returned status of 404”
And I've tried the outlook.office365.com/EWS/Exchange.asmx endpoint as well, but I still get the SOAP 404.
Because of this, I thought this was enough of a separate question. (Although the more I research, the more that the REST client may be the next step)
I might be on the completely wrong track as well, so any help would be greatly appreciated!
I had a similar issue when we moved from an on-premises Exchange server to Office 365 and managed to trace the issue back to SoapClient.php under php-ntlm.
Going from the error that was thrown in your request:
Fatal error: Uncaught exception 'Exception' with message 'SOAP client returned status of 404.' .... thrown in /*dirs*/Client.php on line 1650
If we look at that line in Client.php the exception appears to come from the function that calls the aforementioned SoapClient.php script.
protected function processResponse($response)
{
// If the soap call failed then we need to throw an exception.
$code = $this->soap->getResponseCode();
if ($code != 200) {
throw new \Exception(
"SOAP client returned status of $code.",
$code
);
}
return $response;
}
I was able to resolve the issue by modifying the CURL request options in SoapClient.php (located around line 180).
Original Code:
protected function curlOptions($action, $request)
{
$options = $this->options['curlopts'] + array(
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => $this->buildHeaders($action),
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_HTTPAUTH => CURLAUTH_BASIC | CURLAUTH_NTLM,
CURLOPT_USERPWD => $this->options['user'] . ':'
. $this->options['password'],
);
// We shouldn't allow these options to be overridden.
$options[CURLOPT_HEADER] = true;
$options[CURLOPT_POST] = true;
$options[CURLOPT_POSTFIELDS] = $request;
return $options;
}
Modified Code:
protected function curlOptions($action, $request)
{
$cOpts = array(
CURLOPT_PROXY => "my.proxy.com:8080",
CURLOPT_PROXYUSERPWD => $this->options['user'] . ':'
. $this->options['password'],
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => $this->buildHeaders($action),
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_HTTPAUTH => CURLAUTH_BASIC | CURLAUTH_NTLM,
CURLOPT_USERPWD => $this->options['user'] . ':'
. $this->options['password'],
);
$options = $this->options['curlopts'] + $cOpts;
// We shouldn't allow these options to be overridden.
$options[CURLOPT_HEADER] = true;
$options[CURLOPT_POST] = true;
$options[CURLOPT_POSTFIELDS] = $request;
return $options;
}
I set CURLOPT_SSL_VERIFYPEER to false and also added proxy options to the request as the connection is made from inside a corporate network which requires proxy authentication to access any external sites.
In my mailing PHP script I create the client using the following code:
$server = 'outlook.office365.com';
$username = 'user#domain.com';
$password = 'myPassword';
$version = Client::VERSION_2016;
$client = new Client($server, $username, $password, $version);
Have you tried using the solution from https://github.com/jamesiarmes/php-ews/issues/196 eg change
$version = Client::VERSION_2016;
$ews = new Client($server, $email, $password,$version);
I can't make out what is wrong with your code but maybe the following helps. I'm using this script successfully to export my calendar regulary from o365.
Host and User are like this:
host = "outlook.office365.com"
username = "user#domain.com"
Script:
$start_date = new Datetime('today -1 months');
$end_date = new Datetime('today +1 months');
$timezone = 'W. Europe Standard Time';
$ini_array = parse_ini_file($credentials_ini);
$host = $ini_array['host'];
$username = $ini_array['username'];
$password = $ini_array['password'];
$version = Client::VERSION_2016;
$client = new Client($host, $username, $password, $version);
$client->setTimezone($timezone);
$request = new FindItemType();
$request->ParentFolderIds = new NonEmptyArrayOfBaseFolderIdsType();
$request->ItemShape = new ItemResponseShapeType();
$request->ItemShape->BaseShape = DefaultShapeNamesType::ALL_PROPERTIES;
$folder_id = new DistinguishedFolderIdType();
$folder_id->Id = DistinguishedFolderIdNameType::CALENDAR;
$request->ParentFolderIds->DistinguishedFolderId[] = $folder_id;
$request->Traversal = ItemQueryTraversalType::SHALLOW;
$request->CalendarView = new CalendarViewType();
$request->CalendarView->StartDate = $start_date->format('c');
$request->CalendarView->EndDate = $end_date->format('c');
$request->ConnectionTimeout = 60;
$response = $client->FindItem($request);
$response_messages = $response->ResponseMessages->FindItemResponseMessage;
foreach ($response_messages as $response_message) {
$items = $response_message->RootFolder->Items->CalendarItem;
foreach ($items as $event){
$id = $event->ItemId->Id;
$subject = $event->Subject;
$location = $event->Location;
// ...
// do something with it
}
}
I currently try to implement chained payments using the adaptive payments sdk. I receive this error
PPConnectionException in PPHttpConnection.php line 91:
error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure
My example code looks like this
$payRequest = new \PayPal\Types\AP\PayRequest();
$receiver = array();
$receiver[0] = new \PayPal\Types\AP\Receiver();
$receiver[0]->amount = '7.50';
$receiver[0]->email = "admin#example.de";
$receiver[1] = new \PayPal\Types\AP\Receiver();
$receiver[1]->amount = '2.50';
$receiver[1]->email = "seller#example.de";
$receiver[1]->primary = "true";
$receiverList = new \PayPal\Types\AP\ReceiverList($receiver);
$payRequest->receiverList = $receiverList;
$requestEnvelope = new \PayPal\Types\Common\RequestEnvelope("de_DE");
$payRequest->requestEnvelope = $requestEnvelope;
$payRequest->actionType = "PAY";
$payRequest->cancelUrl = "http://example.de:8080/payment/cancel";
$payRequest->returnUrl = "http://example.de:8080?returned";
$payRequest->currencyCode = "EUR";
$payRequest->ipnNotificationUrl = "http://example.de:8080";
$sdkConfig = array(
'mode' => 'sandbox',
"acct1.UserName" => "jb-us-seller_api1.paypal.com",
"acct1.Password" => "WX4WTU3S8MY44S7F",
"acct1.Signature" => "AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy",
"acct1.AppId" => "APP-80W284485P519543T"
);
$adaptivePaymentsService = new \PayPal\Service\AdaptivePaymentsService($sdkConfig);
$payResponse = $adaptivePaymentsService->Pay($payRequest);
if ($payResponse->responseEnvelope->ack == "Success")
{
redirect('Location: ' . 'https://sandbox.paypal.com/webscr?cmd=_ap-payment&paykey=' . $payResponse->payKey);
}
else{
die('error');
}
The solutions I found do not seem to work ... any ideas? Currently testing from localhost.
I'm not aware of the actual solution or cause of the error.
What fixed it for me was testing it on an actual server instead of my localhost enviroment.
I also updated the packages to the latest version since there were many changes regarding tls. Older examples do not reference working libaries.
I am using the library googleads/googleads-php-lib from github.
I am trying to create a text ad, but I am getting an error that I cannot set the URL field. The code has been working for quite some time but has suddenly stopped due to this error.
The SoapFault exception that is thrown is:
[AdError.CANNOT_SET_FIELD # operations[0].operand.ad.url]
My code is as follows:
require_once('Google/Api/Ads/AdWords/Lib/AdWordsUser.php');
$developerToken = '*removed*';
$clientCustomerId = '*removed*';
$userAgent = 'test';
$settingsIniPath = './vendor/googleads/googleads-php-lib/src/Google/Api/Ads/AdWords/settings.ini';
$oAuth = array(
'client_id' => '*removed*',
'client_secret' => '*removed*',
'refresh_token' => '*removed*',
);
$adWordsUser = new AdWordsUser(null, $developerToken, $userAgent, $clientCustomerId, $settingsIniPath, $oAuth);
$adWordsUser->SetDefaultVersion('v201409');
$adGroupId = *removed*;
$textAd = new TextAd();
$textAd->headline = 'headline text';
$textAd->description1 = 'description1 text';
$textAd->description2 = 'description2 text';
$textAd->displayUrl = 'www.example.com';
$textAd->url = 'http://www.example.com/';
$adGroupAd = new AdGroupAd($adGroupId, $textAd);
$operations = array(new AdGroupAdOperation($adGroupAd, null, 'ADD'));
$adGroupAdService = $adWordsUser->GetService('AdGroupAdService');
$result = $adGroupAdService->mutate($operations);
I am not sure what could be causing this error. Any help would be greatly appreciated.
got caught with that too. The problem seems to be that "url" is no longer supported, you have to use "targetUrls" of upgraded URLs API instead:
http://googleadsdeveloper.blogspot.cz/2015/05/reminder-adwords-destination-urls-will.html