Symfony2 не получает ответ от Authorize.net CIM

Я настраиваю веб-приложение symfony2 таким образом, чтобы при создании пользователя приложение создавало профиль в Authorize.net по управлению информацией о клиентах (CIM).

Я устанавливаю учетные данные в settings.yml:

authorizenet_login_id: MY_ACTUAL_LOGIN_ID
authorizenet_tran_key: MY_ACTUAL_KEY
authorizenet_test_mode: true

Здесь я запрашиваю CIM:

public function createUserPaymentProfile(Entity\User $user, $andFlush = true)
{
$paymentProfile = $this->getAuthorizeNetPaymentProfile(
$user->getOriginalCardNumber(),
$user->getExpirationDate()
);

$customerProfile                     = new \AuthorizeNetCustomer;
$customerProfile->merchantCustomerId = $user->getId();
$customerProfile->email              = $user->getEmail();
$customerProfile->paymentProfiles[]  = $paymentProfile;

$response = $this->authorizeNetCIM->createCustomerProfile($customerProfile);

if ($response->isOk()) {
$customerProfileId = $response->getCustomerProfileId();
$user->setAuthorizeNetCustomerProfileId($customerProfileId);

$customerPaymentProfileIds = $response->getCustomerPaymentProfileIds();

$customerPaymentProfileId = is_array($customerPaymentProfileIds)
? $customerPaymentProfileIds[0]
: $customerPaymentProfileIds;
$user->setAuthorizeNetCustomerPaymentProfileId($customerPaymentProfileId);

$this->em->persist($user);
if ($andFlush) {
$this->em->flush();
}
}

return $response;
}

Тем не менее, я не получаю никакого ответа в следующей строке:

$response = $this->authorizeNetCIM->createCustomerProfile($customerProfile);

Это var_dump ответа:

object(AuthorizeNetCIM_Response)#899 (2) { ["xml"]=> NULL ["response"]=> bool(false) }

ОБНОВИТЬ:
Я отладил вызов curl, и это сообщение об ошибке, которое я получаю из ответа curl:
SSL: сбой проверки сертификата (результат: 5)

1

Решение

Возможно, срок действия файла cert.pem в вашем SDK истек. У этого поста есть описание, которое решило проблему для меня:

https://community.developer.authorize.net/t5/The-Authorize-Net-Developer-Blog/Authorize-Net-Begins-Infrastructure-and-SHA-2-Certificate/bc-p/50166#M445

Просто замените файл cert.pem в каталоге authnet / lib / ssl в SDK новым файлом из этой папки: http://curl.haxx.se/ca/cacert.pem

Ссылка authorize.net выше также относится к этому вопросу SO: cURL требует CURLOPT_SSL_VERIFYPEER = FALSE

0

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector