We will be off from 27/1 (Monday) to 31/1 (Friday) (GMT +7) for our Tet Holiday (Lunar New Year) in our country

Commit c6c22e74 authored by rikterbeek's avatar rikterbeek

initial commit

parent 8d3706d8
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Adyen\Payment\Block\Form;
class Cc extends \Magento\Payment\Block\Form
{
private $logger;
/**
* @var string
*/
protected $_template = 'Adyen_Payment::form/cc.phtml';
/**
* Payment config model
*
* @var \Magento\Payment\Model\Config
*/
protected $_paymentConfig;
/**
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Payment\Model\Config $paymentConfig
* @param array $data
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Payment\Model\Config $paymentConfig,
\Psr\Log\LoggerInterface $logger,
array $data = []
) {
parent::__construct($context, $data);
$this->_paymentConfig = $paymentConfig;
$this->logger = $logger;
$this->logger->critical("IN FORM PHP FILE");
}
/**
* Retrieve availables credit card types
*
* @return array
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
*/
public function getCcAvailableTypes()
{
$this->logger->critical("TEST");
$types = $this->_paymentConfig->getCcTypes();
if ($method = $this->getMethod()) {
$availableTypes = $method->getConfigData('cctypes');
if ($availableTypes) {
$availableTypes = explode(',', $availableTypes);
foreach ($types as $code => $name) {
if (!in_array($code, $availableTypes)) {
unset($types[$code]);
}
}
}
}
return $types;
}
/**
* Retrieve credit card expire months
*
* @return array
*/
public function getCcMonths()
{
$months = $this->getData('cc_months');
if ($months === null) {
$months[0] = __('Month');
$months = array_merge($months, $this->_paymentConfig->getMonths());
$this->setData('cc_months', $months);
}
return $months;
}
/**
* Retrieve credit card expire years
*
* @return array
*/
public function getCcYears()
{
$years = $this->getData('cc_years');
if ($years === null) {
$years = $this->_paymentConfig->getYears();
$years = [0 => __('Year')] + $years;
$this->setData('cc_years', $years);
}
return $years;
}
/**
* Retrieve has verification configuration
*
* @return bool
*/
public function hasVerification()
{
return true;
// if ($this->getMethod()) {
// $configData = $this->getMethod()->getConfigData('useccv');
// if ($configData === null) {
// return true;
// }
// return (bool)$configData;
// }
// return true;
}
/**
* Whether switch/solo card type available
*
* @return bool
*/
public function hasSsCardType()
{
$availableTypes = explode(',', $this->getMethod()->getConfigData('cctypes'));
$ssPresenations = array_intersect(['SS', 'SM', 'SO'], $availableTypes);
if ($availableTypes && count($ssPresenations) > 0) {
return true;
}
return false;
}
/**
* Solo/switch card start year
*
* @return array
*/
public function getSsStartYears()
{
$years = [];
$first = date("Y");
for ($index = 5; $index >= 0; $index--) {
$year = $first - $index;
$years[$year] = $year;
}
$years = [0 => __('Year')] + $years;
return $years;
}
/**
* Render block HTML
*
* @return string
*/
protected function _toHtml()
{
$this->_eventManager->dispatch('payment_form_block_to_html_before', ['block' => $this]);
return parent::_toHtml();
}
}
\ No newline at end of file
<?php
namespace Adyen\Payment\Block;
class Hello extends \Magento\Framework\View\Element\Template
{
public function _prepareLayout()
{
return parent::_prepareLayout();
}
}
\ No newline at end of file
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Adyen\Payment\Block\Info;
class Cc extends \Magento\Payment\Block\Info
{
/**
* @var string
*/
protected $_template = 'Adyen_Payment::info/cc.phtml';
/**
* @return string
*/
// public function toPdf()
// {
// $this->setTemplate('Magento_OfflinePayments::info/pdf/checkmo.phtml');
// return $this->toHtml();
// }
}
<?php
namespace Adyen\Payment\Controller\Index;
class Index extends \Magento\Framework\App\Action\Action
{
public function execute()
{
$this->_view->loadLayout();
$this->_view->getLayout()->initMessages();
$this->_view->renderLayout();
}
}
\ No newline at end of file
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Adyen\Payment\Helper;
use Magento\Framework\App\Helper\AbstractHelper;
/**
* @SuppressWarnings(PHPMD.LongVariable)
*/
class Data extends AbstractHelper
{
public function getRecurringTypes() {
return [
\Adyen\Payment\Model\RecurringType::ONECLICK => 'ONECLICK',
\Adyen\Payment\Model\RecurringType::ONECLICK_RECURRING => 'ONECLICK,RECURRING',
\Adyen\Payment\Model\RecurringType::RECURRING => 'RECURRING'
];
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: rikt
* Date: 6/16/15
* Time: 2:18 PM
*/
\ No newline at end of file
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Adyen\Payment\Model\Api;
class PaymentRequest extends \Magento\Framework\Object
{
protected $_scopeConfig;
protected $_code;
protected $_logger;
protected $_encryptor;
public function __construct(
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Psr\Log\LoggerInterface $logger,
\Magento\Framework\Encryption\EncryptorInterface $encryptor,
array $data = []
) {
$this->_scopeConfig = $scopeConfig;
$this->_logger = $logger;
$this->_encryptor = $encryptor;
$this->_code = "adyen_cc";
}
/**
* Retrieve information from payment configuration
*
* @param string $field
* @param int|string|null|\Magento\Store\Model\Store $storeId
*
* @return mixed
*/
public function getConfigData($field, $storeId = null)
{
if (null === $storeId) {
$storeId = $this->getStore();
}
$path = 'payment/' . $this->_code . '/' . $field;
return $this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId);
}
public function fullApiRequest($merchantAccount, $payment)
{
$order = $payment->getOrder();
if($order) {
$this->_logger->critical("TEST5!!:" . print_r($order->getIncrementId(), true));
}
$this->_logger->critical("CLASS OBJECT:" . get_class($payment));
$request = array(
"action" => "Payment.authorise",
"paymentRequest.merchantAccount" => $merchantAccount,
"paymentRequest.amount.currency" => "EUR",
"paymentRequest.amount.value" => "199",
"paymentRequest.reference" => "TEST-PAYMENT-" . date("Y-m-d-H:i:s"),
"paymentRequest.shopperIP" => "ShopperIPAddress",
"paymentRequest.shopperEmail" => "TheShopperEmailAddress",
"paymentRequest.shopperReference" => "YourReference",
"paymentRequest.fraudOffset" => "0",
"paymentRequest.card.billingAddress.street" => "Simon Carmiggeltstraat",
"paymentRequest.card.billingAddress.postalCode" => "1011 DJ",
"paymentRequest.card.billingAddress.city" => "Amsterdam",
"paymentRequest.card.billingAddress.houseNumberOrName" => "6-50",
"paymentRequest.card.billingAddress.stateOrProvince" => "",
"paymentRequest.card.billingAddress.country" => "NL",
"paymentRequest.card.expiryMonth" => $payment->getCcExpMonth(),
"paymentRequest.card.expiryYear" => $payment->getCcExpYear(),
"paymentRequest.card.holderName" => $payment->getCcOwner(),
"paymentRequest.card.number" => $payment->getCcNumber(),
"paymentRequest.card.cvc" => $payment->getCcCid(),
);
$this->_logger->critical("fullApiRequest");
$this->_logger->critical(print_r($request, true));
return $this->_apiRequest($request);
}
protected function _apiRequest($request) {
$webserviceUsername = $this->getConfigData("webservice_username");
$webservicePassword = $this->decryptPassword($this->getConfigData("webservice_password")); // DECODE!!
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://pal-test.adyen.com/pal/adapter/httppost");
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC );
curl_setopt($ch, CURLOPT_USERPWD, $webserviceUsername.":".$webservicePassword);
curl_setopt($ch, CURLOPT_POST,count($request));
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($request));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$results = curl_exec($ch);
$httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($httpStatus != 200) {
throw new \Magento\Framework\Exception\LocalizedException(__('HTTP Status code' . $httpStatus . " " . $webserviceUsername . ":" . $webservicePassword));
}
if ($results === false) {
throw new \Magento\Framework\Exception\LocalizedException(__('HTTP Status code' . $results));
}
throw new \Magento\Framework\Exception\LocalizedException(__('HTTP Status code' . print_r($results, true)));
parse_str($results,$results);
curl_close($ch);
return $results;
}
/**
* Decrypt password
*
* @param string $password
* @return string
*/
public function decryptPassword($password)
{
return $this->_encryptor->decrypt($password);
}
}
\ No newline at end of file
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* Order Statuses source model
*/
namespace Adyen\Payment\Model\Config\Source;
class RecurringType implements \Magento\Framework\Option\ArrayInterface
{
const UNDEFINED_OPTION_LABEL = 'NONE';
/**
* @var \Magento\Sales\Model\Order\Config
*/
protected $_orderConfig;
protected $_adyenHelper;
/**
* @param \Magento\Sales\Model\Order\Config $orderConfig
*/
public function __construct(
\Magento\Sales\Model\Order\Config $orderConfig,
\Adyen\Payment\Helper\Data $adyenHelper
)
{
$this->_orderConfig = $orderConfig;
$this->_adyenHelper = $adyenHelper;
}
/**
* @return array
*/
public function toOptionArray()
{
$recurringTypes = $this->_adyenHelper->getRecurringTypes();
$options = [['value' => '', 'label' => __(self::UNDEFINED_OPTION_LABEL)]];
foreach ($recurringTypes as $code => $label) {
$options[] = ['value' => $code, 'label' => $label];
}
return $options;
}
}
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Adyen\Payment\Model\Method;
/**
* @method \Magento\Quote\Api\Data\PaymentMethodExtensionInterface getExtensionAttributes()
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Cc extends \Magento\Payment\Model\Method\Cc
{
const METHOD_CODE = 'adyen_cc';
/**
* Payment Method feature
*
* @var bool
*/
protected $_canAuthorize = true;
protected $_canCapture = true;
protected $_canCapturePartial = true;
protected $_canCaptureOnce = true;
protected $_canRefund = true;
protected $_canRefundInvoicePartial = true;
/**
* @var string
*/
protected $_code = self::METHOD_CODE;
/**
* @var string
*/
protected $_formBlockType = 'Adyen\Payment\Block\Form\Cc';
//
// /**
// * @var string
// */
// protected $_infoBlockType = 'Adyen\Payment\Block\Info\Cc';
protected $_paymentRequest;
/**
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory
* @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory
* @param \Magento\Payment\Helper\Data $paymentData
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Magento\Framework\Module\ModuleListInterface $moduleList
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
* @param \Magento\Framework\Model\Resource\AbstractResource $resource
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
* @param array $data
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
\Adyen\Payment\Model\Api\PaymentRequest $paymentRequest,
\Magento\Framework\Model\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
\Magento\Framework\Api\AttributeValueFactory $customAttributeFactory,
\Magento\Payment\Helper\Data $paymentData,
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Magento\Payment\Model\Method\Logger $logger,
\Magento\Framework\Module\ModuleListInterface $moduleList,
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate,
\Magento\Framework\Model\Resource\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = []
) {
parent::__construct(
$context,
$registry,
$extensionFactory,
$customAttributeFactory,
$paymentData,
$scopeConfig,
$logger,
$moduleList,
$localeDate,
$resource,
$resourceCollection,
$data
);
$this->_paymentRequest = $paymentRequest;
}
public function isActive($storeId = null)
{
return true;
}
public function isAvailable($quote = null)
{
$this->_logger->critical("IS AVAILABLE!! IS TRUE");
return true;
}
/**
* Assign data to info model instance
*
* @param \Magento\Framework\Object|mixed $data
* @return $this
*/
public function assignData($data)
{
print_r($data);die();
}
public function validate()
{
$this->_logger->critical("TEST in validate FUNTION !!:");
return true;
}
public function authorize(\Magento\Payment\Model\InfoInterface $payment, $amount)
{
$this->_logger->critical("TEST in authorize FUNTION !!:");
if (!$this->canAuthorize()) {
throw new \Magento\Framework\Exception\LocalizedException(__('The authorize action is not available.'));
}
// DO authorisation
$this->_processRequest($payment, $amount, "authorise");
return $this;
}
/**
* Get config payment action url
* Used to universalize payment actions when processing payment place
*
* @return string
* @api
*/
public function getConfigPaymentAction()
{
// return $this->getConfigData('payment_action');
$this->_logger->critical("TEST getConfigPaymentAction !!:");
return \Magento\Payment\Model\Method\AbstractMethod::ACTION_AUTHORIZE;
}
protected function _processRequest(\Magento\Framework\Object $payment, $amount, $request) {
$merchantAccount = $this->getConfigData('merchant_account');
$recurringType = $this->getConfigData('recurring_type');
$enableMoto = $this->getConfigData('enable_moto');
switch ($request) {
case "authorise":
$response = $this->_paymentRequest->fullApiRequest($merchantAccount, $payment);
break;
}
if (!empty($response)) {
print_r($response);die();
// $this->_processResponse($payment, $response, $request);
} else {
throw new \Magento\Framework\Exception\LocalizedException(__('Empty result.'));
}
}
// does not seem to work.
public function hasVerification() {
return true;
}
}
\ No newline at end of file
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Adyen\Payment\Model\Method;
use Magento\Framework\Object;
use Magento\Payment\Model\Method\ConfigInterface;
use Magento\Payment\Model\Method\Online\GatewayInterface;
/**
* @method \Magento\Quote\Api\Data\PaymentMethodExtensionInterface getExtensionAttributes()
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Hpp extends \Magento\Payment\Model\Method\AbstractMethod implements GatewayInterface
{
const METHOD_CODE = 'adyen_hpp';
/**
* @var string
*/
protected $_code = self::METHOD_CODE;
/**
* Payment Method feature
*
* @var bool
*/
protected $_isGateway = true;
protected $_canAuthorize = true;
protected $_isInitializeNeeded = true;
public function initialize($paymentAction, $stateObject)
{
$this->_logger->critical("initialize FROPM HPP Payment action is:". $paymentAction);
$requestType = null;
switch ($paymentAction) {
case self::ACTION_AUTHORIZE:
$requestType = self::REQUEST_TYPE_AUTH_ONLY;
//intentional
case self::ACTION_AUTHORIZE_CAPTURE:
// $requestType = $requestType ?: self::REQUEST_TYPE_AUTH_CAPTURE;
$payment = $this->getInfoInstance();
$order = $payment->getOrder();
$order->setCanSendNewEmailFlag(false);
$payment->setBaseAmountAuthorized($order->getBaseTotalDue());
$payment->setAmountAuthorized($order->getTotalDue());
// $payment->setAnetTransType($requestType);
break;
default:
break;
}
// magento 1.x code from our plugin
// $state = Mage_Sales_Model_Order::STATE_NEW;
// $stateObject->setState($state);
// $stateObject->setStatus($this->_getConfigData('order_status'));
}
/**
* Get config payment action url
* Used to universalize payment actions when processing payment place
*
* @return string
* @api
*/
// public function getConfigPaymentAction()
// {
// // IMPORTANT need to set authorize_capture in config as well
// $this->_logger->critical("TEST getConfigPaymentAction FROM HPP!!:");
// return \Magento\Payment\Model\Method\AbstractMethod::ACTION_AUTHORIZE_CAPTURE;
// }
/**
* Checkout order place redirect URL getter
*
* @return string
*/
public function getOrderPlaceRedirectUrl()
{
$this->_logger->critical("getOrderPlaceRedirectUrl");
$method = $this->getMethodInstance();
if ($method) {
$this->_logger->critical("getOrderPlaceRedirectUrl url is:" . $method->getConfigData('order_place_redirect_url'));
return $method->getConfigData('order_place_redirect_url');
} else {
$this->_logger->critical("ELSE:");
return "http://www.google.com/";
}
return '';
}
/**
* Post request to gateway and return response
*
* @param Object $request
* @param ConfigInterface $config
*
* @return Object
*
* @throws \Exception
*/
public function postRequest(Object $request, ConfigInterface $config)
{
$this->_logger->critical("postRequest");
// TODO: Implement postRequest() method.
}
}
\ No newline at end of file
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Adyen\Payment\Model\Method;
/**
* Class Checkmo
*
* @method \Magento\Quote\Api\Data\PaymentMethodExtensionInterface getExtensionAttributes()
*/
class Test extends \Magento\Payment\Model\Method\AbstractMethod
{
const PAYMENT_METHOD_CHECKMO_CODE = 'test';
/**
* Payment method code
*
* @var string
*/
protected $_code = self::PAYMENT_METHOD_CHECKMO_CODE;
/**
* @var string
*/
protected $_formBlockType = 'Magento\OfflinePayments\Block\Form\Checkmo';
/**
* @var string
*/
protected $_infoBlockType = 'Magento\OfflinePayments\Block\Info\Checkmo';
/**
* Availability option
*
* @var bool
*/
protected $_isOffline = true;
/**
* @return string
*/
public function getPayableTo()
{
return $this->getConfigData('payable_to');
}
/**
* @return string
*/
public function getMailingAddress()
{
return $this->getConfigData('mailing_address');
}
}
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Adyen\Payment\Model;
class RecurringType {
CONST NONE = '';
const ONECLICK = 'ONECLICK';
const ONECLICK_RECURRING = 'ONECLICK_RECURRING';
const RECURRING = 'RECURRING';
}
\ No newline at end of file
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Magento/Config/etc/system_file.xsd">
<system>
<section id="payment" translate="label" type="text" sortOrder="400" showInDefault="1" showInWebsite="1" showInStore="1">
<group id="adyen_cc" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Adyen</label>
<field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Enabled</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="title" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Title</label>
</field>
<field id="merchant_account" translate="label" type="text" sortOrder="15" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Merchant Account</label>
</field>
<field id="webservice_username" translate="label" type="text" sortOrder="16" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Webservice username</label>
</field>
<field id="webservice_password" translate="label" type="obscure" sortOrder="17" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Webservice Password</label>
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
</field>
<field id="order_status" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0">
<label>New Order Status</label>
<source_model>Magento\Sales\Model\Config\Source\Order\Status\NewStatus</source_model>
</field>
<field id="recurring_type" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Recurring Type</label>
<source_model>Adyen\Payment\Model\Config\Source\RecurringType</source_model>
</field>
<field id="enable_moto" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Enable MOTO for backend orders</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="sort_order" translate="label" type="text" sortOrder="190" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Sort Order</label>
<frontend_class>validate-number</frontend_class>
</field>
<field id="allowspecific" translate="label" type="allowspecific" sortOrder="200" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Payment from Applicable Countries</label>
<source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model>
</field>
<field id="specificcountry" translate="label" type="multiselect" sortOrder="201" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Payment from Specific Countries</label>
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
<can_be_empty>1</can_be_empty>
</field>
<field id="model"></field>
</group>
<group id="adyen_hpp" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Adyen</label>
<field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Enabled</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="title" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Title</label>
</field>
</group>
<group id="test" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Test</label>
<field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Enabled</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="order_status" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0">
<label>New Order Status</label>
<source_model>Magento\Sales\Model\Config\Source\Order\Status\NewStatus</source_model>
</field>
<field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Sort Order</label>
<frontend_class>validate-number</frontend_class>
</field>
<field id="title" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Title</label>
</field>
<field id="allowspecific" translate="label" type="allowspecific" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Payment from Applicable Countries</label>
<source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model>
</field>
<field id="specificcountry" translate="label" type="multiselect" sortOrder="51" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Payment from Specific Countries</label>
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
<can_be_empty>1</can_be_empty>
</field>
<field id="payable_to" translate="label" sortOrder="61" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Make Check Payable to</label>
</field>
<field id="mailing_address" translate="label" type="textarea" sortOrder="62" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Send Check to</label>
</field>
<field id="min_order_total" translate="label" type="text" sortOrder="98" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Minimum Order Total</label>
</field>
<field id="max_order_total" translate="label" type="text" sortOrder="99" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Maximum Order Total</label>
</field>
<field id="model"></field>
</group>
</section>
</system>
</config>
\ No newline at end of file
<?xml version="1.0"?>
<!--
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Magento/Store/etc/config.xsd">
<default>
<payment>
<adyen_cc>
<active>1</active>
<model>Adyen\Payment\Model\Method\Cc</model>
<order_status>pending</order_status>
<title>Adyen</title>
<recurring_type>ONECLICK</recurring_type>
<allowspecific>0</allowspecific>
<sort_order>1</sort_order>
<cctypes>AE,VI,MC,DI</cctypes>
<useccv>1</useccv>
<group>adyen</group>
</adyen_cc>
<adyen_hpp>
<active>0</active>
<model>Adyen\Payment\Model\Method\Hpp</model>
<order_status>pending</order_status>
<title>Adyen HPP</title>
<recurring_type>ONECLICK</recurring_type>
<allowspecific>0</allowspecific>
<sort_order>10</sort_order>
<place_order_url>authorizenet/directpost_payment/place</place_order_url>
<order_place_redirect_url>adyen/process/redirect</order_place_redirect_url>
<payment_action>Authorization</payment_action>
<group>adyen</group>
</adyen_hpp>
<test>
<active>1</active>
<model>Adyen\Payment\Model\Method\Test</model>
<order_status>pending</order_status>
<title>Test method</title>
<allowspecific>0</allowspecific>
<group>adyen</group>
</test>
</payment>
</default>
</config>
<?xml version="1.0"?>
<!--
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
<virtualType name="AdyenCcConfigProvider" type="Magento\Payment\Model\CcGenericConfigProvider">
<arguments>
<argument name="methodCodes" xsi:type="array">
<item name="adyen_cc" xsi:type="const">Adyen\Payment\Model\Method\Cc::METHOD_CODE</item>
</argument>
</arguments>
</virtualType>
<type name="Magento\Checkout\Model\CompositeConfigProvider">
<arguments>
<argument name="configProviders" xsi:type="array">
<item name="adyen_cc_config_provider" xsi:type="object">AdyenCcConfigProvider</item>
</argument>
</arguments>
</type>
</config>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/App/etc/routes.xsd">
<router id="standard">
<route id="hello" frontName="hello">
<module name="Adyen_Payment" />
</route>
</router>
</config>
\ No newline at end of file
<?xml version="1.0"?>
<!--
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Adyen_Payment" setup_version="1.0.0">
<sequence>
<module name="Magento_Sales"/>
<module name="Magento_Quote"/>
<module name="Magento_Checkout"/>
</sequence>
</module>
</config>
<?xml version="1.0"?>
<!--
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<payment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../Magento/Payment/etc/payment.xsd">
<groups>
<group id="adyen">
<label>Adyen Payment Methods</label>
</group>
</groups>
<methods>
<method name="adyen_cc">
<allow_multiple_address>1</allow_multiple_address>
</method>
<method name="adyen_hpp">
<allow_multiple_address>1</allow_multiple_address>
</method>
<method name="test">
<allow_multiple_address>1</allow_multiple_address>
</method>
</methods>
</payment>
<?xml version="1.0"?>
<!--
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.root">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="checkout" xsi:type="array">
<item name="children" xsi:type="array">
<item name="steps" xsi:type="array">
<item name="children" xsi:type="array">
<item name="billing-step" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="children" xsi:type="array">
<item name="payment" xsi:type="array">
<item name="children" xsi:type="array">
<item name="renders" xsi:type="array">
<!-- merge payment method renders here -->
<item name="children" xsi:type="array">
<item name="adyen_payment" xsi:type="array">
<item name="component" xsi:type="string">Adyen_Payment/js/view/payment/cc-method</item>
<item name="methods" xsi:type="array">
<item name="adyen_cc" xsi:type="array">
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
</item>
<item name="adyen_hpp" xsi:type="array">
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>
\ No newline at end of file
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="Adyen\Payment\Block\Hello" name="hello" template="success.phtml">
</block>
</referenceContainer>
</body>
</page>
\ No newline at end of file
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
?>
<?php $_code = $block->getMethodCode() ?>
<fieldset class="fieldset payment items ccard <?php echo $_code ?>" id="payment_form_<?php echo $_code ?>" style="display: none;">
<div class="field type required">
<label for="<?php echo $_code ?>_cc_type" class="label"><span><?php echo __('Credit Card Type') ?></span></label>
<div class="control">
<select id="<?php echo $_code ?>_cc_type"
data-mage-init='{"creditCardType":{"creditCardTypeContainer":"#<?php echo $_code ?>_cc_type_ss_div"}}'
name="payment[cc_type]" data-validate='{required:true, "validate-cc-type-select":"#<?php echo $_code ?>_cc_number"}' class="select">
<option value=""><?php echo __('--Please Select--')?></option>
<?php $_ccType = $block->getInfoData('cc_type') ?>
<?php foreach ($block->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
<option value="<?php echo $_typeCode ?>"<?php if ($_typeCode == $_ccType): ?> selected="selected"<?php endif ?>><?php echo $_typeName ?></option>
<?php endforeach ?>
</select>
</div>
</div>
<div class="field number required">
<label for="<?php echo $_code ?>_cc_number" class="label"><span><?php echo __('Credit Card Number') ?></span></label>
<div class="control">
<input type="number" id="<?php echo $_code ?>_cc_number" name="payment[cc_number]" title="<?php echo __('Credit Card Number') ?>" class="input-text" value="" data-validate='{"required-number":true, "validate-cc-number":"#<?php echo $_code ?>_cc_type", "validate-cc-type":"#<?php echo $_code ?>_cc_type"}'/>
</div>
</div>
<div class="field required">
<label for="<?php echo $_code ?>_cc_owner" class="label"><span><?php echo __('Credit Card Owner') ?></span></label>
<div class="control">
<input type="text" id="<?php echo $_code ?>_cc_owner" name="payment[cc_owner]" title="<?php echo __('Credit Card Owner') ?>" class="input-text" value=""/>
</div>
</div>
<div class="field date required" id="<?php echo $_code ?>_cc_type_exp_div">
<label for="<?php echo $_code ?>_expiration" class="label"><span><?php echo __('Expiration Date') ?></span></label>
<div class="control">
<div class="fields group group-2">
<div class="field no-label month">
<div class="control">
<select id="<?php echo $_code ?>_expiration" name="payment[cc_exp_month]" class="select month" data-validate='{required:true, "validate-cc-exp":"#<?php echo $_code ?>_expiration_yr"}'>
<?php $_ccExpMonth = $block->getInfoData('cc_exp_month') ?>
<?php foreach ($block->getCcMonths() as $k => $v): ?>
<option value="<?php echo $k ? $k : '' ?>"<?php if ($k == $_ccExpMonth): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
<?php endforeach ?>
</select>
</div>
</div>
<div class="field no-label year">
<div class="control">
<?php $_ccExpYear = $block->getInfoData('cc_exp_year') ?>
<select id="<?php echo $_code ?>_expiration_yr" name="payment[cc_exp_year]" class="select year" data-validate='{required:true}'>
<?php foreach ($block->getCcYears() as $k => $v): ?>
<option value="<?php echo $k ? $k : '' ?>"<?php if ($k == $_ccExpYear): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
<?php endforeach ?>
</select>
</div>
</div>
</div>
</div>
</div>
<?php if ($block->hasVerification()): ?>
<div class="field cvv required" id="<?php echo $_code ?>_cc_type_cvv_div">
<label for="<?php echo $_code ?>_cc_cid" class="label"><span><?php echo __('Card Verification Number') ?></span></label>
<div class="control">
<input type="number" title="<?php echo __('Card Verification Number') ?>" class="input-text cvv" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" value="" data-validate='{"required-number":true, "validate-cc-cvn":"#<?php echo $_code ?>_cc_type"}' />
<?php $_content = '<img src=\"' . $block->getViewFileUrl('Magento_Checkout::cvv.png') . '\" alt=\"' . __('Card Verification Number Visual Reference') . '\" title=\"' . __('Card Verification Number Visual Reference') . '\" />'; ?>
<div class="note">
<a href="#" class="action cvv" title="<?php echo __('What is this?') ?>" data-mage-init='{"tooltip": {"content": "<?php echo $_content ?>"}}'><span><?php echo __('What is this?') ?></span></a>
</div>
</div>
</div>
<?php endif; ?>
<?php if ($block->hasSsCardType()): ?>
<div class="field switch solo required" id="<?php echo $_code ?>_cc_type_ss_div">
<div class="nested">
<div class="field switch solo required">
<label for="<?php echo $_code ?>_cc_issue" class="label"><span><?php echo __('Switch/Solo/Maestro Only') ?></span></label>
</div>
<div class="field number required">
<label for="<?php echo $_code ?>_cc_issue" class="label"><span><?php echo __('Issue Number') ?></span></label>
<div class="control">
<input type="text" title="<?php echo __('Issue Number') ?>" class="input-text cvv" id="<?php echo $_code ?>_cc_issue" name="payment[cc_ss_issue]" value="" data-validate='{"validate-cc-ukss":true}'/>
</div>
</div>
<div class="field date required">
<label for="<?php echo $_code ?>_start_month" class="label"><span><?php echo __('Start Date') ?></span></label>
<div class="control">
<div class="fields group group-2">
<div class="field no-label">
<div class="control">
<select id="<?php echo $_code ?>_start_month" name="payment[cc_ss_start_month]" class="select month" data-validate='{"validate-cc-ukss":true}'>
<?php foreach ($block->getCcMonths() as $k => $v): ?>
<option value="<?php echo $k ? $k : '' ?>"<?php if ($k == $block->getInfoData('cc_ss_start_month')): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
<?php endforeach ?>
</select>
</div>
</div>
<div class="field no-label">
<div class="control">
<select id="<?php echo $_code ?>_start_year" name="payment[cc_ss_start_year]" class="select year" data-validate='{"validate-cc-ukss":true}'>
<?php foreach ($block->getSsStartYears() as $k => $v): ?>
<option value="<?php echo $k ? $k : '' ?>"<?php if ($k == $block->getInfoData('cc_ss_start_year')): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
<?php endforeach ?>
</select>
</div>
</div>
</div>
</div>
</div>
<div class="adv container" data-validation-msg="validate-cc-ukss">&nbsp;</div>
</div>
</div>
<?php endif; ?>
<?php echo $block->getChildHtml() ?>
</fieldset>
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
?>
<dl class="payment-method checkmemo">
<dt class="title"><?php echo $block->escapeHtml($block->getMethod()->getTitle()) ?></dt>
</dl>
<?php echo "Successful! This is a simple module in Magento 2.0"; ?>
\ No newline at end of file
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
/*browser:true*/
/*global define*/
define(
[
'uiComponent',
'Magento_Checkout/js/model/payment/renderer-list'
],
function (
Component,
rendererList
) {
'use strict';
rendererList.push(
{
type: 'adyen_cc',
component: 'Adyen_Payment/js/view/payment/method-renderer/adyen-cc-method'
},
{
type: 'adyen_hpp',
component: 'Adyen_Payment/js/view/payment/method-renderer/adyen-hpp-method'
}
);
/** Add view logic here if needed */
return Component.extend({});
}
);
\ No newline at end of file
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
/*browser:true*/
/*global define*/
define(
[
'jquery',
'Magento_Payment/js/view/payment/iframe',
'Magento_Checkout/js/action/set-payment-information'
],
function ($, Component, setPaymentInformationAction) {
'use strict';
return Component.extend({
defaults: {
template: 'Adyen_Payment/payment/cc-form'
},
placeOrderHandler: null,
validateHandler: null,
setPlaceOrderHandler: function(handler) {
this.placeOrderHandler = handler;
},
setValidateHandler: function(handler) {
this.validateHandler = handler;
},
context: function() {
return this;
},
isShowLegend: function() {
return true;
},
getCode: function() {
return 'adyen_cc';
},
isActive: function() {
return true;
},
placeOrder: function() {
var self = this;
if (this.validateHandler()) {
this.isPlaceOrderActionAllowed(false);
$.when(setPaymentInformationAction()).done(function() {
self.placeOrderHandler();
}).fail(function() {
self.isPlaceOrderActionAllowed(true);
});
}
}
});
}
);
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
/*browser:true*/
/*global define*/
define(
[
'Magento_Checkout/js/view/payment/default'
],
function (Component) {
'use strict';
return Component.extend({
defaults: {
template: 'Adyen_Payment/payment/hpp-form'
}
});
}
);
<!--
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<div class="payment-method" data-bind="css: {'_active': (getCode() == isChecked())}">
<div class="payment-method-title field choice">
<input type="radio"
name="payment[method]"
class="radio"
data-bind="attr: {'id': getCode()}, value: getCode(), checked: isChecked, click: selectPaymentMethod, visible: isRadioButtonVisible()"/>
<label data-bind="attr: {'for': getCode()}" class="label"><span data-bind="text: getTitle()"></span></label>
</div>
<div class="payment-method-content">
<div class="payment-method-billing-address">
<!-- ko foreach: $parent.getRegion(getBillingAddressFormName()) -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</div>
<form class="form" id="co-transparent-form" action="#" method="post" data-bind="mageInit: {
'transparent':{
'context': context(),
'controller': getControllerName(),
'orderSaveUrl':getPlaceOrderUrl(),
}, 'validation':[]}">
<input type="hidden" name="payment[test]" value="TEST"/>
<!-- ko template: 'Magento_Payment/payment/cc-form' --><!-- /ko -->
<div class="checkout-agreements-block">
<!-- ko foreach: $parent.getRegion('before-place-order') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</div>
<div class="actions-toolbar">
<div class="primary">
<button class="action primary checkout"
type="submit"
data-bind="
click: placeOrder,
attr: {title: $t('Place Order')},
enable: (getCode() == isChecked()),
css: {disabled: !isPlaceOrderActionAllowed()}
"
disabled>
<span data-bind="text: $t('Place Order')"></span>
</button>
</div>
</div>
</form>
</div>
</div>
<!--
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<div class="payment-method" data-bind="css: {'_active': (getCode() == isChecked())}">
<div class="payment-method-title field choice">
<input type="radio"
name="payment[method]"
class="radio"
data-bind="attr: {'id': getCode()}, value: getCode(), checked: isChecked, click: selectPaymentMethod, visible: isRadioButtonVisible()"/>
<label data-bind="attr: {'for': getCode()}" class="label"><span data-bind="text: getTitle()"></span></label>
</div>
<div class="payment-method-content">
<div class="payment-method-billing-address">
<!-- ko foreach: $parent.getRegion(getBillingAddressFormName()) -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</div>
<form class="form" id="co-transparent-form" action="#" method="post" data-bind="mageInit: {
'transparent':{
'context': context(),
'controller': getControllerName(),
'gateway': getCode(),
'orderSaveUrl':getPlaceOrderUrl(),
'cgiUrl': getCgiUrl(),
'dateDelim': getDateDelim(),
'cardFieldsMap': getCardFieldsMap(),
'nativeAction': getSaveOrderUrl()
}, 'validation':[]}">
<div class="checkout-agreements-block">
<!-- ko foreach: $parent.getRegion('before-place-order') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</div>
<div class="actions-toolbar">
<div class="primary">
<button class="action primary checkout"
type="submit"
data-bind="
click: placeOrder,
attr: {title: $t('Place Order')},
enable: (getCode() == isChecked()),
css: {disabled: !isPlaceOrderActionAllowed()}
"
disabled>
<span data-bind="text: $t('Place Order')"></span>
</button>
</div>
</div>
</form>
</div>
</div>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment