Skip to content

Commit

Permalink
Merge pull request #29 from spryker-eco/feature/eco-2516-suite-compat…
Browse files Browse the repository at this point in the history
…ibility

Release 2.0.0 - Upgrade to Master Suite compatibility
  • Loading branch information
alex-galych authored Jul 10, 2019
2 parents f186ba8 + 8e6cf10 commit a0188da
Show file tree
Hide file tree
Showing 72 changed files with 594 additions and 199 deletions.
29 changes: 24 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,20 @@
"license": "MIT",
"require": {
"spryker/application": "^3.0.0",
"spryker/checkout": "^3.0.0 || ^4.0.0 || ^6.0.0",
"spryker/calculation": "^4.0.0",
"spryker/checkout-extension": "^1.0.0",
"spryker/config": "^3.0.0",
"spryker/kernel": "^3.0.0",
"spryker/messenger": "^3.0.0",
"spryker/money": "^2.0.0",
"spryker/oms": "^7.0.0 || ^8.0.0 || ^10.0.0",
"spryker/step-engine": "^3.1.0",
"spryker/propel-orm": "^1.6.0",
"spryker/quote": "^1.0.0 || ^2.0.0",
"spryker/transfer": "^3.0.0",
"spryker/sales": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^10.0.0",
"spryker/silex": "^2.0.0",
"spryker/step-engine": "^3.1.0",
"spryker/symfony": "^3.0.0",
"spryker/zed-request": "^3.0.0",
"spryker/guzzle": "^2.2.0",
"spryker-eco/computop-api": "^1.0.0"
},
"autoload": {
Expand All @@ -36,6 +43,18 @@
}
},
"require-dev": {
"spryker/code-sniffer": "dev-master"
"spryker/checkout": "*",
"spryker/country": "*",
"spryker/customer": "*",
"spryker/guzzle": "*",
"spryker/payment": "*",
"spryker/propel": "*",
"spryker/testify": "*",
"spryker-shop/shop-application": "*"
},
"suggest": {
"spryker/checkout": "CheckoutPostSaveHookInterface is used.",
"spryker/payment": "If you want to use payment method filtering.",
"spryker-shop/shop-application": "Abstract Yves controller provider is used."
}
}
3 changes: 2 additions & 1 deletion config/config.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
/**
* Add new options
*/
$config[ComputopConstants::HMAC_PASSWORD] = 'COMPUTOP_HMAC_PASSWORD'; //Set up real data
$config[ComputopConstants::PAYDIREKT_SHOP_KEY] = 'PAYDIREKT_SHOP_KEY'; //Set up real data

$config[ComputopConstants::PAY_NOW_INIT_ACTION] = 'https://www.computop-paygate.com/paynow.aspx';
Expand All @@ -25,6 +24,8 @@
$config[ComputopConstants::IDEAL_INIT_ACTION] = 'https://www.computop-paygate.com/ideal.aspx';
$config[ComputopConstants::EASY_CREDIT_INIT_ACTION] = 'https://www.computop-paygate.com/easyCredit.aspx';

$config[ComputopConstants::IDEAL_ISSUER_ID] = 'IDEAL_ISSUER_ID'; //Set up real data

