'M', 'N' => 'N', 'U' => 'P', 'I' => 'P', 'S' => 'S', 'A' => '' ]; /** * Gets payment CVV verification code. * * @param OrderPaymentInterface $orderPayment * @return string * @throws \InvalidArgumentException If specified order payment has different payment method code. */ public function getCode(OrderPaymentInterface $orderPayment) { if ($orderPayment->getMethod() !== ConfigProvider::CODE) { throw new \InvalidArgumentException( 'The "' . $orderPayment->getMethod() . '" does not supported by Braintree CVV mapper.' ); } $additionalInfo = $orderPayment->getAdditionalInformation(); if (empty($additionalInfo[PaymentDetailsHandler::CVV_RESPONSE_CODE])) { return self::$notProvidedCode; } $cvv = $additionalInfo[PaymentDetailsHandler::CVV_RESPONSE_CODE]; return isset(self::$cvvMap[$cvv]) ? self::$cvvMap[$cvv] : self::$notProvidedCode; } }