Skip to content

Commit

Permalink
Upgrato to 4.1 oro platform compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
raffaelecarelle authored and anyt committed Jun 12, 2020
1 parent 4fb91b4 commit 27bc1e7
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 27 deletions.
11 changes: 6 additions & 5 deletions Form/Type/PayPalExpressSettingsType.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
ChoiceType::class,
[
'choices' => $this->actionsProvider->getActionNames(),
'choices_as_values' => true,
'choice_label' => function ($action) {
'choice_label' => function ($action, $key) {
return $this->translator->trans(
sprintf('oro.paypal_express.settings.payment_action.%s', $action)
);
Expand Down Expand Up @@ -103,7 +102,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
[
'label' => 'oro.paypal_express.settings.client_id.label',
'tooltip' => 'oro.paypal_express.settings.client_id.tooltip',
'required' => true
'required' => true,
'constraints' => [new NotBlank()]
]
);
$builder->add($this->addCryptedTransformer($clientIdFieldBuilder));
Expand All @@ -114,7 +114,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
[
'label' => 'oro.paypal_express.settings.client_secret.label',
'tooltip' => 'oro.paypal_express.settings.client_secret.tooltip',
'required' => true
'required' => true,
'constraints' => [new NotBlank()]
]
);
$builder->add($this->addCryptedTransformer($clientSecretFieldBuilder));
Expand All @@ -125,7 +126,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
[
'label' => 'oro.paypal_express.settings.sandbox_mode.label',
'tooltip' => 'oro.paypal_express.settings.sandbox_mode.tooltip',
'required' => false,
'required' => false
]
);
}
Expand Down
11 changes: 6 additions & 5 deletions Method/Translator/LineItemTranslator.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Oro\Bundle\LocaleBundle\Formatter\NumberFormatter;
use Oro\Bundle\PaymentBundle\Model\LineItemOptionModel;
use Oro\Bundle\PaymentBundle\Model\Surcharge;
use Oro\Bundle\PaymentBundle\Provider\ExtractOptionsProvider;
use Oro\Bundle\PayPalBundle\OptionsProvider\OptionsProviderInterface;
use Oro\Bundle\PayPalExpressBundle\Transport\DTO\ItemInfo;
use Oro\Bundle\PricingBundle\SubtotalProcessor\Model\LineItemsAwareInterface;
use Symfony\Component\Translation\TranslatorInterface;
Expand All @@ -21,7 +21,7 @@ class LineItemTranslator
const PAYPAL_NAME_LIMIT = 36;

/**
* @var ExtractOptionsProvider
* @var OptionsProviderInterface
*/
protected $optionsProvider;

Expand All @@ -41,10 +41,10 @@ class LineItemTranslator
protected $rounder;

/**
* @param ExtractOptionsProvider $optionsProvider
* @param OptionsProviderInterface $optionsProvider
* @param TranslatorInterface $translator
*/
public function __construct(ExtractOptionsProvider $optionsProvider, TranslatorInterface $translator)
public function __construct(OptionsProviderInterface $optionsProvider, TranslatorInterface $translator)
{
$this->optionsProvider = $optionsProvider;
$this->translator = $translator;
Expand Down Expand Up @@ -75,7 +75,8 @@ public function setRounder(RoundingServiceInterface $roundingService)
*/
public function getPaymentItems(LineItemsAwareInterface $paymentItem, Surcharge $surcharge, $currency)
{
$lineItems = $this->optionsProvider->getLineItemPaymentOptions($paymentItem);
$lineItems = $this->optionsProvider->getLineItemOptions($paymentItem);

if (!$lineItems) {
return [];
}
Expand Down
2 changes: 1 addition & 1 deletion Resources/config/method.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ services:
public: false
class: Oro\Bundle\PayPalExpressBundle\Method\Translator\LineItemTranslator
arguments:
- '@oro_payment.provider.extract_options'
- '@oro_paypal.options_provider.options'
- '@translator'
calls:
- ['setCurrencyFormatter', ['@oro_locale.formatter.number']]
Expand Down
3 changes: 0 additions & 3 deletions Resources/config/requirejs.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
define(function(require) {
'use strict';

var ExpressCheckoutComponent;
var _ = require('underscore');
var mediator = require('oroui/js/mediator');
var BaseComponent = require('oroui/js/app/components/base/component');
const _ = require('underscore');
const mediator = require('oroui/js/mediator');
const BaseComponent = require('oroui/js/app/components/base/component');

ExpressCheckoutComponent = BaseComponent.extend({
const ExpressCheckoutComponent = BaseComponent.extend({
/**
* @property {Object}
*/
Expand Down
3 changes: 3 additions & 0 deletions Resources/views/layouts/default/config/jsmodules.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dynamic-imports:
oropaypalexpress:
- oropaypalexpress/js/app/components/express-checkout-component
11 changes: 3 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,20 @@
"exclude-from-classmap": ["/Tests/"]
},
"require": {
"php": ">=7.0",
"oro/commerce": "3.1.*",
"paypal/rest-api-sdk-php": "1.13.*"
"oro/commerce": "4.1.*",
"paypal/rest-api-sdk-php": "1.14.*"
},
"repositories": {
"oro": {
"type": "composer",
"url": "https://packagist.orocrm.com"
},
"asset-packagist": {
"type": "composer",
"url": "https://asset-packagist.orocrm.com"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"branch-alias": {
"dev-master": "3.1-dev"
"dev-master": "4.1-dev"
}
}
}

0 comments on commit 27bc1e7

Please sign in to comment.