/** * @param array $defaults * * @return \Generated\Shared\Transfer\PayoneStandardParameterTransfer */ protected function createStandardParameter(array $defaults) { $standardParameterTransfer = new PayoneStandardParameterTransfer(); $standardParameterTransfer->fromArray($defaults); /******************************** * @todo get params from config (like in PayoneConfig zed bundle) ********************************/ return $standardParameterTransfer; }
/** * @param \Spryker\Zed\Payone\Business\Api\Request\Container\AbstractRequestContainer $container * * @return void */ protected function applyStandardParameter(AbstractRequestContainer $container) { if ($container->getPortalid() === null) { $container->setPortalid($this->standardParameter->getPortalId()); } if ($container->getAid() === null) { $container->setAid($this->standardParameter->getAid()); } if ($container->getMid() === null) { $container->setMid($this->standardParameter->getMid()); } if ($container->getEncoding() === null) { $container->setEncoding($this->standardParameter->getEncoding()); } if ($container->getMode() === null) { $container->setMode($this->modeDetector->getMode()); } if ($container->getLanguage() === null) { $container->setLanguage($this->standardParameter->getLanguage()); } if ($container->getApiVersion() === null) { $container->setApiVersion($this->standardParameter->getApiVersion()); } if ($container->getResponsetype() === null) { $container->setResponsetype($this->standardParameter->getResponseType()); } }
/** * @param \Generated\Shared\Transfer\PayoneCreditCardCheckRequestDataTransfer $creditCardCheckRequestDataTransfer * * @return array */ public function getCreditCardCheckRequestData(PayoneCreditCardCheckRequestDataTransfer $creditCardCheckRequestDataTransfer) { $this->standardParameter->fromArray($creditCardCheckRequestDataTransfer->toArray(), true); $creditCardCheck = new CreditCardCheck($this->standardParameter, $this->hashGenerator, $this->modeDetector); $data = $creditCardCheck->mapCreditCardCheckData(); return $data->toArray(); }
/** * @param \Spryker\Shared\Payone\Dependency\TransactionStatusUpdateInterface $request * * @return bool|\Spryker\Zed\Payone\Business\Api\TransactionStatus\TransactionStatusResponse */ protected function validate(TransactionStatusUpdateInterface $request) { $systemHashedKey = $this->hashGenerator->hash($this->standardParameter->getKey()); if ($request->getKey() !== $systemHashedKey) { return $this->createErrorResponse('Payone transaction status update: Given and internal key do not match!'); } if ((int) $request->getAid() !== (int) $this->standardParameter->getAid()) { return $this->createErrorResponse('Payone transaction status update: Invalid Aid! System: ' . $this->standardParameter->getAid() . ' Request: ' . $request->getAid()); } if ((int) $request->getPortalid() !== (int) $this->standardParameter->getPortalId()) { return $this->createErrorResponse('Payone transaction status update: Invalid Portalid! System: ' . $this->standardParameter->getPortalId() . ' Request: ' . $request->getPortalid()); } return true; }
/** * @return \Generated\Shared\Transfer\PayoneStandardParameterTransfer */ public function getRequestStandardParameter() { $settings = $this->get(PayoneConstants::PAYONE); $standardParameter = new PayoneStandardParameterTransfer(); $standardParameter->setEncoding($settings[PayoneConstants::PAYONE_CREDENTIALS_ENCODING]); $standardParameter->setMid($settings[PayoneConstants::PAYONE_CREDENTIALS_MID]); $standardParameter->setAid($settings[PayoneConstants::PAYONE_CREDENTIALS_AID]); $standardParameter->setPortalId($settings[PayoneConstants::PAYONE_CREDENTIALS_PORTAL_ID]); $standardParameter->setKey($settings[PayoneConstants::PAYONE_CREDENTIALS_KEY]); $standardParameter->setPaymentGatewayUrl($settings[PayoneConstants::PAYONE_PAYMENT_GATEWAY_URL]); $standardParameter->setCurrency(Store::getInstance()->getCurrencyIsoCode()); $standardParameter->setLanguage(Store::getInstance()->getCurrentLanguage()); $standardParameter->setRedirectSuccessUrl($this->getYvesBaseUrl() . $settings[PayoneConstants::PAYONE_REDIRECT_SUCCESS_URL]); $standardParameter->setRedirectBackUrl($this->getYvesBaseUrl() . $settings[PayoneConstants::PAYONE_REDIRECT_BACK_URL]); $standardParameter->setRedirectErrorUrl($this->getYvesBaseUrl() . $settings[PayoneConstants::PAYONE_REDIRECT_ERROR_URL]); return $standardParameter; }