app/Plugin/PayPalCheckout42/Service/PayPalOrderService.php line 407

Open in your IDE?
  1. <?php
  2. namespace Plugin\PayPalCheckout42\Service;
  3. use DateTime;
  4. use Eccube\Common\EccubeConfig;
  5. use Eccube\Entity\Cart;
  6. use Eccube\Entity\Customer;
  7. use Eccube\Entity\Master\Pref;
  8. use Eccube\Entity\Order;
  9. use Eccube\Entity\Payment;
  10. use Eccube\Entity\Shipping;
  11. use Eccube\Repository\Master\PrefRepository;
  12. use Eccube\Repository\PaymentRepository;
  13. use Eccube\Service\CartService;
  14. use Eccube\Service\OrderHelper;
  15. use Exception;
  16. use Plugin\PayPalCheckout42\Contracts\EccubeAddressAccessible;
  17. use Plugin\PayPalCheckout42\Entity\Config;
  18. use Plugin\PayPalCheckout42\Exception\NotFoundBillingTokenException;
  19. use Plugin\PayPalCheckout42\Exception\NotFoundOrderingIdException;
  20. use Plugin\PayPalCheckout42\Exception\NotFoundPurchaseProcessingOrderException;
  21. use Plugin\PayPalCheckout42\Exception\OtherPaymentMethodException;
  22. use Plugin\PayPalCheckout42\Exception\PayPalCheckoutException;
  23. use Plugin\PayPalCheckout42\Repository\ConfigRepository;
  24. use Plugin\PayPalCheckout42\Service\Method\Acdc;
  25. use Plugin\PayPalCheckout42\Service\Method\BankTransfer;
  26. use Plugin\PayPalCheckout42\Service\Method\CreditCard;
  27. use Plugin\PayPalCheckout42\Service\Method\InlineGuest;
  28. use stdClass;
  29. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  30. use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
  31. use Symfony\Component\Routing\Router;
  32. use Symfony\Component\Routing\RouterInterface;
  33. /**
  34.  * Class PayPalOrderService
  35.  * @package Plugin\PayPalCheckout42\Service
  36.  */
  37. class PayPalOrderService
  38. {
  39.     const SESSION_SHORTCUT 'createOrderRequest.ShortcutPaypalCheckout';
  40.     /**
  41.      * @var SessionInterface
  42.      */
  43.     protected $session;
  44.     /**
  45.      * @var PrefRepository
  46.      */
  47.     protected $prefRepository;
  48.     /**
  49.      * @var EccubeConfig
  50.      */
  51.     protected $eccubeConfig;
  52.     /**
  53.      * @var stdClass
  54.      */
  55.     protected $properties;
  56.     /**
  57.      * @var LoggerService
  58.      */
  59.     protected $logger;
  60.     /**
  61.      * @var CartService
  62.      */
  63.     protected $cartService;
  64.     /**
  65.      * @var OrderHelper
  66.      */
  67.     protected $orderHelper;
  68.     /**
  69.      * @var Router
  70.      */
  71.     protected $router;
  72.     /**
  73.      * @var PaymentRepository
  74.      */
  75.     protected $paymentRepository;
  76.     /**
  77.      * @var Config
  78.      */
  79.     protected $Config;
  80.     /**
  81.      * PayPalOrderService constructor.
  82.      * @param SessionInterface $session
  83.      * @param PrefRepository $prefRepository
  84.      * @param LoggerService $loggerService
  85.      * @param EccubeConfig $eccubeConfig
  86.      * @param CartService $cartService
  87.      * @param OrderHelper $orderHelper
  88.      * @param Router $router
  89.      * @param PaymentRepository $paymentRepository
  90.      * @param ConfigRepository $configRepository
  91.      */
  92.     public function __construct(
  93.         SessionInterface $session,
  94.         PrefRepository $prefRepository,
  95.         LoggerService $loggerService,
  96.         EccubeConfig $eccubeConfig,
  97.         CartService $cartService,
  98.         OrderHelper $orderHelper,
  99.         RouterInterface $router,
  100.         PaymentRepository $paymentRepository,
  101.         ConfigRepository $configRepository
  102.     )
  103.     {
  104.         $this->session $session;
  105.         $this->prefRepository $prefRepository;
  106.         $this->logger $loggerService;
  107.         $this->eccubeConfig $eccubeConfig;
  108.         $this->cartService $cartService;
  109.         $this->orderHelper $orderHelper;
  110.         $this->router $router;
  111.         $this->paymentRepository $paymentRepository;
  112.         $this->Config $configRepository->get();
  113.     }
  114.     /**
  115.      * @return bool
  116.      */
  117.     public function isProcessingShortcutPayment(): bool
  118.     {
  119.         return $this->router->getContext()->getPathInfo() === "/paypal_confirm"
  120.             && !is_null($this->session->get(self::SESSION_SHORTCUTnull));
  121.     }
  122.     /**
  123.      * @param $anything
  124.      */
  125.     public function setShortcutPaymentSession($anything): void
  126.     {
  127.         $this->session->set(self::SESSION_SHORTCUT$anything);
  128.     }
  129.     /**
  130.      * @return string
  131.      */
  132.     public function getOrderingId(): string
  133.     {
  134.         return $this->session->get('createOrderRequest.orderingId''');
  135.     }
  136.     /**
  137.      * @param string $orderingId
  138.      */
  139.     public function setOrderingId(string $orderingId): void
  140.     {
  141.         $this->session->set('createOrderRequest.orderingId'$orderingId);
  142.     }
  143.     /**
  144.      * @param Shipping $shipping
  145.      */
  146.     public function setShippingAddress(Shipping $shipping): void
  147.     {
  148.         $this->session->set('createOrderRequest.shippingAddress'$shipping);
  149.     }
  150.     /**
  151.      * @param string $billingToken
  152.      */
  153.     public function setBillingToken(string $billingToken): void
  154.     {
  155.         $this->session->set('createOrderRequest.billingToken'$billingToken);
  156.     }
  157.     /**
  158.      * @return Order
  159.      * @throws NotFoundPurchaseProcessingOrderException
  160.      */
  161.     public function getPurchaseProcessingOrder(): Order
  162.     {
  163.         /** @var string|null $preOrderId */
  164.         $preOrderId $this->cartService->getPreOrderId();
  165.         if (is_null($preOrderId)) {
  166.             throw new NotFoundPurchaseProcessingOrderException();
  167.         }
  168.         /** @var Order|null $order */
  169.         $order $this->orderHelper->getPurchaseProcessingOrder($preOrderId);
  170.         if (is_null($order)) {
  171.             throw new NotFoundPurchaseProcessingOrderException();
  172.         }
  173.         if ($preOrderId === $order->getPreOrderId()) {
  174.             return $order;
  175.         }
  176.         throw new NotFoundPurchaseProcessingOrderException();
  177.     }
  178.     /**
  179.      * @param callable $callback
  180.      * @return void
  181.      * @throws NotFoundOrderingIdException
  182.      */
  183.     public function doProcessOrderingId(callable $callback): void
  184.     {
  185.         try {
  186.             /** @var string|null $orderingId */
  187.             $orderingId $this->session->get('createOrderRequest.orderingId'null);
  188.             if (is_null($orderingId)) {
  189.                 throw new NotFoundOrderingIdException();
  190.             }
  191.             call_user_func($callback$orderingId);
  192.         } finally {
  193.             $this->session->remove('createOrderRequest.orderingId');
  194.         }
  195.     }
  196.     /**
  197.      * @param callable $callback
  198.      * @return void
  199.      * @throws NotFoundBillingTokenException
  200.      */
  201.     public function doProcessBillingToken(callable $callback): void
  202.     {
  203.         try {
  204.             /** @var string|null $billingToken */
  205.             $billingToken $this->session->get('createOrderRequest.billingToken'null);
  206.             if (is_null($billingToken)) {
  207.                 throw new NotFoundBillingTokenException();
  208.             }
  209.             call_user_func($callback$billingToken);
  210.         } finally {
  211.             $this->session->remove('createOrderRequest.billingToken');
  212.         }
  213.     }
  214.     /**
  215.      * @return array
  216.      */
  217.     private function getPrefList(): array
  218.     {
  219.         return [
  220.             "hokkaido" => "北海道",
  221.             "aomori" => "青森県",
  222.             "iwate" => "岩手県",
  223.             "miyagi" => "宮城県",
  224.             "akita" => "秋田県",
  225.             "yamagata" => "山形県",
  226.             "fukushima" => "福島県",
  227.             "ibaraki" => "茨城県",
  228.             "tochigi" => "栃木県",
  229.             "gunma" => "群馬県",
  230.             "saitama" => "埼玉県",
  231.             "chiba" => "千葉県",
  232.             "tokyo" => "東京都",
  233.             "kanagawa" => "神奈川県",
  234.             "niigata" => "新潟県",
  235.             "toyama" => "富山県",
  236.             "ishikawa" => "石川県",
  237.             "fukui" => "福井県",
  238.             "yamanashi" => "山梨県",
  239.             "nagano" => "長野県",
  240.             "gifu" => "岐阜県",
  241.             "shizuoka" => "静岡県",
  242.             "aichi" => "愛知県",
  243.             "mie" => "三重県",
  244.             "shiga" => "滋賀県",
  245.             "kyoto" => "京都府",
  246.             "osaka" => "大阪府",
  247.             "hyogo" => "兵庫県",
  248.             "nara" => "奈良県",
  249.             "wakayama" => "和歌山県",
  250.             "tottori" => "鳥取県",
  251.             "shimane" => "島根県",
  252.             "okayama" => "岡山県",
  253.             "hiroshima" => "広島県",
  254.             "yamaguchi" => "山口県",
  255.             "tokushima" => "徳島県",
  256.             "kagawa" => "香川県",
  257.             "ehime" => "愛媛県",
  258.             "kochi" => "高知県",
  259.             "fukuoka" => "福岡県",
  260.             "saga" => "佐賀県",
  261.             "nagasaki" => "長崎県",
  262.             "kumamoto" => "熊本県",
  263.             "oita" => "大分県",
  264.             "miyazaki" => "宮崎県",
  265.             "kagoshima" => "鹿児島県",
  266.             "okinawa" => "沖縄県",
  267.         ];
  268.     }
  269.     /**
  270.      * @param $pref
  271.      * @return string
  272.      */
  273.     public function getPrefByPayPalPref($pref)
  274.     {
  275.         $pattern '/.*[都道府県]/';
  276.         if (preg_match($pattern$pref$match)) {
  277.             return $match[0];
  278.         } else {
  279.             /** @var array $prefList */
  280.             $prefList $this->getPrefList();
  281.             $index strtolower($pref);
  282.             $key preg_grep("/^{$index}/"array_keys($prefList));
  283.             return $prefList[current($key)];
  284.         }
  285.     }
  286.     /**
  287.      * @param EccubeAddressAccessible $reader
  288.      * @return Customer
  289.      * @throws Exception
  290.      */
  291.     public function generateCustomer(EccubeAddressAccessible $reader): Customer
  292.     {
  293.         /** @var array $data */
  294.         $data $reader->getEccubeAddressFormat();
  295.         /** @var Pref|null $pref */
  296.         $pref $this->prefRepository->findOneBy([
  297.             'name' => $this->getPrefByPayPalPref($data['pref'])
  298.         ]);
  299.         if (is_null($pref)) {
  300.             throw new PayPalCheckoutException();
  301.         }
  302.         /** @var Customer $customer */
  303.         $customer = new Customer();
  304.         $customer
  305.             ->setName01($data['name01'])
  306.             ->setName02($data['name02'])
  307.             ->setKana01($data['kana01'])
  308.             ->setKana02($data['kana02'])
  309.             ->setCompanyName($data['company_name'])
  310.             ->setEmail($data['email'])
  311.             ->setPhonenumber($data['phone_number'])
  312.             ->setPostalcode($data['postal_code'])
  313.             ->setPref($pref)
  314.             ->setAddr01($data['addr01'])
  315.             ->setAddr02($data['addr02'])
  316.             ->setUpdateDate(new DateTime());
  317.         return $customer;
  318.     }
  319.     /**
  320.      * @return string
  321.      */
  322.     public function generateScriptSubscription(): string
  323.     {
  324.         return $this->generateScriptUrl([
  325.             "vault" => "true"
  326.         ]);
  327.     }
  328.     /**
  329.      * @return string
  330.      */
  331.     public function generateScriptShortcutSubscriptionPayPalCheckout(): string
  332.     {
  333.         return $this->generateScriptUrl([
  334.             "commit" => "false",
  335.             "vault" => "true"
  336.         ]);
  337.     }
  338.     /**
  339.      * @return string
  340.      */
  341.     public function generateScriptShortcutPayPalCheckout(): string
  342.     {
  343.         return $this->generateScriptUrl([
  344.             "commit" => "false"
  345.         ]);
  346.     }
  347.     /**
  348.      * @return string
  349.      */
  350.     public function generateScriptPayPalCheckout(): string
  351.     {
  352.         return $this->generateScriptUrl();
  353.     }
  354.     /**
  355.      * @param array $options
  356.      * @return string
  357.      */
  358.     public function generateScriptUrl(array $options = []): string
  359.     {
  360.         /** @var string $clientId */
  361.         $clientId $this->Config->getClientId();
  362.         /** @var string $queryParameters */
  363.         $queryParameters http_build_query(array_merge([
  364.             'client-id' => $clientId,
  365.             'currency' => $this->eccubeConfig->get('paypal.currency') ?? "JPY",
  366.             'locale' => $this->eccubeConfig->get('paypal.locale') ?? "ja_JP",
  367.             'integration-date' => $this->eccubeConfig->get('paypal.integration-date') ?? "2019-07-23",
  368.             'commit' => "false"
  369.         ], $options));
  370.         /** @var string $scriptUrl */
  371.         $scriptUrl "{$this->eccubeConfig->get('paypal.sdk.url')}?${queryParameters}";
  372.         return $scriptUrl;
  373.     }
  374.     /**
  375.      * 非ログインでもお客様情報を入力されている場合は true になることに注意
  376.      *
  377.      * @return bool
  378.      */
  379.     private function isAuthenticatedUser(): bool
  380.     {
  381.         return !$this->orderHelper->isLoginRequired();
  382.     }
  383.     /**
  384.      * 非ログインでもお客様情報が入力されている場合は false になることに注意
  385.      *
  386.      * @return bool
  387.      */
  388.     private function isGuestUser(): bool
  389.     {
  390.         return !$this->isAuthenticatedUser();
  391.     }
  392.     /**
  393.      * @param Cart $Cart
  394.      * @return array
  395.      * @throws PayPalCheckoutException
  396.      */
  397.     public function generateFrontEndParametersOnCartIndexPage(Cart $Cart): array
  398.     {
  399.         switch (true) {
  400.             case $this->isAuthenticatedUser() && PayPalService::existsSubscriptionProductInCart($Cart):
  401.                 /** @var string|null $cartKey */
  402.                 $cartKey $Cart->getCartKey();
  403.                 if (is_null($Cart->getCartKey())) {
  404.                     throw new PayPalCheckoutException();
  405.                 }
  406.                 $snippet '@PayPalCheckout42/default/Cart/index/subscription.twig';
  407.                 $parameters['PayPalCheckout']['paypal_shortcut_ordering_subscription_product_url'] = $this->router->generate('paypal_shortcut_ordering_subscription_product', ['cart_key' => $cartKey], UrlGeneratorInterface::ABSOLUTE_PATH);
  408.                 $parameters['PayPalCheckout']['next_page_url'] = $this->router->generate('paypal_confirm', [], UrlGeneratorInterface::ABSOLUTE_PATH);
  409.                 $parameters['PayPalCheckout']['widget_url'] = $this->generateScriptShortcutSubscriptionPayPalCheckout();
  410.                 break;
  411.             case $this->isAuthenticatedUser():
  412.                 /** @var string|null $cartKey */
  413.                 $cartKey $Cart->getCartKey();
  414.                 if (is_null($Cart->getCartKey())) {
  415.                     throw new PayPalCheckoutException();
  416.                 }
  417.                 $snippet '@PayPalCheckout42/default/Cart/index/checkout.twig';
  418.                 $parameters['PayPalCheckout']['paypal_shortcut_prepare_transaction_url'] = $this->router->generate('paypal_shortcut_prepare_transaction', ['cart_key' => $cartKey], UrlGeneratorInterface::ABSOLUTE_PATH);
  419.                 $parameters['PayPalCheckout']['next_page_url'] = $this->router->generate('paypal_confirm', [], UrlGeneratorInterface::ABSOLUTE_PATH);
  420.                 $parameters['PayPalCheckout']['widget_url'] = $this->generateScriptShortcutPayPalCheckout();
  421.                 break;
  422.             case $this->isGuestUser() && PayPalService::existsSubscriptionProductInCart($Cart):
  423.                 $snippet '@PayPalCheckout42/default/Cart/index/nothing.twig';
  424.                 $parameters['PayPalCheckout']['widget_url'] = null;
  425.                 break;
  426.             case $this->isGuestUser():
  427.                 /** @var string|null $cartKey */
  428.                 $cartKey $Cart->getCartKey();
  429.                 if (is_null($Cart->getCartKey())) {
  430.                     throw new PayPalCheckoutException();
  431.                 }
  432.                 $snippet '@PayPalCheckout42/default/Cart/index/guest.twig';
  433.                 $parameters['PayPalCheckout']['guest_paypal_shortcut_prepare_transaction_url'] = $this->router->generate('guest_paypal_shortcut_prepare_transaction', ['cart_key' => $cartKey], UrlGeneratorInterface::ABSOLUTE_PATH);
  434.                 $parameters['PayPalCheckout']['guest_paypal_order_url'] = $this->router->generate('guest_paypal_order', ['cart_key' => $cartKey], UrlGeneratorInterface::ABSOLUTE_PATH);
  435.                 $parameters['PayPalCheckout']['next_page_url'] = $this->router->generate('paypal_confirm', [], UrlGeneratorInterface::ABSOLUTE_PATH);
  436.                 $parameters['PayPalCheckout']['widget_url'] = $this->generateScriptShortcutPayPalCheckout();
  437.                 break;
  438.             default:
  439.                 $snippet '@PayPalCheckout42/default/Cart/index/nothing.twig';
  440.                 $parameters['PayPalCheckout']['widget_url'] = null;
  441.         }
  442.         return [$snippet$parameters];
  443.     }
  444.     /**
  445.      * @param Order $order
  446.      * @return array
  447.      * @throws OtherPaymentMethodException
  448.      */
  449.     public function generateFrontEndParametersOnShoppingConfirmPage(Order $order): array
  450.     {
  451.         /** @var array $parameters */
  452.         $parameters = [];
  453.         /** @var string|null $paymentMethod */
  454.         $paymentMethod $order->getPayment()->getMethodClass();
  455.         if (!($paymentMethod === BankTransfer::class || $paymentMethod === CreditCard::class || $paymentMethod === InlineGuest::class)) {
  456.             throw new OtherPaymentMethodException();
  457.         }
  458.         if (PayPalService::existsSubscriptionProductInOrderItems($order)) {
  459.             $snippet '@PayPalCheckout42/default/Shopping/confirm/subscription.twig';
  460.             $widget_url $this->generateScriptSubscription();
  461.             $api_url $this->router->generate('paypal_prepare_subscription');
  462.         } else {
  463.             $snippet '@PayPalCheckout42/default/Shopping/confirm/checkout.twig';
  464.             $widget_url $this->generateScriptPayPalCheckout();
  465.             $api_url $this->router->generate('paypal_prepare_transaction');
  466.         }
  467.         $parameters['PayPalCheckout']['widget_url'] = $widget_url;
  468.         $parameters['PayPalCheckout']['api_url'] = $api_url;
  469.         return [$snippet$parameters];
  470.     }
  471.     /**
  472.      * @param Cart $Cart
  473.      * @return array
  474.      * @throws PayPalCheckoutException
  475.      */
  476.     public function generateFrontEndParametersOnShoppingLoginPage(Cart $Cart): array
  477.     {
  478.         /** @var string|null $cartKey */
  479.         $cartKey $Cart->getCartKey();
  480.         if (is_null($Cart->getCartKey())) {
  481.             throw new PayPalCheckoutException();
  482.         }
  483.         $snippet '@PayPalCheckout42/default/Shopping/login/shortcut.twig';
  484.         $parameters['PayPalCheckout']['guest_paypal_shortcut_prepare_transaction_url'] = $this->router->generate('guest_paypal_shortcut_prepare_transaction', ['cart_key' => $cartKey], UrlGeneratorInterface::ABSOLUTE_PATH);
  485.         $parameters['PayPalCheckout']['guest_paypal_order_url'] = $this->router->generate('guest_paypal_order', ['cart_key' => $cartKey], UrlGeneratorInterface::ABSOLUTE_PATH);
  486.         $parameters['PayPalCheckout']['next_page_url'] = $this->router->generate('paypal_confirm', [], UrlGeneratorInterface::ABSOLUTE_PATH);
  487.         $parameters['PayPalCheckout']['widget_url'] = $this->generateScriptShortcutPayPalCheckout();
  488.         return [$snippet$parameters];
  489.     }
  490.     /**
  491.      * @return array
  492.      */
  493.     public function generateFrontEndParametersOnShoppingIndexPage(): array
  494.     {
  495.         /** @var Payment $BankTransferPayment */
  496.         $PaymentBankTransfer $this->paymentRepository->findOneBy([
  497.             'method_class' => BankTransfer::class
  498.         ], []);
  499.         /** @var Payment $BankTransferPayment */
  500.         $PaymentCreditCard $this->paymentRepository->findOneBy([
  501.             'method_class' => CreditCard::class
  502.         ], []);
  503.         /** @var Payment $PaymentInlineGuest */
  504.         $PaymentInlineGuest $this->paymentRepository->findOneBy([
  505.             'method_class' => InlineGuest::class
  506.         ], []);
  507.         /** @var Payment $PaymentAcdc */
  508.         $PaymentAcdc $this->paymentRepository->findOneBy([
  509.             'method_class' => Acdc::class
  510.         ], []);
  511.         $snippet '@PayPalCheckout42/default/Shopping/index/common.twig';
  512.         $parameters['PayPalCheckout']['bank_transfer_id'] = "#shopping_order_Payment_{$PaymentBankTransfer->getId()}";
  513.         $parameters['PayPalCheckout']['credit_card_id'] = "#shopping_order_Payment_{$PaymentCreditCard->getId()}";
  514.         $parameters['PayPalCheckout']['inline_guest_id'] = "#shopping_order_Payment_{$PaymentInlineGuest->getId()}";
  515.         $parameters['PayPalCheckout']['acdc_id'] = "#shopping_order_Payment_{$PaymentAcdc->getId()}";
  516.         $imgBankTransferPath __DIR__ '/../Resource/assets/img/bank_transfer_appearance.png';
  517.         $imgCreditCardPath __DIR__ '/../Resource/assets/img/credit_card_appearance.png';
  518.         $imgInlineGuestPath __DIR__ '/../Resource/assets/img/inline_guest_appearance.png';
  519.         $imgAcdcPath __DIR__ '/../Resource/assets/img/acdc_appearance.png';
  520.         $paymentBannerImageUrl $this->getPaymentBannerImageUrl();
  521.         $base64BankTransfer base64_encode(file_get_contents($imgBankTransferPath));
  522.         $base64CreditCard base64_encode(file_get_contents($imgCreditCardPath));
  523.         $base64InlineGuest base64_encode(file_get_contents($imgInlineGuestPath));
  524.         $base64Acdc base64_encode(file_get_contents($imgAcdcPath));
  525.         $parameters['PayPalCheckout']['credit_card_appearance_base64'] = "data:image/png;base64,{$base64CreditCard}";
  526.         $parameters['PayPalCheckout']['bank_transfer_appearance_base64'] = "data:image/png;base64,{$base64BankTransfer}";
  527.         $parameters['PayPalCheckout']['inline_guest_appearance_base64'] = "data:image/png;base64,{$base64InlineGuest}";
  528.         $parameters['PayPalCheckout']['acdc_appearance_base64'] = "data:image/png;base64,{$base64Acdc}";
  529.         $parameters['PayPalCheckout']['payment_banner_image_url'] = $paymentBannerImageUrl;
  530.         $parameters['PayPalCheckout']['widget_url'] = $this->generateScriptPayPalCheckout();
  531.         $parameters['PayPalCheckout']['api_url'] = $this->router->generate('paypal_prepare_transaction');
  532.         $parameters['PayPalCheckout']['inline_guest_api_url'] = $this->router->generate('paypal_prepare_transaction_inline_guest');
  533.         $parameters['PayPalCheckout']['acdc_api_url'] = $this->router->generate('paypal_prepare_transaction_acdc');
  534.         $parameters['PayPalCheckout']['bank_transfer_label'] = $PaymentBankTransfer->getMethod();
  535.         $parameters['PayPalCheckout']['credit_card_label'] = $PaymentCreditCard->getMethod();
  536.         $parameters['PayPalCheckout']['inline_guest_label'] = $PaymentInlineGuest->getMethod();
  537.         $parameters['PayPalCheckout']['acdc_label'] = $PaymentAcdc->getMethod();
  538.         return [$snippet$parameters];
  539.     }
  540.     /**
  541.      * @return string
  542.      */
  543.     private function getPaymentBannerImageUrl(): string
  544.     {
  545.         /** @var string $selectedNumber */
  546.         $selectedNumber $this->Config->getPaymentPaypalLogo();
  547.         return $this->eccubeConfig->get("paypal.paypal_express_payment_paypal_logo_${selectedNumber}");
  548.     }
  549. }