Skip to content

Commit

Permalink
PW-7273 - Change to adding Open SSL in the Docker image in order to h…
Browse files Browse the repository at this point in the history
…ave the test run through SSL. (#1803)

* Update ManagementHelper.php (#1738)

Co-authored-by: Jeantwan Teuma <Morerice@users.noreply.github.com>

* [PW-7261] Call to getAmount() failing in AdyenOrderPayment helper in develop branch

* Recurring payments added functionality (#1729)

* PW-6764 - Delete TransactionAuthorization class and start using checkout to process payments using vault tokens

* PW-6764 - Create new AdyenPaymentMethod model, repository and data patch

* PW-6764 - Move function to build payment method recurring data to vault helper. Also create ResourceModel

* PW-6764 - Add try catch block to function in Vault

* PW-6764 - Save paypal token in vault table

* PW-6764 - Create new exception. Add creation logic to CheckoutPaymentsDetailsHandler. Move validation in the getVaultPaymentMethodToken function

* PW-6764 - Do not force exception

* PW-6764 - Create function to check if recurringDetailReference is included in response

* PW-6764 - Update AdyenHppObserver to add string in additionalData to ensure that token is visible, IF it is eventually created

* PW-6764 - Setup functionality to display a payment method in the checkout page

* PW-6764 - Create new paymentMethodVault which will be used to ensure that for hpp tokens, no initialization is required

* PW-6764 - Create PayPal tokens w/type=Account and the brand in the details column

* PW-6764 - Update PaymentMethodRenderer

* PW-6764 - Add exception handling around createAdyenPaymentMethod function

* PW-6764 - Create new vault data builder to be used for hpp methods. Also save the tokenType when it is created and then re-use it when token is to be re-used

* PW-6764 - Add functionality to only CardOnFile payment method tokens, in checkout

* PW-6764 - Add instantPurchase functionality to Payment Methods

* PW-6764 - Add SEPA

* PW-6764 - Update admin tooltip. Rename functions in Vault helper to make it clear which one is used for what

* PW-6764 - Update label shown in checkout page

* PW-6764 - Run upgrade scripts on newer version

* PW-6764 - Create new observer which will call Adyen to disable a token, after it is disabled on magento side

* PW-6764 - Add exception handling to disable call

* PW-6764 - Update shopper template

* PW-6764 - Add function to check if provider is a recurring one and use it to send the shopper interaction

* PW-6764 - Split enableRecurring in payment methods to enableSubscription And enableCardOnFile. Use either, depending on what token type is in use

* PW-6790 - Move functionality to get the creditcard types to the paymentMethods Helper. Also create new payment method class for googlepay

* PW-6790 - Create new parent uiComponentProvider to be able to render the card provider even in the hpp provider (used for googlepay, applepay)

* PW-6790 - Render card tokens created with googlepay in the card section, on the user page

* PW-6790 - Remove useless methods from PaymentMethodInterface

* PW-6790 - Add token handling in the PaymentResponseHandler and update vault to not need the object payment method

* PW-6790 - Add isWallet function and use it for GooglePay

* PW-6790 - Add Apple pay classes

* PW-6790 - Create Abstract token formatter for instantPurchase, to show card formatting if a wallet payment (googlepay) was used

* PW-6790 - Update admin area tooltip

* PW-6790 - Remove unnecessary dependencies

* PW-6790 - Remove RecurringPmVaultDataBuilder and use the normal vault data builder instead

* PW-6790 - Remove SEPA related code that was previously unused

* [PW-6858] Add multiselect config for selecting which PMs to tokenize (#1605)

* [PW-6858] add config for selecting payment methods that should be tokenized

* [PW-6858] remove adyenpaymentmethods patch script

* [PW-6858] update property declaration syntax to support php 7.3

* Add UnscheduledCardOnFile for alternative payment methods (#1612)

* [PW-6910] Add functionality to tokenize AmazonPay payments (#1621)

* Add amazon pay payment method

* Add the payment method from statedata

* Update statedata property name as there is another statedata in the same class

* Add get variant method to statedata helper

* [PW-6974] - Handle tokenizations on wallet methods with the correct txVariant  (#1668)

* PW-6974 - Refactor payment method classes by creating a TxVariant class and an AbstractWalletPaymentMethod

* PW-6974 - Move functionality from CheckoutPaymentsDetailsHandler to VaultDetailsHandler. Update Vault function to save card type and wallet type

* PW-6974 - Update paymentMethod factory

* PW-6974 - Remove isWalletPaymentMethod function and instead check the instance of the object

* PW-6974 - Add comment to admin interface

* PW-6974 - Move IS_ACTIVE flag to vault handler. Also do not allow ApplePay to be selected for now, since it cannot be tested yet

* PW-6974 - Update comment

* PW-6974 - Remove SEPA specific field when handling webhook

* PW-6974 - Add signature to files

* [PW-6785] - Coverage report for SonarCloud (#1665)

* [PW-6785] - Coverage report for SonarCloud

* [PW-6785] - Coverage report for SonarCloud

* [PW-6785] - Coverage report for SonarCloud

* [PW-6785] - Coverage report for SonarCloud

* [PW-6785] - Coverage report for SonarCloud

* [PW-6785] - Coverage report for SonarCloud

* [PW-6785] - Coverage report for SonarCloud

* [PW-6785] - Coverage report for SonarCloud

* [PW-6785] - Coverage report for SonarCloud

* [PW-6785] - Refactor phpunit.xml for configuration and main.yml for pipeline

* [PW-6785] - Add sonar-project.properties file

* [PW-6785] - Remove sonar analysis from CI

* [PW-6785] - Remove unnecessary dependencies

* [PW-6785] - Coverage test function

* [PW-6785] - Enable CI based sonar analysis

* [PW-6785] - Code formatting

* [PW-6785] - Temporarily disable PHP8.1 matrix

* [PW-6785] - Change allowed list for scan

* [PW-6785] - Change allowed list for scan

* [PW-6785] - Exclude vendor directory from sonar analysis

* [PW-6785] - Remove the filter for sonar analysis and include all the project files

* [PW-6785] - Revert commits 6f6ca5d and bd74dd3

* [PW-7021] - Add failure counter for pay by link attempts (#1667)

* [PW-7021] - Add failure counter for pay by link attempts

* Update Helper/Webhook/AuthorisationWebhookHandler.php

Co-authored-by: Michael Paul <michael.paul@adyen.com>

* Update Helper/Webhook/AuthorisationWebhookHandler.php

Co-authored-by: Michael Paul <michael.paul@adyen.com>

* [PW-7021] - Code formatting

Co-authored-by: Michael Paul <michael.paul@adyen.com>

* Revert "[PW-6785] - Coverage report for SonarCloud (#1665)" (#1671)

This reverts commit f053b6f.

* Fix issue where CC vault tokens were not being created

* [PW-7100] Add CardOnFile and UnshceduledCardOnFile to Vault Card (#1693)

* update recurring_card_token_type in adyen_oneclick to show all contract types if vault is selected

* abstract recurring type value passed to buildCardRecurringData(), save tokenType in details field

* update TokenUiComponentProvider to display token if condition is met

* cleanup comment in the header

* add new template an js file for vault

* add interceptor that returns filtered customer session tokens

* remove banner

Co-authored-by: Michael Paul <michael.paul@adyen.com>

* remove comment

* update unit tests

* use different function for checking whether the value for tokenType is set

Co-authored-by: Jeantwan Teuma <Morerice@users.noreply.github.com>

* update tooltip for adyen_oneclick

Co-authored-by: Jeantwan Teuma <Morerice@users.noreply.github.com>

* update return type of afterGetCustomerSessionTokens function

Co-authored-by: Michael Paul <michael.paul@adyen.com>
Co-authored-by: Jeantwan Teuma <Morerice@users.noreply.github.com>

* [PW-7179] - Adjust vault tokenization functionality (#1709)

* PW-7179 - Re-add parent AdyenUiComponentProvider

* PW-7179 - Check if property exists before checking type

* PW-7179 - Fix issue created in merge commit and update PaymentVaultDeleteToken

* PW-7179 - Do not show ApplePay and AmazonPay for now. Also add to do annotations for them

* [PW-7157]Add India live prefix for frontend (#1708)

* Add India live prefix for frontend

* revert adyen-methods.js

Co-authored-by: Jeantwan Teuma <Morerice@users.noreply.github.com>

* PW-7179 - Move tooltip to comment

* PW-7129: Remove full request/response logging (#1712)

* PW-7129: Remove full request/response logging

Add new log processors to help with troubleshooting.

* PW-7129: Use context placeholders

* Adding number format to getAmountIncludingTax in test (#1715)

* Adding number format to getAmountIncludingTax in test

* Apply number format on getTaxAmount

Co-authored-by: Alexandros Moraitis <alexandros.moraitis@adyen.com>
Co-authored-by: Michael Paul <michael.paul@adyen.com>
Co-authored-by: Ángel Campos <angel.campos@adyen.com>

* recurring-changes - Remove unused paymentMethodsHelper

* Remove duplicate AdyenPaymentHppFacade

* Update formatting due to code smells

* More updates related to code smells

Co-authored-by: Peter Ojo <peterojo@users.noreply.github.com>
Co-authored-by: Alexandros Moraitis <alexandros.moraitis@adyen.com>
Co-authored-by: Can Demiralp <ecandemiralp@gmail.com>
Co-authored-by: Michael Paul <michael.paul@adyen.com>
Co-authored-by: Rok Popov Ledinski <rok.popovledinski@adyen.com>
Co-authored-by: Ángel Campos <angel.campos@adyen.com>

* [PW-7268] Change the way we are comparing payment amounts in handleCaptureWebhook() (#1751)

* use formatAmount() on $order and change comparison for $isFullAmountCaptured

* remove code smell

* Enable SSL

* Update Playwright container version

* [PW-7214] - Implement combo card funding source selection for POS payments in the frontend (#1749)

* [PW-7214] - Implement combo card funding source selection for POS payments in the frontend

* [PW-7214] - Code formatting

* [PW-7234] - CS code formatting

Co-authored-by: Jeantwan Teuma <Morerice@users.noreply.github.com>

* [PW-7275] - Add the hmac key field to the manual configuration mode (#1755)

* PW-7278 Fix HPP Naming for Ratepay (#1757)

* [PW-7278] Fix Ratepay Name in Admin HTML

* [PW-7270] - Allow auto configuration on test environment without webhook & hmac key (#1756)

* Version bump

* [PW-7234] - Update regular expression for address parsing (#1753)

* [PW-7234] - Update regular expression

* [PW-7234] - Update regex condition

* [PW-7234] - Update regex

* [PW-7234] - Update regex

* [PW-7234] - Code formatting

* [PW-7234] - Code formatting

* [PW-7234] - Update regex

Co-authored-by: Alexandros Moraitis <alexandros.moraitis@adyen.com>

* PW-7294 -  Get brand only under the HPP scenario (#1758)

* add check for -capture suffix (#1760)

* [PW-7169] Create order with PBL from rest api (#1762)

* Initiate PBL from rest api

* Refactor naming

* Fix code smells

* Code smell fixes

* Resolve suggestions

Co-authored-by: system-mr <systemmr@adyen.com>

* [PW-7285][PW-7149] - Align Magento api call timeout with POS device (#1761)

* PW-7149 - Stop using order as a private data member and instead pass it around between functions

* PW-7149 - Update PosCloudBackendBuilder to set the reservedOrderId on the quote

* Revert "PW-7149 - Update PosCloudBackendBuilder to set the reservedOrderId on the quote"

This reverts commit 287197f.

* Recurring payments added functionality (#1729)

* PW-6764 - Delete TransactionAuthorization class and start using checkout to process payments using vault tokens

* PW-6764 - Create new AdyenPaymentMethod model, repository and data patch

* PW-6764 - Move function to build payment method recurring data to vault helper. Also create ResourceModel

* PW-6764 - Add try catch block to function in Vault

* PW-6764 - Save paypal token in vault table

* PW-6764 - Create new exception. Add creation logic to CheckoutPaymentsDetailsHandler. Move validation in the getVaultPaymentMethodToken function

* PW-6764 - Do not force exception

* PW-6764 - Create function to check if recurringDetailReference is included in response

* PW-6764 - Update AdyenHppObserver to add string in additionalData to ensure that token is visible, IF it is eventually created

* PW-6764 - Setup functionality to display a payment method in the checkout page

* PW-6764 - Create new paymentMethodVault which will be used to ensure that for hpp tokens, no initialization is required

* PW-6764 - Create PayPal tokens w/type=Account and the brand in the details column

* PW-6764 - Update PaymentMethodRenderer

* PW-6764 - Add exception handling around createAdyenPaymentMethod function

* PW-6764 - Create new vault data builder to be used for hpp methods. Also save the tokenType when it is created and then re-use it when token is to be re-used

* PW-6764 - Add functionality to only CardOnFile payment method tokens, in checkout

* PW-6764 - Add instantPurchase functionality to Payment Methods

* PW-6764 - Add SEPA

* PW-6764 - Update admin tooltip. Rename functions in Vault helper to make it clear which one is used for what

* PW-6764 - Update label shown in checkout page

* PW-6764 - Run upgrade scripts on newer version

* PW-6764 - Create new observer which will call Adyen to disable a token, after it is disabled on magento side

* PW-6764 - Add exception handling to disable call

* PW-6764 - Update shopper template

* PW-6764 - Add function to check if provider is a recurring one and use it to send the shopper interaction

* PW-6764 - Split enableRecurring in payment methods to enableSubscription And enableCardOnFile. Use either, depending on what token type is in use

* PW-6790 - Move functionality to get the creditcard types to the paymentMethods Helper. Also create new payment method class for googlepay

* PW-6790 - Create new parent uiComponentProvider to be able to render the card provider even in the hpp provider (used for googlepay, applepay)

* PW-6790 - Render card tokens created with googlepay in the card section, on the user page

* PW-6790 - Remove useless methods from PaymentMethodInterface

* PW-6790 - Add token handling in the PaymentResponseHandler and update vault to not need the object payment method

* PW-6790 - Add isWallet function and use it for GooglePay

* PW-6790 - Add Apple pay classes

* PW-6790 - Create Abstract token formatter for instantPurchase, to show card formatting if a wallet payment (googlepay) was used

* PW-6790 - Update admin area tooltip

* PW-6790 - Remove unnecessary dependencies

* PW-6790 - Remove RecurringPmVaultDataBuilder and use the normal vault data builder instead

* PW-6790 - Remove SEPA related code that was previously unused

* [PW-6858] Add multiselect config for selecting which PMs to tokenize (#1605)

* [PW-6858] add config for selecting payment methods that should be tokenized

* [PW-6858] remove adyenpaymentmethods patch script

* [PW-6858] update property declaration syntax to support php 7.3

* Add UnscheduledCardOnFile for alternative payment methods (#1612)

* [PW-6910] Add functionality to tokenize AmazonPay payments (#1621)

* Add amazon pay payment method

* Add the payment method from statedata

* Update statedata property name as there is another statedata in the same class

* Add get variant method to statedata helper

* [PW-6974] - Handle tokenizations on wallet methods with the correct txVariant  (#1668)

* PW-6974 - Refactor payment method classes by creating a TxVariant class and an AbstractWalletPaymentMethod

* PW-6974 - Move functionality from CheckoutPaymentsDetailsHandler to VaultDetailsHandler. Update Vault function to save card type and wallet type

* PW-6974 - Update paymentMethod factory

* PW-6974 - Remove isWalletPaymentMethod function and instead check the instance of the object

* PW-6974 - Add comment to admin interface

* PW-6974 - Move IS_ACTIVE flag to vault handler. Also do not allow ApplePay to be selected for now, since it cannot be tested yet

* PW-6974 - Update comment

* PW-6974 - Remove SEPA specific field when handling webhook

* PW-6974 - Add signature to files

* [PW-6785] - Coverage report for SonarCloud (#1665)

* [PW-6785] - Coverage report for SonarCloud

* [PW-6785] - Coverage report for SonarCloud

* [PW-6785] - Coverage report for SonarCloud

* [PW-6785] - Coverage report for SonarCloud

* [PW-6785] - Coverage report for SonarCloud

* [PW-6785] - Coverage report for SonarCloud

* [PW-6785] - Coverage report for SonarCloud

* [PW-6785] - Coverage report for SonarCloud

* [PW-6785] - Coverage report for SonarCloud

* [PW-6785] - Refactor phpunit.xml for configuration and main.yml for pipeline

* [PW-6785] - Add sonar-project.properties file

* [PW-6785] - Remove sonar analysis from CI

* [PW-6785] - Remove unnecessary dependencies

* [PW-6785] - Coverage test function

* [PW-6785] - Enable CI based sonar analysis

* [PW-6785] - Code formatting

* [PW-6785] - Temporarily disable PHP8.1 matrix

* [PW-6785] - Change allowed list for scan

* [PW-6785] - Change allowed list for scan

* [PW-6785] - Exclude vendor directory from sonar analysis

* [PW-6785] - Remove the filter for sonar analysis and include all the project files

* [PW-6785] - Revert commits 6f6ca5d and bd74dd3

* [PW-7021] - Add failure counter for pay by link attempts (#1667)

* [PW-7021] - Add failure counter for pay by link attempts

* Update Helper/Webhook/AuthorisationWebhookHandler.php

Co-authored-by: Michael Paul <michael.paul@adyen.com>

* Update Helper/Webhook/AuthorisationWebhookHandler.php

Co-authored-by: Michael Paul <michael.paul@adyen.com>

* [PW-7021] - Code formatting

Co-authored-by: Michael Paul <michael.paul@adyen.com>

* Revert "[PW-6785] - Coverage report for SonarCloud (#1665)" (#1671)

This reverts commit f053b6f.

* Fix issue where CC vault tokens were not being created

* [PW-7100] Add CardOnFile and UnshceduledCardOnFile to Vault Card (#1693)

* update recurring_card_token_type in adyen_oneclick to show all contract types if vault is selected

* abstract recurring type value passed to buildCardRecurringData(), save tokenType in details field

* update TokenUiComponentProvider to display token if condition is met

* cleanup comment in the header

* add new template an js file for vault

* add interceptor that returns filtered customer session tokens

* remove banner

Co-authored-by: Michael Paul <michael.paul@adyen.com>

* remove comment

* update unit tests

* use different function for checking whether the value for tokenType is set

Co-authored-by: Jeantwan Teuma <Morerice@users.noreply.github.com>

* update tooltip for adyen_oneclick

Co-authored-by: Jeantwan Teuma <Morerice@users.noreply.github.com>

* update return type of afterGetCustomerSessionTokens function

Co-authored-by: Michael Paul <michael.paul@adyen.com>
Co-authored-by: Jeantwan Teuma <Morerice@users.noreply.github.com>

* [PW-7179] - Adjust vault tokenization functionality (#1709)

* PW-7179 - Re-add parent AdyenUiComponentProvider

* PW-7179 - Check if property exists before checking type

* PW-7179 - Fix issue created in merge commit and update PaymentVaultDeleteToken

* PW-7179 - Do not show ApplePay and AmazonPay for now. Also add to do annotations for them

* [PW-7157]Add India live prefix for frontend (#1708)

* Add India live prefix for frontend

* revert adyen-methods.js

Co-authored-by: Jeantwan Teuma <Morerice@users.noreply.github.com>

* PW-7179 - Move tooltip to comment

* PW-7129: Remove full request/response logging (#1712)

* PW-7129: Remove full request/response logging

Add new log processors to help with troubleshooting.

* PW-7129: Use context placeholders

* Adding number format to getAmountIncludingTax in test (#1715)

* Adding number format to getAmountIncludingTax in test

* Apply number format on getTaxAmount

Co-authored-by: Alexandros Moraitis <alexandros.moraitis@adyen.com>
Co-authored-by: Michael Paul <michael.paul@adyen.com>
Co-authored-by: Ángel Campos <angel.campos@adyen.com>

* recurring-changes - Remove unused paymentMethodsHelper

* Remove duplicate AdyenPaymentHppFacade

* Update formatting due to code smells

* More updates related to code smells

Co-authored-by: Peter Ojo <peterojo@users.noreply.github.com>
Co-authored-by: Alexandros Moraitis <alexandros.moraitis@adyen.com>
Co-authored-by: Can Demiralp <ecandemiralp@gmail.com>
Co-authored-by: Michael Paul <michael.paul@adyen.com>
Co-authored-by: Rok Popov Ledinski <rok.popovledinski@adyen.com>
Co-authored-by: Ángel Campos <angel.campos@adyen.com>

* [PW-7268] Change the way we are comparing payment amounts in handleCaptureWebhook() (#1751)

* use formatAmount() on $order and change comparison for $isFullAmountCaptured

* remove code smell

* [PW-7214] - Implement combo card funding source selection for POS payments in the frontend (#1749)

* [PW-7214] - Implement combo card funding source selection for POS payments in the frontend

* [PW-7214] - Code formatting

* [PW-7234] - CS code formatting

Co-authored-by: Jeantwan Teuma <Morerice@users.noreply.github.com>

* [PW-7275] - Add the hmac key field to the manual configuration mode (#1755)

* PW-7278 Fix HPP Naming for Ratepay (#1757)

* [PW-7278] Fix Ratepay Name in Admin HTML

* [PW-7270] - Allow auto configuration on test environment without webhook & hmac key (#1756)

* Version bump

* [PW-7234] - Update regular expression for address parsing (#1753)

* [PW-7234] - Update regular expression

* [PW-7234] - Update regex condition

* [PW-7234] - Update regex

* [PW-7234] - Update regex

* [PW-7234] - Code formatting

* [PW-7234] - Code formatting

* [PW-7234] - Update regex

Co-authored-by: Alexandros Moraitis <alexandros.moraitis@adyen.com>

* PW-7149 - Do not use deprecated function to get pos config data. Use the totalTimeout which by default will be 120

* PW-7149 - Create new PosException and surround plugin if condition with strval

* PW-7149 - Fix long line code smells

Co-authored-by: jeant <>
Co-authored-by: Peter Ojo <peterojo@users.noreply.github.com>
Co-authored-by: Alexandros Moraitis <alexandros.moraitis@adyen.com>
Co-authored-by: Can Demiralp <ecandemiralp@gmail.com>
Co-authored-by: Michael Paul <michael.paul@adyen.com>
Co-authored-by: Rok Popov Ledinski <rok.popovledinski@adyen.com>
Co-authored-by: Ángel Campos <angel.campos@adyen.com>
Co-authored-by: raoulritter <59527829+raoulritter@users.noreply.github.com>

* [PW-7259] Add Subscription and UnscheduledCardOnFile for Twint payments (#1764)

* setup add tokenization for twint

* remove passing of the object

* comment out Twint from admin panel conf due to an issue on LPM end

* remove comment

* [PW-7341] - MOTO payment method can't fetch MOTO accounts according to store ID (#1770)

* [PW-7341] - Add storeId to frontend model and client builder

* [PW-7341] - Code formatting due to CS

* [PW-4938] Add 3-digit padding helper method for shopperReference (#1766)

* setup add padding method for shopperReference

* remove comments, polish code

* code polish

* add variable type in function header and return type

* remove code smell

* remove redundant dataHelper alias

* add argument type to padShopperReference()

* mock padShopperReference method

* add twint logos (#1775)

* [PW-7325] - Update OFFER_CLOSED notification handler (#1776)

* [PW-7265] - Implement installments and funding source selection for backend POS payments (#1768)

* [PW-7265] - Implement installments and funding source selection

* [PW-7265] - Use Config helper for POS configurations

* [PW-7265] - Code formatting

* [PW-7265] - Method arguments type definition

* Version bump 8.8.0

* Revert the one_click (#1781)

* [PW-7044] - Process ORDER_CLOSED notification (#1772)

* [PW-7044] - Process ORDER_CLOSED notification

* [PW-7044] - Code formatting due to confliction

* [PW-7044] - Code formatting due to CS

* [PW-7274] - Unset additional information before setting (#1784)

Co-authored-by: Jeantwan Teuma <Morerice@users.noreply.github.com>

* [PW-7109] Refactor refund data builder files (#1779)

* setup refactor refund data builders

* rename item

* fix RefundMerchantAccountDataBuilder

* write more readable code

* PW-7348 - Add checks to remove cases where null is passed to preg_match (#1786)

* Replace the base currency with notification currency (#1789)

* [PW-7359] Upgrade Adyen Web Component to 5.28.2 (#1790)

* setup update web component

* update to newest version

* [PW-7393] - Update more info link (#1796)

* [PW-7394] - Unset only brand_code (#1797)

* [PW-Test 72733] IS THIS IT?

Co-authored-by: Peter Ojo <peterojo@users.noreply.github.com>
Co-authored-by: Tigren Solutions <info@tigren.com>
Co-authored-by: Jeantwan Teuma <Morerice@users.noreply.github.com>
Co-authored-by: Rok Popov Ledinski <rok.popovledinski@adyen.com>
Co-authored-by: Alexandros Moraitis <alexandros.moraitis@adyen.com>
Co-authored-by: Can Demiralp <ecandemiralp@gmail.com>
Co-authored-by: Michael Paul <michael.paul@adyen.com>
Co-authored-by: Ángel Campos <angel.campos@adyen.com>
Co-authored-by: Cenk Kucukiravul <cenk.kucukiravul@adyen.com>
Co-authored-by: system-mr <systemmr@adyen.com>
Co-authored-by: peterojo <peter.ojo@adyen.com>
  • Loading branch information
12 people committed Nov 2, 2022
1 parent 7e078cd commit 95a2430
Show file tree
Hide file tree
Showing 122 changed files with 3,493 additions and 1,214 deletions.
11 changes: 7 additions & 4 deletions .github/Dockerfile
Expand Up @@ -23,7 +23,7 @@ MAGENTO_LANGUAGE=en_US \
MAGENTO_CURRENCY=EUR \
MAGENTO_TZ=Europe/Amsterdam \
DEPLOY_SAMPLEDATA=0 \
USE_SSL=0
USE_SSL=1

RUN apt-get update \
&& apt-get install -y libjpeg62-turbo-dev \
Expand All @@ -34,13 +34,16 @@ RUN apt-get update \
libssl-dev \
libxslt-dev \
default-mysql-client \
ssl-cert \
wget \
cron \
unzip
unzip

RUN docker-php-ext-configure gd --with-freetype --with-jpeg
RUN docker-php-ext-install -j$(nproc) bcmath gd intl pdo_mysql simplexml soap sockets xsl zip

RUN a2enmod ssl
RUN a2ensite default-ssl.conf #can be removed if not needed
WORKDIR /var/www/html
COPY config/php.ini /usr/local/etc/php/
COPY config/install_magento.sh /tmp/install_magento.sh

Expand All @@ -52,4 +55,4 @@ ADD "https://github.com/magento/magento2-sample-data/archive/refs/tags/${MAGENTO

RUN chmod +x /tmp/install_magento.sh

CMD ["bash", "/tmp/install_magento.sh"]
CMD ["bash", "/tmp/install_magento.sh"]
4 changes: 2 additions & 2 deletions .github/docker-compose.e2e.yml
@@ -1,7 +1,7 @@
version: '3'
services:
playwright:
image: mcr.microsoft.com/playwright:v1.20.0-focal
image: mcr.microsoft.com/playwright:v1.25.0-focal
shm_size: 1gb
ipc: host
cap_add:
Expand All @@ -17,4 +17,4 @@ services:
- PAYPAL_PASSWORD
volumes:
- ../../scripts/e2e.sh:/e2e.sh
- ../../../test-report:/tmp/test-report
- ../../../test-report:/tmp/test-report
8 changes: 5 additions & 3 deletions Block/Customer/CardRenderer.php
Expand Up @@ -37,14 +37,16 @@ public function __construct(
}

/**
* Can render specified token
* Returns true if methodCode = adyen_cc OR (methodCode = adyen_hpp AND maskedCC exists in details. For googlepay)
*
* @param PaymentTokenInterface $token
* @return boolean
*/
public function canRender(PaymentTokenInterface $token)
public function canRender(PaymentTokenInterface $token): bool
{
return $token->getPaymentMethodCode() === AdyenCcConfigProvider::CODE;
$details = json_decode($token->getTokenDetails() ?: '{}', true);
return $token->getPaymentMethodCode() === AdyenCcConfigProvider::CODE ||
($token->getPaymentMethodCode() === AdyenHppConfigProvider::CODE && array_key_exists('maskedCC', $details));
}

/**
Expand Down
74 changes: 74 additions & 0 deletions Block/Customer/PaymentMethodRenderer.php
@@ -0,0 +1,74 @@
<?php
/**
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2019 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/

namespace Adyen\Payment\Block\Customer;

use Adyen\Payment\Exception\PaymentMethodException;
use Adyen\Payment\Helper\Data;
use Adyen\Payment\Helper\PaymentMethods\PaymentMethodFactory;
use Adyen\Payment\Helper\PaymentMethods\PaymentMethodInterface;
use Adyen\Payment\Model\Ui\AdyenHppConfigProvider;
use Magento\Framework\View\Element\Template\Context;
use Magento\Vault\Api\Data\PaymentTokenInterface;
use Magento\Vault\Block\AbstractTokenRenderer;

class PaymentMethodRenderer extends AbstractTokenRenderer
{
/** @var Data */
private $dataHelper;

/** @var PaymentMethodFactory */
private $paymentMethodFactory;


public function __construct(
Context $context,
Data $dataHelper,
PaymentMethodFactory $paymentMethodFactory,
array $data = []
) {
parent::__construct($context, $data);
$this->dataHelper = $dataHelper;
$this->paymentMethodFactory = $paymentMethodFactory;
}

public function getText(): string
{
try {
$paymentMethod = $this->paymentMethodFactory::createAdyenPaymentMethod($this->getTokenDetails()['type']);
$text = $paymentMethod->getPaymentMethodName();
} catch (PaymentMethodException $exception) {
$text = '';
}

return $text;
}

public function getIconUrl(): string
{
return $this->dataHelper->getVariantIcon($this->getTokenDetails()['type'])['url'];
}

public function getIconHeight(): int
{
return $this->dataHelper->getVariantIcon($this->getTokenDetails()['type'])['height'];
}

public function getIconWidth(): int
{
return $this->dataHelper->getVariantIcon($this->getTokenDetails()['type'])['width'];
}

public function canRender(PaymentTokenInterface $token): bool
{
return $token->getPaymentMethodCode() === AdyenHppConfigProvider::CODE;
}
}
26 changes: 10 additions & 16 deletions Block/Form/Cc.php
Expand Up @@ -15,6 +15,7 @@
use Adyen\Payment\Helper\Config;
use Adyen\Payment\Helper\Data;
use Adyen\Payment\Helper\Installments;
use Adyen\Payment\Helper\PaymentMethods;
use Adyen\Payment\Helper\Recurring;
use Adyen\Payment\Helper\Vault;
use Adyen\Payment\Logger\AdyenLogger;
Expand Down Expand Up @@ -80,6 +81,9 @@ class Cc extends \Magento\Payment\Block\Form\Cc
*/
private $vaultHelper;

/** @var PaymentMethods */
private $paymentMethodsHelper;

/**
* Cc constructor.
*
Expand Down Expand Up @@ -108,6 +112,7 @@ public function __construct(
Config $configHelper,
Session $customerSession,
Vault $vaultHelper,
PaymentMethods $paymentMethodsHelper,
array $data = []
) {
parent::__construct($context, $paymentConfig);
Expand All @@ -121,6 +126,7 @@ public function __construct(
$this->configHelper = $configHelper;
$this->customerSession = $customerSession;
$this->vaultHelper = $vaultHelper;
$this->paymentMethodsHelper = $paymentMethodsHelper;
}

/**
Expand Down Expand Up @@ -163,26 +169,14 @@ public function getLocale()
}

/**
* Retrieve available credit card type codes by alt code
* Retrieve available credit card type codes by alt code. Function is required so that it can be called
* from block form
*
* @return array
*/
public function getCcAvailableTypesByAlt()
public function getCcAvailableTypesByAlt(): array
{
$types = [];
$ccTypes = $this->adyenHelper->getAdyenCcTypes();

$availableTypes = $this->adyenHelper->getAdyenCcConfigData('cctypes');
if ($availableTypes) {
$availableTypes = explode(',', $availableTypes);
foreach (array_keys($ccTypes) as $code) {
if (in_array($code, $availableTypes)) {
$types[$ccTypes[$code]['code_alt']] = $code;
}
}
}

return $types;
return $this->paymentMethodsHelper->getCcAvailableTypesByAlt();
}

/**
Expand Down
4 changes: 3 additions & 1 deletion Block/Form/Moto.php
Expand Up @@ -179,6 +179,8 @@ public function getAmount()
*/
public function getMotoMerchantAccounts() : array
{
return $this->configHelper->getMotoMerchantAccounts();
$storeId = $this->backendSession->getStoreId();

return $this->configHelper->getMotoMerchantAccounts($storeId);
}
}
99 changes: 99 additions & 0 deletions Block/Form/PosCloud.php
Expand Up @@ -12,7 +12,12 @@

namespace Adyen\Payment\Block\Form;

use Adyen\Payment\Helper\Config;
use Adyen\Payment\Helper\ConnectedTerminals;
use Adyen\Payment\Helper\Data;
use Adyen\Payment\Helper\PointOfSale;
use Magento\Backend\Model\Session\Quote;
use Magento\Framework\Serialize\SerializerInterface;
use Magento\Framework\View\Element\Template;
use Magento\Payment\Block\Form;

Expand All @@ -28,18 +33,58 @@ class PosCloud extends Form
*/
protected $connectedTerminalsHelper;

/**
* @var Data
*/
protected $adyenHelper;

/**
* @var Config
*/
protected $configHelper;

/**
* @var SerializerInterface
*/
protected $serializer;

/**
* @var Quote
*/
protected $backendSession;

/**
* @var PointOfSale
*/
protected $posHelper;

/**
* @param Template\Context $context
* @param ConnectedTerminals $connectedTerminalsHelper
* @param SerializerInterface $serializer
* @param Data $adyenHelper
* @param Quote $backendSession
* @param PointOfSale $posHelper
* @param Config $configHelper
* @param array $data
*/
public function __construct(
Template\Context $context,
ConnectedTerminals $connectedTerminalsHelper,
SerializerInterface $serializer,
Data $adyenHelper,
Quote $backendSession,
PointOfSale $posHelper,
Config $configHelper,
array $data = []
) {
parent::__construct($context, $data);
$this->connectedTerminalsHelper = $connectedTerminalsHelper;
$this->serializer = $serializer;
$this->adyenHelper = $adyenHelper;
$this->backendSession = $backendSession;
$this->posHelper = $posHelper;
$this->configHelper = $configHelper;
}

/**
Expand All @@ -58,4 +103,58 @@ public function getConnectedTerminals()

return [];
}

public function getFormattedInstallments(): array
{
$serialisedInstallments = $this->configHelper->getAdyenPosCloudConfigData('installments');
$formattedInstallments = [];

if (isset($serialisedInstallments)) {
$installments = $this->serializer->unserialize($serialisedInstallments);

$amount = $this->backendSession->getQuote()->getGrandTotal();
$currencyCode = $this->backendSession->getQuote()->getCurrency()->getQuoteCurrencyCode();
$precision = $this->adyenHelper->decimalNumbers($currencyCode);

$formattedInstallments = $this->posHelper->getFormattedInstallments(
$installments,
$amount,
$currencyCode,
$precision
);
}

return $formattedInstallments;
}

public function hasInstallment()
{
return $this->configHelper->getAdyenPosCloudConfigData('enable_installments');
}

public function hasFundingSource(): bool
{
if ($this->backendSession->getQuote()->getBillingAddress() === null) {
return false;
}

$countryId = $this->backendSession->getQuote()->getBillingAddress()->getCountryId();
$currencyCode = $this->backendSession->getQuote()->getQuoteCurrencyCode();

$allowedCurrenciesByCountry = [
'BR' => 'BRL',
'MX' => 'MXN'
];

return isset($allowedCurrenciesByCountry[$countryId]) &&
$currencyCode === $allowedCurrenciesByCountry[$countryId];
}

public function getFundingSourceOptions(): array
{
return [
'credit' => 'Credit Card',
'debit' => 'Debit Card'
];
}
}
4 changes: 2 additions & 2 deletions Controller/Process/Result.php
Expand Up @@ -268,10 +268,10 @@ protected function validateResponse($response)
if (!empty($response['additionalData']['recurring.recurringDetailReference']) &&
$this->payment->getMethodInstance()->getCode() !== \Adyen\Payment\Model\Ui\AdyenOneclickConfigProvider::CODE) {
if ($this->vaultHelper->isCardVaultEnabled()) {
$this->vaultHelper->saveRecurringDetails($this->payment, $response['additionalData']);
$this->vaultHelper->saveRecurringCardDetails($this->payment, $response['additionalData']);
} else {
$order = $this->payment->getOrder();
$this->recurringHelper->createAdyenBillingAgreement($order, $response['additionalData'], $this->payment->getAdditionalInformation());
$this->recurringHelper->createAdyenBillingAgreement($order, $response['additionalData']);
}
$this->orderResourceModel->save($order);
}
Expand Down
18 changes: 18 additions & 0 deletions Exception/InvalidAdditionalDataException.php
@@ -0,0 +1,18 @@
<?php
/**
*
* Adyen Payment Module
*
* @author Adyen BV <support@adyen.com>
* @copyright (c) 2022 Adyen B.V.
* @license https://opensource.org/licenses/MIT MIT license
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/

namespace Adyen\Payment\Exception;

class InvalidAdditionalDataException extends AbstractAdyenException
{

}

0 comments on commit 95a2430

Please sign in to comment.