$config[ComputopApiConstants::CRIF_ACTION] = 'https://www.computop-paygate.com/deltavista.aspx';
$config[ComputopApiConstants::CRIF_PRODUCT_NAME] = ComputopConfig::CRIF_PRODUCT_NAME_QUICK_CHECK_CONSUMER;
$config[ComputopApiConstants::CRIF_LEGAL_FORM] = ComputopConfig::CRIF_LEGAL_FORM_PERSON;
Expand Down
183 changes: 182 additions & 1 deletion src/SprykerEco/Shared/Computop/ComputopConstants.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,219 @@
*/
interface ComputopConstants
{
public const HMAC_PASSWORD = 'COMPUTOP:HMAC_PASSWORD';
/**
* Specification:
* - Computop merchant identifier.
*
* @api
*/
public const PAYDIREKT_SHOP_KEY = 'COMPUTOP:PAYDIREKT_SHOP_KEY';

/**
* Specification:
* - Init API call endpoint for PayNow payment method.
*
* @api
*/
public const PAY_NOW_INIT_ACTION = 'COMPUTOP:PAY_NOW_INIT_ACTION';

/**
* Specification:
* - Init API call endpoint for Credit Card payment method.
*
* @api
*/
public const CREDIT_CARD_INIT_ACTION = 'COMPUTOP:CREDIT_CARD_INIT_ACTION';

/**
* Specification:
* - Init API call endpoint for PayPal payment method.
*
* @api
*/
public const PAYPAL_INIT_ACTION = 'COMPUTOP:PAYPAL_INIT_ACTION';

/**
* Specification:
* - Init API call endpoint for Direct Debit payment method.
*
* @api
*/
public const DIRECT_DEBIT_INIT_ACTION = 'COMPUTOP:DIRECT_DEBIT_INIT_ACTION';

/**
* Specification:
* - Init API call endpoint for Sofort payment method.
*
* @api
*/
public const SOFORT_INIT_ACTION = 'COMPUTOP:SOFORT_INIT_ACTION';

/**
* Specification:
* - Init API call endpoint for Paydirect payment method.
*
* @api
*/
public const PAYDIREKT_INIT_ACTION = 'COMPUTOP:PAYDIREKT_INIT_ACTION';

/**
* Specification:
* - Init API call endpoint for Ideal payment method.
*
* @api
*/
public const IDEAL_INIT_ACTION = 'COMPUTOP:IDEAL_INIT_ACTION';

/**
* Specification:
* - Init API call endpoint for Easy Credit payment method.
*
* @api
*/
public const EASY_CREDIT_INIT_ACTION = 'COMPUTOP:EASY_CREDIT_INIT_ACTION';

/**
* Specification:
* - Status API call endpoint for Easy Credit payment method.
*
* @api
*/
public const EASY_CREDIT_STATUS_ACTION = 'COMPUTOP:EASY_CREDIT_STATUS_ACTION';

/**
* Specification:
* - Authorize API call endpoint for Easy Credit payment method.
*
* @api
*/
public const EASY_CREDIT_AUTHORIZE_ACTION = 'COMPUTOP:EASY_CREDIT_AUTHORIZE_ACTION';

/**
* Specification:
* - Authorize API call endpoint.
*
* @api
*/
public const AUTHORIZE_ACTION = 'COMPUTOP:AUTHORIZE_ACTION';

/**
* Specification:
* - Capture API call endpoint.
*
* @api
*/
public const CAPTURE_ACTION = 'COMPUTOP:CAPTURE_ACTION';

/**
* Specification:
* - Reserve API call endpoint.
*
* @api
*/
public const REVERSE_ACTION = 'COMPUTOP:REVERSE_ACTION';

/**
* Specification:
* - Inquire API call endpoint.
*
* @api
*/
public const INQUIRE_ACTION = 'COMPUTOP:INQUIRE_ACTION';

/**
* Specification:
* - Refund API call endpoint.
*
* @api
*/
public const REFUND_ACTION = 'COMPUTOP:REFUND_ACTION';

/**
* Specification:
* -
*
* @api
*/
public const RESPONSE_MAC_REQUIRED = 'COMPUTOP:RESPONSE_MAC_REQUIRED';

/**
* Specification:
* - MAC is required for methods (to check MAC on response).
*
* @api
*/
public const PAYMENT_METHODS_WITHOUT_ORDER_CALL = 'COMPUTOP:PAYMENT_METHODS_WITHOUT_ORDER_CALL';

/**
* Specification:
* - Is custom template enabled for Credit Card payment method.
*
* @api
*/
public const CREDIT_CARD_TEMPLATE_ENABLED = 'COMPUTOP:CREDIT_CARD_TEMPLATE_ENABLED';

/**
* Specification:
* - Is CRIF risk check enabled.
*
* @api
*/
public const CRIF_ENABLED = 'COMPUTOP:CRIF_ENABLED';

/**
* Specification:
* - List of payment methods available with green response code.
*
* @api
*/
public const CRIF_GREEN_AVAILABLE_PAYMENT_METHODS = 'COMPUTOP:CRIF_GREEN_AVAILABLE_PAYMENT_METHODS';

/**
* Specification:
* - List of payment methods available with yellow response code.
*
* @api
*/
public const CRIF_YELLOW_AVAILABLE_PAYMENT_METHODS = 'COMPUTOP:CRIF_YELLOW_AVAILABLE_PAYMENT_METHODS';

/**
* Specification:
* - List of payment methods available with red response code.
*
* @api
*/
public const CRIF_RED_AVAILABLE_PAYMENT_METHODS = 'COMPUTOP:CRIF_RED_AVAILABLE_PAYMENT_METHODS';

/**
* Specification:
* - TX TYPE for Credit Card payment method (empty string).
*
* @api
*/
public const CREDIT_CARD_TX_TYPE = 'COMPUTOP:CREDIT_CARD_TX_TYPE';

/**
* Specification:
* - TX TYPE for PayNow payment method (empty string).
*
* @api
*/
public const PAY_NOW_TX_TYPE = 'COMPUTOP:PAY_NOW_TX_TYPE';

/**
* Specification:
* - TX TYPE for PayPal payment method (Auth).
*
* @api
*/
public const PAY_PAL_TX_TYPE = 'COMPUTOP:PAY_PAL_TX_TYPE';

/**
* Specification:
* - Issuer ID for Ideal payment method.
*
* @api
*/
public const IDEAL_ISSUER_ID = 'COMPUTOP:IDEAL_ISSUER_ID';
}
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,5 @@ interface ComputopApiConfig
public const CUSTOMER_ID = 'CustomerID';
public const LEGAL_FORM = 'LegalForm';
public const IP_ADDRESS = 'IPAddr';
public const ISSUER_ID = 'IssuerID';
}
4 changes: 4 additions & 0 deletions src/SprykerEco/Shared/Computop/Transfer/computop.transfer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@
<property name="len" type="int" />
<property name="url" type="string" />
<property name="shippingZip" type="string" />
<property name="shippingCity" type="string" />
<property name="shippingStreetNumber" type="string" />
<property name="shippingStreet" type="string" />
<property name="shippingCountryCode" type="string" />
<property name="easyCreditInitResponse" type="ComputopEasyCreditInitResponse"/>
<property name="easyCreditStatusResponse" type="ComputopApiEasyCreditStatusResponse"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ protected function updateResponseHeader(ComputopApiResponseHeaderTransfer $heade
if ($header->getStatus() === ComputopConfig::AUTHORIZE_REQUEST_STATUS) {
$header->setIsSuccess(true);
}

return $header;
}
}
2 changes: 1 addition & 1 deletion src/SprykerEco/Yves/Computop/Form/CreditCardSubForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class CreditCardSubForm extends AbstractSubForm
{
public const PAYMENT_METHOD = 'credit_card';
public const PAYMENT_METHOD = 'credit-card';

/**
* @return string
Expand Down
2 changes: 1 addition & 1 deletion src/SprykerEco/Yves/Computop/Form/DirectDebitSubForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class DirectDebitSubForm extends AbstractSubForm
{
public const PAYMENT_METHOD = 'direct_debit';
public const PAYMENT_METHOD = 'direct-debit';

/**
* @return string
Expand Down
2 changes: 1 addition & 1 deletion src/SprykerEco/Yves/Computop/Form/EasyCreditSubForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class EasyCreditSubForm extends AbstractSubForm
{
public const PAYMENT_METHOD = 'easy_credit';
public const PAYMENT_METHOD = 'easy-credit';

/**
* @return string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public function createComputopPaymentTransfer(QuoteTransfer $quoteTransfer)
/** @var \Generated\Shared\Transfer\ComputopEasyCreditPaymentTransfer $computopPaymentTransfer */
$computopPaymentTransfer = parent::createComputopPaymentTransfer($quoteTransfer);

$addressData = $this->getAdditionalAddressData($quoteTransfer);
$computopPaymentTransfer = $this->mapAddressDataToEasyCreditPayment($addressData, $computopPaymentTransfer);

$computopPaymentTransfer->setUrlNotify(
$this->getAbsoluteUrl($this->application->path(ComputopControllerProvider::NOTIFY_PATH_NAME))
);
Expand Down Expand Up @@ -90,7 +93,47 @@ protected function getDataSubArray(ComputopEasyCreditPaymentTransfer $cardPaymen
$dataSubArray[ComputopApiConfig::ETI_ID] = $this->config->getEtiId();
$dataSubArray[ComputopApiConfig::IP_ADDRESS] = $cardPaymentTransfer->getClientIp();
$dataSubArray[ComputopApiConfig::SHIPPING_ZIP] = $cardPaymentTransfer->getShippingZip();
$dataSubArray[ComputopApiConfig::SHIPPING_CITY] = $cardPaymentTransfer->getShippingCity();
$dataSubArray[ComputopApiConfig::SHIPPING_COUNTRY_CODE] = $cardPaymentTransfer->getShippingCountryCode();
$dataSubArray[ComputopApiConfig::SHIPPING_STREET] = $cardPaymentTransfer->getShippingStreet();
$dataSubArray[ComputopApiConfig::SHIPPING_STREET_NUMBER] = $cardPaymentTransfer->getShippingStreetNumber();

return $dataSubArray;
}

/**
* @param array $addressData
* @param \Generated\Shared\Transfer\ComputopEasyCreditPaymentTransfer $computopEasyCreditPaymentTransfer
*
* @return \Generated\Shared\Transfer\ComputopEasyCreditPaymentTransfer
*/
protected function mapAddressDataToEasyCreditPayment(
array $addressData,
ComputopEasyCreditPaymentTransfer $computopEasyCreditPaymentTransfer
): ComputopEasyCreditPaymentTransfer {

$computopEasyCreditPaymentTransfer->setShippingCity($addressData[ComputopEasyCreditPaymentTransfer::SHIPPING_CITY]);
$computopEasyCreditPaymentTransfer->setShippingStreet($addressData[ComputopEasyCreditPaymentTransfer::SHIPPING_STREET]);
$computopEasyCreditPaymentTransfer->setShippingStreetNumber($addressData[ComputopEasyCreditPaymentTransfer::SHIPPING_STREET_NUMBER]);
$computopEasyCreditPaymentTransfer->setShippingCountryCode($addressData[ComputopEasyCreditPaymentTransfer::SHIPPING_COUNTRY_CODE]);

return $computopEasyCreditPaymentTransfer;
}

/**
* @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer
*
* @return array
*/
protected function getAdditionalAddressData(QuoteTransfer $quoteTransfer): array
{
$addressTransfer = $quoteTransfer->getBillingSameAsShipping() ? $quoteTransfer->getBillingAddress() : $quoteTransfer->getShippingAddress();

$addressData[ComputopEasyCreditPaymentTransfer::SHIPPING_CITY] = $addressTransfer->getCity();
$addressData[ComputopEasyCreditPaymentTransfer::SHIPPING_STREET] = $addressTransfer->getAddress1();
$addressData[ComputopEasyCreditPaymentTransfer::SHIPPING_STREET_NUMBER] = $addressTransfer->getAddress2();
$addressData[ComputopEasyCreditPaymentTransfer::SHIPPING_COUNTRY_CODE] = $addressTransfer->getIso2Code();

return $addressData;
}
}
Loading

0 comments on commit a0188da

Please sign in to comment.