From ac1600f1532410aa3b4dcaadf49aa5b0e2ea8804 Mon Sep 17 00:00:00 2001 From: Chandan Sinha Date: Tue, 5 Jul 2022 11:14:11 +0100 Subject: [PATCH] Code Sniffer updates --- Model/Observer/CaptureRequest.php | 185 --------- Model/Observer/RefundRequest.php | 184 --------- Model/Payment/State.php | 62 --- Model/Payment/Update.php | 11 - Model/Request/CurlRequest.php | 45 --- Setup/InstallSchema.php | 320 ---------------- Setup/UpgradeData.php | 608 ------------------------------ Setup/UpgradeSchema.php | 434 --------------------- 8 files changed, 1849 deletions(-) delete mode 100644 Model/Observer/CaptureRequest.php delete mode 100644 Model/Observer/RefundRequest.php delete mode 100644 Model/Payment/State.php delete mode 100644 Model/Payment/Update.php delete mode 100644 Model/Request/CurlRequest.php delete mode 100644 Setup/InstallSchema.php delete mode 100644 Setup/UpgradeData.php delete mode 100644 Setup/UpgradeSchema.php diff --git a/Model/Observer/CaptureRequest.php b/Model/Observer/CaptureRequest.php deleted file mode 100644 index 034bb30..0000000 --- a/Model/Observer/CaptureRequest.php +++ /dev/null @@ -1,185 +0,0 @@ -wplogger = $wplogger; - $this->_responseFactory = $responseFactory; - $this->_url = $url; - $this->omsDataFactory = $omsDataFactory; - $this->omsCollectionFactory = $omsCollectionFactory; - $this->paymentservicerequest = $paymentservicerequest; - $this->worldpayHelper = $worldpayHelper; - $this->curlrequest = $curlrequest; - $this->updateWorldPayPayment = $updateWorldPayPayment; - } - public function execute(\Magento\Framework\Event\Observer $observer) - { - $invoice = $observer->getEvent()->getInvoice(); - $order = $invoice->getOrder(); - $this->wplogger->info('came to capture22222'); - $this->wplogger->info(print_r($invoice->getEntityId(), true)); - $orderIncrementId = $order->getIncrementId(); - $userName = $this->worldpayHelper->getXmlUsername(); - $password = $this->worldpayHelper->getXmlPassword(); - if ($orderIncrementId) { - $collectionData = $this->omsCollectionFactory->create() - ->addFieldToSelect(['awp_settle_param','awp_partial_settle_param']) - ->addFieldToFilter('order_increment_id', ['eq' => $orderIncrementId]); - $collectionData = $collectionData->getData(); - if ($collectionData) { - $captureUrl = $collectionData[0]['awp_settle_param']; - $partialCaptureUrl = $collectionData[0]['awp_partial_settle_param']; - if (floatval($invoice->getGrandTotal()) != floatval($order->getGrandTotal())) { - $amount = $this->_amountAsInt($invoice->getGrandTotal()); - $currency = $invoice->getOrderCurrencyCode(); - $data = []; - $data['value'] = ['amount' => $amount, 'currency'=>$currency]; - $data['reference'] = 'Partial-capture-for-'.$order->getIncrementId(); - $data = json_encode($data); - $response = $this->sendRequest($partialCaptureUrl, $userName, $password, $data); - } else { - $response = $this->sendRequest($captureUrl, $userName, $password); - } - if ($response) { - $this->updateOrderData($orderIncrementId, $response); - } - } - } - - return true; - } - - public function sendRequest($captureUrl, $username, $password, $data = null) - { - $request = $this->_getRequest(); - $request->setUrl($captureUrl); - - $this->wplogger->info('Initialising request'); - $request->setOption(CURLOPT_POST, self::CURL_POST); - $request->setOption(CURLOPT_RETURNTRANSFER, self::CURL_RETURNTRANSFER); - $request->setOption(CURLOPT_NOPROGRESS, self::CURL_NOPROGRESS); - $request->setOption(CURLOPT_TIMEOUT, self::CURL_TIMEOUT); - $request->setOption(CURLOPT_VERBOSE, self::CURL_VERBOSE); - /*SSL verification false*/ - $request->setOption(CURLOPT_SSL_VERIFYHOST, false); - $request->setOption(CURLOPT_SSL_VERIFYPEER, false); - $request->setOption(CURLOPT_POSTFIELDS, $data); - $request->setOption(CURLOPT_USERPWD, $username.':'.$password); - // Cookie Set to 2nd 3DS request only. - //$cookie = $this->helper->getAccessWorldpayAuthCookie(); - $request->setOption(CURLOPT_HEADER, true); - $request->setOption(CURLOPT_HTTPHEADER, ['Content-Type: application/vnd.worldpay.payments-v6+json']); -// $request->setOption(CURLOPT_HTTPHEADER, array( -// "Content-Type: application/vnd.worldpay.payments-v6+json", -// "Authorization: Basic dG5lYnY4NmJjMHlwNG9uMTpsbDAxYTcwZDdhc2xubzYy" -// )); - if ($data) { - $this->wplogger->info('Sending Json as: ' . $data); - } else { - $this->wplogger->info('Sending Json as: ' . $captureUrl); - } - - $request->setOption(CURLINFO_HEADER_OUT, true); - - $result = $request->execute(); - - if (!$result) { - $this->wplogger->info('Request could not be sent.'); - $this->wplogger->info($result); - $this->wplogger->info( - '########### END OF REQUEST - FAILURE WHILST TRYING TO SEND REQUEST ###########' - ); - throw new \Magento\Framework\Exception\LocalizedException( - 'AccessWorldpay api service not available' - ); - } - $request->close(); - $this->wplogger->info('Request successfully sent'); - $this->wplogger->info($result); - - $bits = explode("\r\n\r\n", $result); - $body = array_pop($bits); - - return $body; - } - - /** - * @return object - */ - private function _getRequest() - { - if ($this->_request === null) { - $this->_request = $this->curlrequest; - } - - return $this->_request; - } - - /** - * @param result array - * - * @return Boolean - */ - public function updateOrderData($orderIncrementId, $responseData) - { - if ($responseData) { - $response = json_decode($responseData); - try { - $this->updateWorldPayPayment->create()->updatePaymentSettlement($orderIncrementId, $response); - } catch (exception $e) { - $this->wplogger->error($e->getMessage()); - } - } - } - - /** - * @param float $amount - * @return int - */ - private function _amountAsInt($amount) - { - return round($amount, 2, PHP_ROUND_HALF_EVEN) * pow(10, 2); - } -} diff --git a/Model/Observer/RefundRequest.php b/Model/Observer/RefundRequest.php deleted file mode 100644 index c213d33..0000000 --- a/Model/Observer/RefundRequest.php +++ /dev/null @@ -1,184 +0,0 @@ -wplogger = $wplogger; - $this->_responseFactory = $responseFactory; - $this->_url = $url; - $this->omsDataFactory = $omsDataFactory; - $this->omsCollectionFactory = $omsCollectionFactory; - $this->paymentservicerequest = $paymentservicerequest; - $this->worldpayHelper = $worldpayHelper; - $this->curlrequest = $curlrequest; - $this->updateWorldPayPayment = $updateWorldPayPayment; - } - public function execute(\Magento\Framework\Event\Observer $observer) - { - $creditmemo = $observer->getEvent()->getCreditmemo(); - $invoice = $creditmemo->getInvoice(); - $order = $creditmemo->getOrder(); - $orderIncrementId = $order->getIncrementId(); - $userName = $this->worldpayHelper->getXmlUsername(); - $password = $this->worldpayHelper->getXmlPassword(); - if ($orderIncrementId) { - $collectionData = $this->omsCollectionFactory->create() - ->addFieldToSelect(['awp_refund_param','awp_partial_refund_param']) - ->addFieldToFilter('order_increment_id', ['eq' => $orderIncrementId]); - $collectionData = $collectionData->getData(); - if ($collectionData) { - $refundUrl = $collectionData[0]['awp_refund_param']; - $partialRefundUrl = $collectionData[0]['awp_partial_refund_param']; - if (floatval($creditmemo->getGrandTotal()) != floatval($order->getGrandTotal())) { - $amount = $this->_amountAsInt($creditmemo->getGrandTotal()); - $currency = $creditmemo->getOrderCurrencyCode(); - $data = []; - $data['value'] = ['amount' => $amount, 'currency'=>$currency]; - $data['reference'] = 'Partial-refund-for-'.$order->getIncrementId(); - $data = json_encode($data); - $response = $this->sendRequest($partialRefundUrl, $userName, $password, $data); - } else { - $response = $this->sendRequest($refundUrl, $userName, $password); - } -// if($response){ -// $this->updateOrderData($orderIncrementId, $response); -// } - } - } - - return true; - } - - public function sendRequest($refundUrl, $username, $password, $data = null) - { - $request = $this->_getRequest(); - $request->setUrl($refundUrl); - - $this->wplogger->info('Initialising request'); - $request->setOption(CURLOPT_POST, self::CURL_POST); - $request->setOption(CURLOPT_RETURNTRANSFER, self::CURL_RETURNTRANSFER); - $request->setOption(CURLOPT_NOPROGRESS, self::CURL_NOPROGRESS); - $request->setOption(CURLOPT_TIMEOUT, self::CURL_TIMEOUT); - $request->setOption(CURLOPT_VERBOSE, self::CURL_VERBOSE); - /*SSL verification false*/ - $request->setOption(CURLOPT_SSL_VERIFYHOST, false); - $request->setOption(CURLOPT_SSL_VERIFYPEER, false); - $request->setOption(CURLOPT_POSTFIELDS, $data); - $request->setOption(CURLOPT_USERPWD, $username.':'.$password); - // Cookie Set to 2nd 3DS request only. - //$cookie = $this->helper->getAccessWorldpayAuthCookie(); - $request->setOption(CURLOPT_HEADER, true); - $request->setOption(CURLOPT_HTTPHEADER, ['Content-Type: application/vnd.worldpay.payments-v6+json']); -// $request->setOption(CURLOPT_HTTPHEADER, array( -// "Content-Type: application/vnd.worldpay.payments-v6+json", -// "Authorization: Basic dG5lYnY4NmJjMHlwNG9uMTpsbDAxYTcwZDdhc2xubzYy" -// )); - if ($data) { - $this->wplogger->info('Sending Json as: ' . $data); - } else { - $this->wplogger->info('Sending Json as: ' . $refundUrl); - } - - $request->setOption(CURLINFO_HEADER_OUT, true); - - $result = $request->execute(); - - if (!$result) { - $this->wplogger->info('Request could not be sent.'); - $this->wplogger->info($result); - $this->wplogger->info( - '########### END OF REQUEST - FAILURE WHILST TRYING TO SEND REQUEST ###########' - ); - throw new \Magento\Framework\Exception\LocalizedException( - 'AccessWorldpay api service not available' - ); - } - $request->close(); - $this->wplogger->info('Request successfully sent'); - $this->wplogger->info($result); - - $bits = explode("\r\n\r\n", $result); - $body = array_pop($bits); - - return $body; - } - - /** - * @return object - */ - private function _getRequest() - { - if ($this->_request === null) { - $this->_request = $this->curlrequest; - } - - return $this->_request; - } - - /** - * @param result array - * - * @return Boolean - */ - public function updateOrderData($orderIncrementId, $responseData) - { - if ($responseData) { - $response = json_decode($responseData); - try { - $this->updateWorldPayPayment->create()->updatePaymentSettlement($orderIncrementId, $response); - } catch (exception $e) { - $this->wplogger->error($e->getMessage()); - } - } - } - - /** - * @param float $amount - * @return int - */ - private function _amountAsInt($amount) - { - return round($amount, 2, PHP_ROUND_HALF_EVEN) * pow(10, 2); - } -} diff --git a/Model/Payment/State.php b/Model/Payment/State.php deleted file mode 100644 index f001bae..0000000 --- a/Model/Payment/State.php +++ /dev/null @@ -1,62 +0,0 @@ -_url = $url; - $this->_handle = curl_init($this->_url); - } - - public function setOption($name, $value) - { - return curl_setopt($this->_handle, $name, $value); - } - - public function execute() - { - return curl_exec($this->_handle); - } - - public function getInfo($opt = null) - { - return curl_getinfo($this->_handle, $opt); - } - - public function getError() - { - return curl_error($this->_handle); - } - - public function close() - { - return curl_close($this->_handle); - } -} diff --git a/Setup/InstallSchema.php b/Setup/InstallSchema.php deleted file mode 100644 index abce027..0000000 --- a/Setup/InstallSchema.php +++ /dev/null @@ -1,320 +0,0 @@ -startSetup(); - - if (!$installer->tableExists(self::WORLDPAY_PAYMENT)) { - $table = $installer->getConnection()->newTable( - $installer->getTable(self::WORLDPAY_PAYMENT) - ) - ->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [ - 'identity' => true, - 'nullable' => false, - 'primary' => true, - 'unsigned' => true, - ], - 'Id' - ) - ->addColumn( - 'order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, - 'unsigned' => true], - 'Order Id' - ) - ->addColumn( - 'payment_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Payment Status' - ) - ->addColumn( - 'payment_model', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 25, - ['nullable' => false], - 'Payment Model' - ) - ->addColumn( - 'payment_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Payment Type' - ) - ->addColumn( - 'mac_verified', - \Magento\Framework\DB\Ddl\Table::TYPE_BOOLEAN, - null, - [], - 'MAC Verified' - ) - ->addColumn( - 'merchant_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '255', - [], - 'Merchant Id' - ) - ->addColumn( - '3d_verified', - \Magento\Framework\DB\Ddl\Table::TYPE_BOOLEAN, - null, - [], - '3D Secure Verified' - ) - ->addColumn( - 'risk_score', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [], - 'Risk Score' - ) - ->addColumn( - 'method', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - [], - 'Method' - ) - ->addColumn( - 'card_number', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - [], - 'Card Number' - ) - ->addColumn( - 'avs_result', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - [], - 'AVS Result' - ) - ->addColumn( - 'cvc_result', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - [], - 'CVC Result' - ) - ->addColumn( - '3d_secure_result', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - [], - '3D Secure Result' - )->addColumn( - 'worldpay_order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '40', - [], - 'WorldPay Order Id' - ) - ->addColumn( - 'risk_provider', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '24', - [], - 'Risk Provider' - ) - ->addColumn( - 'risk_provider_score', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '8,4', - [], - 'Risk Provider Score' - ) - ->addColumn( - 'risk_provider_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '20', - [], - 'Risk Provider Id' - ) - ->addColumn( - 'risk_provider_threshold', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '4', - [], - 'Risk Provider Threshold' - ) - ->addColumn( - 'risk_provider_final', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '4', - [], - 'Risk Provider Final' - ) - ->addIndex( - $installer->getIdxName(self::WORLDPAY_PAYMENT, ['order_id']), - ['order_id'] - ) - ->addIndex( - $installer->getIdxName(self::WORLDPAY_PAYMENT, ['worldpay_order_id']), - ['worldpay_order_id'] - ) - ->setComment('Payment Table') - ->setOption('type', 'InnoDB') - ->setOption('charset', 'utf8'); - - $installer->getConnection()->createTable($table); - } - - /* - *Token store - */ - if (!$installer->tableExists(self::ACCESSWORLDPAY_VERIFIEDTOKEN)) { - $table = $installer->getConnection()->newTable( - $installer->getTable(self::ACCESSWORLDPAY_VERIFIEDTOKEN) - ) - ->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [ - 'identity' => true, - 'nullable' => false, - 'primary' => true, - 'unsigned' => true, - ], - 'Id' - ) - ->addColumn( - 'token_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - ['nullable' => false], - 'Token Code' - ) - ->addColumn( - 'token', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - ['nullable' => false], - 'Token Code' - ) - ->addColumn( - 'description', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - ['nullable' => false], - 'Token Code' - ) - ->addColumn( - 'transaction_reference', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - ['nullable' => false], - 'Transaction Reference' - ) - ->addColumn( - 'token_expiry_date', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - ['nullable'=> false], - 'Token Expiry Date' - ) - ->addColumn( - 'namespace', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - ['nullable' => false], - 'Token Reason' - ) - ->addColumn( - 'card_number', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - ['nullable' => false], - 'Obfuscated Card number' - ) - ->addColumn( - 'cardholder_name', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - [], - 'Card Holder Name' - ) - ->addColumn( - 'card_expiry_month', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false], - 'Card Expiry Month' - ) - ->addColumn( - 'card_expiry_year', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false], - 'Card Expiry Year' - ) - ->addColumn( - 'method', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - null, - [], - 'Payment method used' - ) - ->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [ - 'unsigned' => true, - 'nullable' => false - ], - 'Customer Id' - ) - ->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - [ - 'nullable' => false, - 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT - ], - 'Created At' - ) - ->addIndex( - $installer->getIdxName(self::ACCESSWORLDPAY_VERIFIEDTOKEN, ['token']), - ['token'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ) - ->addIndex( - $installer->getIdxName(self::ACCESSWORLDPAY_VERIFIEDTOKEN, ['customer_id']), - ['customer_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ) - ->setComment('Token Table') - ->setOption('type', 'InnoDB') - ->setOption('charset', 'utf8'); - $installer->getConnection()->createTable($table); - } - $installer->endSetup(); - } -} diff --git a/Setup/UpgradeData.php b/Setup/UpgradeData.php deleted file mode 100644 index 3dc12ee..0000000 --- a/Setup/UpgradeData.php +++ /dev/null @@ -1,608 +0,0 @@ -categorySetupFactory = $categorySetupFactory; - $this->eavSetupFactory = $eavSetupFactory; - $this->configFactory = $configFactory; - $this->serializer = $serializer; - } - - /** - * {@inheritdoc} - */ - public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) - { - /** @var \Magento\Catalog\Setup\CategorySetup $catalogSetup */ - $catalogSetup = $this->categorySetupFactory->create(['setup' => $setup]); - - if (version_compare($context->getVersion(), '1.2.4', '<')) { - $index = time(); - $exceptionValues = [$index . '_0' => ["exception_code" => "CCAM0", - "exception_messages" => - "Card number should contain between 12" . - " and 20 numeric characters", - "exception_module_messages" => ""], - $index . '_1' => ["exception_code" => "CCAM1", - "exception_messages" => - "Please, Verify the disclaimer!" . - " before saving the card", - "exception_module_messages" => ""], - $index . '_2' => ["exception_code" => "CCAM2", - "exception_messages" => - "The card number entered is invalid", - "exception_module_messages" => ""], - $index . '_3' => ["exception_code" => "CCAM3", - "exception_messages" => - "Card brand is not supported.", - "exception_module_messages" => ""], - $index . '_4' => ["exception_code" => "CCAM4", - "exception_messages" => - "Please, enter valid Card Verification Number", - "exception_module_messages" => ""], - $index . '_5' => ["exception_code" => "CCAM5", - "exception_messages" => - "Error: Please verify your data", - "exception_module_messages" => ""], - $index . '_6' => ["exception_code" => "CCAM6", - "exception_messages" => - "Session Expired. Please try again.", - "exception_module_messages" => ""], - $index . '_7' => ["exception_code" => "CCAM7", - "exception_messages" => - "Something went wrong while processing your order." . - " Please try again later.", - "exception_module_messages" => ""], - $index . '_8' => ["exception_code" => "CCAM8", - "exception_messages" => "Please try after some time", - "exception_module_messages" => ""], - $index . '_9' => ["exception_code" => "CCAM9", - "exception_messages" => - "Error: Token does not exist." . - "Please delete it from My Account", - "exception_module_messages" => ""], - $index . '_10' => ["exception_code" => "CCAM10", - "exception_messages" => - "Unfortunately the order could not be processed." . - "Please contact us or try again later", - "exception_module_messages" => ""], - $index . '_11' => ["exception_code" => "CCAM11", - "exception_messages" => - "Order %s has been declined, " . - "please check your details and try again", - "exception_module_messages" => ""], - $index . '_12' => ["exception_code" => "CCAM12", - "exception_messages" => - "An unexpected error occurred, " . - "Please try to place the order again.", - "exception_module_messages" => ""], - $index . '_13' => ["exception_code" => "CCAM13", - "exception_messages" => - "An error occurred on the server." . - " Please try to place the order again.", - "exception_module_messages" => ""], - $index . '_14' => ["exception_code" => "CCAM14", - "exception_messages" => - "Your token is no longer scheme compliant. " . - "Please delete this card on my account" . - " and save new card.", - "exception_module_messages" => ""], - $index . '_15' => ["exception_code" => "CCAM15", - "exception_messages" => - "Invalid Payment Type. Please Refresh and check again", - "exception_module_messages" => ""], - $index . '_16' => ["exception_code" => "CCAM16", - "exception_messages" => - "Invalid Configuration. Please Refresh and check again", - "exception_module_messages" => ""], - $index . '_17' => ["exception_code" => "CCAM17", - "exception_messages" => - "No matching order found in WorldPay to refund." . - " Please visit your WorldPay merchant" - . "interface and refund the order manually.", - "exception_module_messages" => ""], - $index . '_18' => ["exception_code" => "CCAM18", - "exception_messages" => - "Something happened, please refresh" . - " the page and try again.", - "exception_module_messages" => ""], - $index . '_19' => ["exception_code" => "CCAM19", - "exception_messages" => "Authentication Failed", - "exception_module_messages" => ""], - $index . '_20' => ["exception_code" => "CCAM20", - "exception_messages" => - "Invalid Payment Details." . - " Please Refresh and check again", - "exception_module_messages" => ""], - $index . '_21' => ["exception_code" => "CCAM21", - "exception_messages" => - "Maximum number of updates for this token exceeded", - "exception_module_messages" => ""], - $index . '_22' => ["exception_code" => "CCAM22", - "exception_messages" => - "Please select one of the options", - "exception_module_messages" => ""], - $index . '_23' => ["exception_code" => "CCAM23", - "exception_messages" => - "Error: Please, Enter CVV", - "exception_module_messages" => ""], - $index . '_24' => ["exception_code" => "GCCAM0", - "exception_messages" => - "Required parameter \"worldpay_cc\" for" . - " \"payment_method\" is missing.", - "exception_module_messages" => ""], - $index . '_25' => ["exception_code" => "GCCAM1", - "exception_messages" => - "Required parameter \"cc_name\" for" . - " \"worldpay_cc\" is missing.", - "exception_module_messages" => ""], - $index . '_26' => ["exception_code" => "GCCAM2", - "exception_messages" => - "Required parameter \"cc_number\" for" . - " \"worldpay_cc\" is missing.", - "exception_module_messages" => ""], - $index . '_27' => ["exception_code" => "GCCAM3", - "exception_messages" => - "Required parameter \"cc_exp_month\" for" . - " \"worldpay_cc\" is missing.", - "exception_module_messages" => ""], - $index . '_28' => ["exception_code" => "GCCAM4", - "exception_messages" => "invalid expiry month", - "exception_module_messages" => ""], - $index . '_29' => ["exception_code" => "GCCAM5", - "exception_messages" => - "Required parameter \"cc_exp_year\" for" . - " \"worldpay_cc\" is missing.", - "exception_module_messages" => ""], - $index . '_30' => ["exception_code" => "GCCAM6", - "exception_messages" => "invalid expiry year", - "exception_module_messages" => ""], - $index . '_31' => ["exception_code" => "GCCAM7", - "exception_messages" => "invalid expiry date", - "exception_module_messages" => ""], - $index . '_32' => ["exception_code" => "GCCAM8", - "exception_messages" => - "Required parameter \"cvc\" for" . - " \"worldpay_cc\" is missing.", - "exception_module_messages" => ""], - $index . '_33' => ["exception_code" => "GCCAM9", - "exception_messages" => - "Required parameter \"save_card\" for" . - " \"worldpay_cc\" is missing.", - "exception_module_messages" => ""], - $index . '_34' => ["exception_code" => "GCCAM10", - "exception_messages" => - "Invalid Data passed for AccessCheckout(WebSDK) integration. Please refer user guide for configuration for WebSDK", - "exception_module_messages" => ""] - ]; - $exceptionCodes = $this->convertArrayToString($exceptionValues); - $configData = [ - 'section' => 'worldpay_exceptions', - 'website' => null, - 'store' => null, - 'groups' => [ - 'ccexceptions' => [ - 'fields' => [ - 'cc_exception' => [ - 'value' => $exceptionCodes - ], - ], - ], - ], - ]; - /** @var \Magento\Config\Model\Config $configModel */ - $configModel = $this->configFactory->create(['data' => $configData]); - $configModel->save(); - } - - if (version_compare($context->getVersion(), '1.2.4', '<')) { - $index = time(); - $exceptionValues = [$index . '_0' => ["exception_code" => "MCAM0", - "exception_messages" => "Please verify the Billing Address" - . " in your Address Book before adding new card!", - "exception_module_messages" => ""], - $index . '_1' => ["exception_code" => "MCAM1", - "exception_messages" => - "Token doesnot exist anymore, Please delete the card.", - "exception_module_messages" => ""], - $index . '_2' => ["exception_code" => "MCAM2", - "exception_messages" => "The card has been updated.", - "exception_module_messages" => ""], - $index . '_3' => ["exception_code" => "MCAM3", - "exception_messages" => - "Duplicate Entry, This card number is already saved", - "exception_module_messages" => ""], - $index . '_4' => ["exception_code" => "MCAM4", - "exception_messages" => - "Entered card number does not match " . - "with the selected card type", - "exception_module_messages" => ""], - $index . '_5' => ["exception_code" => "MCAM5", - "exception_messages" => - "Please, Enter 3 digit valid Card Verification Number", - "exception_module_messages" => ""], - $index . '_6' => ["exception_code" => "MCAM6", - "exception_messages" => "Item is deleted successfully", - "exception_module_messages" => ""], - $index . '_7' => ["exception_code" => "MCAM9", - "exception_messages" => - "There appears to be an issue with your stored data," . - " please review in your account and update details as applicable.", - "exception_module_messages" => ""], - $index . '_8' => ["exception_code" => "MCAM10", - "exception_messages" => "Please select the card type", - "exception_module_messages" => ""], - $index . '_9' => ["exception_code" => "MCAM11", - "exception_messages" => - "You already appear to have this card number stored," - . " we have updated your saved card details with " . - "the new data, you can verify this from my " . - "saved cards section in my account dashboard", - "exception_module_messages" => ""], - $index . '_10' => ["exception_code" => "MCAM12", - "exception_messages" => "Please, " - . "Enter 4 digit valid Card Verification Number", - "exception_module_messages" => ""], - $index . '_11' => ["exception_code" => "MCAM13", - "exception_messages" => - "You already appear to have this card number stored, " . - "if your card details have changed, " . - "you can update these via the my cards section.", - "exception_module_messages" => ""], - $index . '_12' => ["exception_code" => "MCAM14", - "exception_messages" => "Your card could not be saved", - "exception_module_messages" => ""], - $index . '_13' => ["exception_code" => "GMCAM0", - "exception_messages" => - "The current customer is not authorized.", - "exception_module_messages" => ""], - $index . '_14' => ["exception_code" => "GMCAM1", - "exception_messages" => - "id is missing from request. Please specify the id.", - "exception_module_messages" => ""], - $index . '_15' => ["exception_code" => "GMCAM2", - "exception_messages" => - "tokenid is missing from request. " . - "Please specify the tokenid.", - "exception_module_messages" => ""], - $index . '_16' => ["exception_code" => "GMCAM3", - "exception_messages" => - "tokenid supplied does not exist. " . - "Please verify the tokenid.", - "exception_module_messages" => ""], - $index . '_17' => ["exception_code" => "GMCAM4", - "exception_messages" => - "Token data supplied does not exist for current customer", - "exception_module_messages" => ""], - $index . '_18' => ["exception_code" => "GMCAM5", - "exception_messages" => - "Please try after some time", - "exception_module_messages" => ""], - $index . '_19' => ["exception_code" => "GMCAM6", - "exception_messages" => - "The current customer is not authorized.", - "exception_module_messages" => ""], - $index . '_20' => ["exception_code" => "GMCAM7", - "exception_messages" => - "The current customer is not authorized.", - "exception_module_messages" => ""], - $index . '_21' => ["exception_code" => "GMCAM8", - "exception_messages" => - "id is missing from request. Please specify the id.", - "exception_module_messages" => ""], - $index . '_22' => ["exception_code" => "GMCAM9", - "exception_messages" => - "tokenid is missing from request. " . - "Please specify the tokenid", - "exception_module_messages" => ""], - $index . '_23' => ["exception_code" => "GMCAM10", - "exception_messages" => - "cardholdername is missing from request. " . - "Please specify the cardholdername", - "exception_module_messages" => ""], - $index . '_24' => ["exception_code" => "GMCAM11", - "exception_messages" => - "cardexpirymonth is missing from request. " . - "Please specify the cardexpirymonth", - "exception_module_messages" => ""], - $index . '_25' => ["exception_code" => "GMCAM12", - "exception_messages" => "invalid expiry month", - "exception_module_messages" => ""], - $index . '_26' => ["exception_code" => "GMCAM13", - "exception_messages" => - "cardexpiryyear is missing from request. " . - "Please specify the cardexpiryyear", - "exception_module_messages" => ""], - $index . '_27' => ["exception_code" => "GMCAM14", - "exception_messages" => "invalid expiry year", - "exception_module_messages" => ""], - $index . '_28' => ["exception_code" => "GMCAM15", - "exception_messages" => "invalid expiry date", - "exception_module_messages" => ""], - $index . '_29' => ["exception_code" => "GMCAM16", - "exception_messages" => - "tokenid supplied does not exist. Please verify the tokenid", - "exception_module_messages" => ""], - $index . '_30' => ["exception_code" => "GMCAM17", - "exception_messages" => - "Token data supplied does not exist for current customer", - "exception_module_messages" => ""] - ]; - - $exceptionCodes = $this->convertArrayToString($exceptionValues); - $configData = [ - 'section' => 'worldpay_exceptions', - 'website' => null, - 'store' => null, - 'groups' => [ - 'my_account_alert_codes' => [ - 'fields' => [ - 'response_codes' => [ - 'value' => $exceptionCodes - ], - ], - ], - ], - ]; - /** @var \Magento\Config\Model\Config $configModel */ - $configModel = $this->configFactory->create(['data' => $configData]); - $configModel->save(); - } - - if (version_compare($context->getVersion(), '1.2.4', '<')) { - $index = time(); - $exceptionValues = [$index . '_0' => ["exception_code" => "ACAM12", - "exception_messages" => - "Error Code %s already exist!", - "exception_module_messages" => ""], - $index . '_1' => ["exception_code" => "ACAM13", - "exception_messages" => - "Detected only whitespace character for code", - "exception_module_messages" => ""], - $index . '_2' => ["exception_code" => "ACAM3", - "exception_messages" => "Payment synchronized successfully!!", - "exception_module_messages" => ""], - $index . '_3' => ["exception_code" => "ACAM4", - "exception_messages" => "Synchronising Payment Status failed", - "exception_module_messages" => ""] - ]; - - $exceptionCodes = $this->convertArrayToString($exceptionValues); - $configData = [ - 'section' => 'worldpay_exceptions', - 'website' => null, - 'store' => null, - 'groups' => [ - 'adminexceptions' => [ - 'fields' => [ - 'general_exception' => [ - 'value' => $exceptionCodes - ], - ], - ], - ], - ]; - /** @var \Magento\Config\Model\Config $configModel */ - $configModel = $this->configFactory->create(['data' => $configData]); - $configModel->save(); - } - - /* Labels*/ - if (version_compare($context->getVersion(), '1.2.5', '<')) { - $index = time(); - $labelvalues = [ $index.'_0' => ["wpay_label_code" => "CO1", - "wpay_label_desc" => "New Card", - "wpay_custom_label" => ""], - $index.'_1' => ["wpay_label_code" => "CO2", - "wpay_label_desc" => "We Accept", - "wpay_custom_label" => ""], - $index.'_2' => ["wpay_label_code" => "CO3", - "wpay_label_desc" => "Card Number", - "wpay_custom_label" => ""], - $index.'_3' => ["wpay_label_code" => "CO4", - "wpay_label_desc" => "Card Holder Name", - "wpay_custom_label" => ""], - $index.'_4' => ["wpay_label_code" => "CO5", - "wpay_label_desc" => "CVV", - "wpay_custom_label" => ""], - $index.'_5' => ["wpay_label_code" => "CO6", - "wpay_label_desc" => "Month", - "wpay_custom_label" => ""], - $index.'_6' => ["wpay_label_code" => "CO7", - "wpay_label_desc" => "Year", - "wpay_custom_label" => ""], - $index.'_7' => ["wpay_label_code" => "CO8", - "wpay_label_desc" => "Save This Card", - "wpay_custom_label" => ""], - $index.'_8' => ["wpay_label_code" => "CO9", - "wpay_label_desc" => "Important Disclaimer!", - "wpay_custom_label" => ""], - $index.'_9' => ["wpay_label_code" => "CO10", - "wpay_label_desc" => "Pay Now", - "wpay_custom_label" => ""], - $index.'_10' => ["wpay_label_code" => "CO11", - "wpay_label_desc" => "MM/YY", - "wpay_custom_label" => ""], - $index.'_11' => ["wpay_label_code" => "CO12", - "wpay_label_desc" => "Saved cards", - "wpay_custom_label" => ""], - $index.'_12' => ["wpay_label_code" => "CO13", - "wpay_label_desc" => "Use Saved Card", - "wpay_custom_label" => ""], - $index.'_13' => ["wpay_label_code" => "CO14", - "wpay_label_desc" => "Place Order", - "wpay_custom_label" => ""], - $index.'_14' => ["wpay_label_code" => "CO15", - "wpay_label_desc" => "Saved Card feature will be " - . "available only if enabled by Merchant.", - "wpay_custom_label" => ""], - $index.'_15' => ["wpay_label_code" => "CO16", - "wpay_label_desc" => "Card Verification Number", - "wpay_custom_label" => ""], - $index.'_16' => ["wpay_label_code" => "CO17", - "wpay_label_desc" => "Disclaimer!", - "wpay_custom_label" => ""], - ]; - $labelcodes = $this->convertArrayToStringForLabels($labelvalues); - $configData = [ - 'section' => 'worldpay_custom_labels', - 'website' => null, - 'store' => null, - 'groups' => [ - 'checkout_labels' => [ - 'fields' => [ - 'checkout_label' => [ - 'value' => $labelcodes - ], - ], - ], - ], - ]; - /** @var \Magento\Config\Model\Config $configModel */ - $configModel = $this->configFactory->create(['data' => $configData]); - $configModel->save(); - } - - if (version_compare($context->getVersion(), '1.2.5', '<')) { - $index = time(); - $labelvalues = [ $index.'_0' => ["wpay_label_code" => "AC1", - "wpay_label_desc" => "Card Holder Name", - "wpay_custom_label" => ""], - $index.'_1' => ["wpay_label_code" => "AC2", - "wpay_label_desc" => "Card Brand", - "wpay_custom_label" => ""], - $index.'_2' => ["wpay_label_code" => "AC3", - "wpay_label_desc" => "Card Number", - "wpay_custom_label" => ""], - $index.'_3' => ["wpay_label_code" => "AC4", - "wpay_label_desc" => "Card Expiry Month", - "wpay_custom_label" => ""], - $index.'_4' => ["wpay_label_code" => "AC5", - "wpay_label_desc" => "Card Expiry Year", - "wpay_custom_label" => ""], - $index.'_5' => ["wpay_label_code" => "AC6", - "wpay_label_desc" => "Update", - "wpay_custom_label" => ""], - $index.'_6' => ["wpay_label_code" => "AC7", - "wpay_label_desc" => "Update Saved Card", - "wpay_custom_label" => ""], - $index.'_7' => ["wpay_label_code" => "AC8", - "wpay_label_desc" => "Card Information", - "wpay_custom_label" => ""], - $index.'_8' => ["wpay_label_code" => "AC9", - "wpay_label_desc" => "Expiry Month/Year", - "wpay_custom_label" => ""], - $index.'_9' => ["wpay_label_code" => "AC10", - "wpay_label_desc" => "Delete", - "wpay_custom_label" => ""], - $index.'_10' => ["wpay_label_code" => "AC11", - "wpay_label_desc" => "Add New Card", - "wpay_custom_label" => ""], - $index.'_11' => ["wpay_label_code" => "AC12", - "wpay_label_desc" => "Credit Card Type", - "wpay_custom_label" => ""], - $index.'_12' => ["wpay_label_code" => "AC13", - "wpay_label_desc" => "Save", - "wpay_custom_label" => ""], - $index.'_13' => ["wpay_label_code" => "AC14", - "wpay_label_desc" => "My Saved Card", - "wpay_custom_label" => ""], - $index.'_14' => ["wpay_label_code" => "AC15", - "wpay_label_desc" => "Important Disclaimer!", - "wpay_custom_label" => ""], - $index.'_15' => ["wpay_label_code" => "AC16", - "wpay_label_desc" => "Disclaimer!", - "wpay_custom_label" => ""], - $index.'_16' => ["wpay_label_code" => "AC17", - "wpay_label_desc" => "CVV", - "wpay_custom_label" => ""], - $index.'_17' => ["wpay_label_code" => "AC18", - "wpay_label_desc" => "Default Billing Address", - "wpay_custom_label" => ""], - $index.'_18' => ["wpay_label_code" => "AC19", - "wpay_label_desc" => "You have no Saved Card.", - "wpay_custom_label" => ""] - ]; - $labelcodes = $this->convertArrayToStringForLabels($labelvalues); - $configData = [ - 'section' => 'worldpay_custom_labels', - 'website' => null, - 'store' => null, - 'groups' => [ - 'my_account_labels' => [ - 'fields' => [ - 'my_account_label' => [ - 'value' => $labelcodes - ], - ], - ], - ], - ]; - /** @var \Magento\Config\Model\Config $configModel */ - $configModel = $this->configFactory->create(['data' => $configData]); - $configModel->save(); - } - } - - public function convertArrayToString($exceptionValues) - { - $resultArray = []; - foreach ($exceptionValues as $row) { - $payment_type = $row['exception_code']; - $rs['exception_messages'] = $row['exception_messages']; - $rs['exception_module_messages'] = $row['exception_module_messages']; - $resultArray[$payment_type] = $rs; - } - return $this->serializer->serialize($resultArray); - } - - public function convertArrayToStringForLabels($exceptionValues) - { - $resultArray = []; - foreach ($exceptionValues as $row) { - $payment_type = $row['wpay_label_code']; - $rs['wpay_label_desc'] = $row['wpay_label_desc']; - $rs['wpay_custom_label'] = $row['wpay_custom_label']; - $resultArray[$payment_type] = $rs; - } - return $this->serializer->serialize($resultArray); - } -} diff --git a/Setup/UpgradeSchema.php b/Setup/UpgradeSchema.php deleted file mode 100644 index 2f9bc85..0000000 --- a/Setup/UpgradeSchema.php +++ /dev/null @@ -1,434 +0,0 @@ -startSetup(); - if (version_compare($context->getVersion(), '1.1.0', '<')) { - $table = $installer->getConnection()->newTable( - $installer->getTable(self::WORLDPAY_NOTIFICATION_HISTORY) - ) - ->addColumn( - 'id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - [ - 'identity' => true, - 'nullable' => false, - 'primary' => true, - 'unsigned' => true, - ], - 'Id' - ) - ->addColumn( - 'order_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - ['nullable' => false, - 'unsigned' => true], - 'Order Id' - ) - ->addColumn( - 'status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Status' - ) - ->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], - 'Created At' - ) - ->addIndex( - $installer->getIdxName(self::WORLDPAY_NOTIFICATION_HISTORY, ['order_id']), - ['order_id'] - ) - ->setComment('AccessWorldpay Notification History') - ->setOption('type', 'InnoDB') - ->setOption('charset', 'utf8'); - $installer->getConnection()->createTable($table); - } - - $setup->getConnection()->changeColumn( - $setup->getTable(self::WORLDPAY_NOTIFICATION_HISTORY), - 'order_id', - 'order_id', - [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 'length' => 255, - 'comment' => 'AccessWorldpay order id' - ] - ); - if (version_compare($context->getVersion(), '1.2.0', '<')) { - $this->addColumnWP($installer); - } - if (version_compare($context->getVersion(), '1.2.1', '<')) { - $this->createOmsParametersTable($installer); - } - if (version_compare($context->getVersion(), '1.2.2', '<')) { - $this->createPartialSettlementsTable($installer); - } - /* Add Disclaimer */ - if (version_compare($context->getVersion(), '1.2.2', '<')) { - $this->addColumnDisclaimer($installer); - } - /* Add Card Brand */ - if (version_compare($context->getVersion(), '1.2.3', '<')) { - $this->addColumnCardBrand($installer); - } - /* Add CardOnFileAuthLink */ - if (version_compare($context->getVersion(), '1.2.4', '<')) { - $this->addColumnCardOnFileAuthLink($installer); - } - $installer->endSetup(); - } - - /** - * @param SchemaSetupInterface $installer - * @return void - */ - private function addColumnWP(SchemaSetupInterface $installer) - { - $connection = $installer->getConnection(); - $connection->addColumn( - $installer->getTable(self::WORLDPAY_PAYMENT), - 'aav_address_result_code', - [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 'nullable' => true, - 'length' => '25', - 'comment' => 'AAV Address Result Code', - 'after' => 'risk_provider_final' - ] - ); - - $connection->addColumn( - $installer->getTable(self::WORLDPAY_PAYMENT), - 'avv_postcode_result_code', - [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 'nullable' => true, - 'length' => '25', - 'comment' => 'AAV Postcode Result Code', - 'after' => 'aav_address_result_code' - ] - ); - - $connection->addColumn( - $installer->getTable(self::WORLDPAY_PAYMENT), - 'aav_cardholder_name_result_code', - [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 'nullable' => true, - 'length' => '25', - 'comment' => 'AAV Cardholder Name Result Code', - 'after' => 'avv_postcode_result_code' - ] - ); - - $connection->addColumn( - $installer->getTable(self::WORLDPAY_PAYMENT), - 'aav_telephone_result_code', - [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 'nullable' => true, - 'length' => '25', - 'comment' => 'AAV Telephone Result Code', - 'after' => 'aav_cardholder_name_result_code' - ] - ); - $connection->addColumn( - $installer->getTable(self::WORLDPAY_PAYMENT), - 'aav_email_result_code', - [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 'nullable' => true, - 'length' => '25', - 'comment' => 'AAV Email Result Code', - 'after' => 'aav_telephone_result_code' - ] - ); - - $connection->addColumn( - $installer->getTable(self::WORLDPAY_PAYMENT), - 'interaction_type', - [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 'nullable' => true, - 'length' => '25', - 'comment' => 'Interaction Type', - 'after' => 'aav_email_result_code' - ] - ); - } - - /** - * Create OMS Parameters table - * - * @param SchemaSetupInterface $setup - * @return $this - */ - private function createOmsParametersTable(SchemaSetupInterface $setup) - { - $installer = $setup; - - /** - * Create table 'awp_oms_params' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable(self::AWP_OMS_PARAMS) - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 10, - ['identity' => true, 'nullable' => false, 'unsigned' => true, 'primary' => true], - 'Entity ID' - )->addColumn( - 'order_increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 40, - [], - 'Order Id' - )->addColumn( - 'awp_order_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '40', - [], - 'AWP Order Code' - )->addColumn( - 'awp_payment_status', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - [], - 'Payment Status' - )->addColumn( - 'awp_cancel_param', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3000, - [], - 'Payment Cancel Parameter' - )->addColumn( - 'awp_settle_param', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3000, - [], - 'Payment Settle Parameter' - )->addColumn( - 'awp_partial_settle_param', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3000, - [], - 'Payment Partial Settle Parameter' - )->addColumn( - 'awp_events_param', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3000, - [], - 'Payment Events Parameter' - )->addColumn( - 'awp_refund_param', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3000, - [], - 'Payment Refund Parameter' - )->addColumn( - 'awp_partial_refund_param', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3000, - [], - 'Payment Partial Refund Parameter' - )->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], - 'Created At' - )->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE], - 'Updated At' - )->setComment( - 'AccessWorldpay OMS Params' - ); - $installer->getConnection()->createTable($table); - - return $this; - } - - /** - * Create OMS Parameters table - * - * @param SchemaSetupInterface $setup - * @return $this - */ - private function createPartialSettlementsTable(SchemaSetupInterface $setup) - { - $installer = $setup; - - /** - * Create table 'awp_oms_partial_settlements' - */ - $table = $installer->getConnection()->newTable( - $installer->getTable(self::AWP_OMS_PARTIAL_SETTLEMENTS) - )->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 10, - ['identity' => true, 'nullable' => false, 'unsigned' => true, 'primary' => true], - 'Entity ID' - )->addColumn( - 'order_increment_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 40, - [], - 'Order Id' - )->addColumn( - 'order_invoice_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 40, - [], - 'Order Invoice Id' - )->addColumn( - 'order_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 40, - [], - 'Order Item Id' - )->addColumn( - 'awp_order_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '40', - [], - 'AWP Order Code' - )->addColumn( - 'awp_lineitem_cancel_param', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3000, - [], - 'Line Item Payment Cancel Parameter' - )->addColumn( - 'awp_lineitem_refund_param', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3000, - [], - 'Line Item Refund Parameter' - )->addColumn( - 'awp_lineitem_partial_refund_param', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3000, - [], - 'Line Item partial Refund Parameter' - )->addColumn( - 'awp_lineitem_partial_settle_param', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3000, - [], - 'Line Item Partial Settle Parameter' - )->addColumn( - 'awp_lineitem_events_param', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 3000, - [], - 'Line Item Payment Events Parameter' - )->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT], - 'Created At' - )->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - ['nullable' => false, 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE], - 'Updated At' - )->setComment( - 'AccessWorldpay OMS Partial Settlements' - ); - $installer->getConnection()->createTable($table); - - return $this; - } - - /** - * Add Disclaimer Flag - * @param SchemaSetupInterface $installer - * @return void - */ - private function addColumnDisclaimer(SchemaSetupInterface $installer) - { - $connection = $installer->getConnection(); - $connection->addColumn( - $installer->getTable(self::ACCESSWORLDPAY_VERIFIEDTOKEN), - 'disclaimer_flag', - [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_BOOLEAN, - 'nullable' => false, - 'comment' => 'Disclaimer Flag', - 'before' => 'created_at' - ] - ); - } - - /** - * Add CardBrand - * @param SchemaSetupInterface $installer - * @return void - */ - private function addColumnCardBrand(SchemaSetupInterface $installer) - { - $connection = $installer->getConnection(); - $connection->addColumn( - $installer->getTable(self::ACCESSWORLDPAY_VERIFIEDTOKEN), - 'card_brand', - [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 'nullable' => false, - 'comment' => 'card_brand', - 'after' => 'created_at' - ] - ); - } - - /** - * Add CardOnFileAuthLink - * @param SchemaSetupInterface $installer - * @return void - */ - private function addColumnCardOnFileAuthLink(SchemaSetupInterface $installer) - { - $connection = $installer->getConnection(); - $connection->addColumn( - $installer->getTable(self::ACCESSWORLDPAY_VERIFIEDTOKEN), - 'cardonfile_auth_link', - [ - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 'nullable' => false, - 'comment' => 'cardonfile_auth_link', - 'after' => 'created_at' - ] - ); - } -}