Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AddPaypalOrderStatuses.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Quote\Setup\QuoteSetupFactory;
10 use Magento\Sales\Setup\SalesSetupFactory;
14 
20 {
24  private $moduleDataSetup;
25 
29  private $quoteSetupFactory;
30 
34  private $salesSetupFactory;
35 
42  public function __construct(
43  \Magento\Framework\Setup\ModuleDataSetupInterface $moduleDataSetup,
44  QuoteSetupFactory $quoteSetupFactory,
45  SalesSetupFactory $salesSetupFactory
46  ) {
47  $this->moduleDataSetup = $moduleDataSetup;
48  $this->quoteSetupFactory = $quoteSetupFactory;
49  $this->salesSetupFactory = $salesSetupFactory;
50  }
51 
55  public function apply()
56  {
60  $this->moduleDataSetup->getConnection()->startSetup();
61 
62  $quoteInstaller = $this->quoteSetupFactory->create();
63  $salesInstaller = $this->salesSetupFactory->create();
69  $quoteInstaller->addAttribute('quote_payment', 'paypal_payer_id', []);
70  $quoteInstaller->addAttribute('quote_payment', 'paypal_payer_status', []);
71  $quoteInstaller->addAttribute('quote_payment', 'paypal_correlation_id', []);
72  $salesInstaller->addAttribute(
73  'order',
74  'paypal_ipn_customer_notified',
75  ['type' => 'int', 'visible' => false, 'default' => 0]
76  );
77  $data = [];
78  $statuses = [
79  'pending_paypal' => __('Pending PayPal'),
80  'paypal_reversed' => __('PayPal Reversed'),
81  'paypal_canceled_reversal' => __('PayPal Canceled Reversal'),
82  ];
83  foreach ($statuses as $code => $info) {
84  $data[] = ['status' => $code, 'label' => $info];
85  }
86  $this->moduleDataSetup->getConnection()->insertArray(
87  $this->moduleDataSetup->getTable('sales_order_status'),
88  ['status', 'label'],
89  $data
90  );
94  $this->moduleDataSetup->getConnection()->endSetup();
95  }
96 
100  public static function getDependencies()
101  {
102  return [];
103  }
104 
108  public static function getVersion()
109  {
110  return '2.0.0';
111  }
112 
116  public function getAliases()
117  {
118  return [];
119  }
120 }
__construct(\Magento\Framework\Setup\ModuleDataSetupInterface $moduleDataSetup, QuoteSetupFactory $quoteSetupFactory, SalesSetupFactory $salesSetupFactory)
__()
Definition: __.php:13
foreach( $_productCollection as $_product)() ?>" class $info
Definition: listing.phtml:52
$code
Definition: info.phtml:12