Issues (28)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/Iris/SaleWrapper/Venture.php (2 issues)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Iris\SaleWrapper;
4
5
class Venture extends Base
6
{
7
    /**
8
     * @return \Iris\Interfaces\IrisPartner
9
     */
10 7
    public function getPartnerService()
11
    {
12 7
        return $this->getManager()->getService(\Iris\Factory::PARTNER);
13
    }
14
15
    /**
16
     * @return \Iris\Interfaces\Customer
17
     */
18 2
    public function getCustomerService()
19
    {
20 2
        return $this->getManager()->getService(\Iris\Factory::CUSTOMER);
21
    }
22
23
    /**
24
     * Create order from partner
25
     *
26
     * @param array  $orderData
27
     * @param string $originCode
28
     * @return array returns an array with order_number like: ['order_number' => 123].
29
     * @throws \Iris\Exceptions\PartnerNotFound
30
     * @throws \Iris\Exceptions\UnableToCreateCustomer
31
     * @throws \Iris\Exceptions\UnableToCreateOrder
32
     * @throws \Iris\Exceptions\UnableToSaveExternalData
33
     */
34 2
    public function createOrder(array $orderData, $originCode)
35
    {
36 2
        $partner = $this->getPartnerService()->findByCode($originCode);
37
38 2
        $salesOrder = $this->getOrderMapping()->assign($orderData);
39
40 2
        $salesOrder->setCustomer(
41 2
            $this->getCustomerService()
42 2
                 ->create($salesOrder->getCustomer())
43 2
        );
44
45
        try {
46 2
            $order = $this->getOrderService()->getOrderByOrderNumberAndPartnerCode(
47 2
                $orderData['order_number'],
48 2
                $partner->getPartnerCode()
49 2
            );
50 1
            $result = array('order_number' => $order->getOrderNr());
51
52 2
        } catch (\Iris\Exceptions\OrderNotFound $exception) {
53 1
            $salesOrder = $this->getOrderService()->save($salesOrder);
54 1
            $result = array('order_number' => $salesOrder->getOrderNr());
55
        }
56
57 2
        return $result;
58
    }
59
60
    /**
61
     * Confirm payment from partner
62
     *
63
     * @param string $orderNr
64
     * @param string $originCode
65
     * @return array returns an array with order_number like: ['order_number' => 123].
66
     * @throws \Iris\Exceptions\OrderNotFound
67
     * @throws \Iris\Exceptions\PartnerNotFound
68
     * @throws \Iris\Exceptions\UnableToConfirmOrder
69
     */
70 2
    public function confirmPaymentOrder($orderNr, $originCode)
71
    {
72 2
        $partner = $this->getPartnerService()->findByCode($originCode);
73 2
        $order = $this->getOrderService()->getOrderByOrderNumberAndPartnerCode(
74 2
            $orderNr,
75 2
            $partner->getPartnerCode()
76 2
        );
77 2
        if (!$this->getOrderService()->confirmPayment($order)) {
78 1
            throw new \RuntimeException(sprintf('Order number %s can\'t be confirmed', $orderNr));
79
        }
80 1
        return array('order_number' => $order->getOrderNr());
81
    }
82
83
    /**
84
     * Cancel order from partner
85
     *
86
     * @param string $orderNr
87
     * @param string $originCode
88
     * @return array returns an array with order_number like: ['order_number' => 123].
89
     * @throws \Iris\Exceptions\OrderNotFound
90
     * @throws \Iris\Exceptions\PartnerNotFound
91
     * @throws \Iris\Exceptions\UnableToCancelOrder
92
     */
93 2
    public function cancelOrder($orderNr, $originCode)
94
    {
95 2
        $partner = $this->getPartnerService()->findByCode($originCode);
96 2
        $order = $this->getOrderService()->getOrderByOrderNumberAndPartnerCode(
97 2
            $orderNr,
98 2
            $partner->getPartnerCode()
99 2
        );
100 2
        if (!$this->getOrderService()->cancel($order)) {
101 1
            throw new \RuntimeException(sprintf('Order number %s can\'t be canceled', $orderNr));
102
        }
103 1
        return array('order_number' => $order->getOrderNr());
104
    }
105
106
    /**
107
     * Create products on partner
108
     *
109
     * @param \Iris\Transfer\Catalog\ConfigCollection $products
0 ignored issues
show
There is no parameter named $products. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
110
     * @param string $partnerCode
111
     * @return bool
112
     * @throws \Iris\Exceptions\RetryMessage
113
     */
114 1
    public function createProductsOnPartner(
115
        \Iris\Transfer\Catalog\ConfigCollection $configCollection,
116
        $partnerCode
117
    ) {
118 1
        $this->getVentureApiClient()->createProducts(
119 1
            $configCollection,
120
            $partnerCode
121 1
        );
122 1
    }
123
124
    /**
125
     * Update products on partner
126
     *
127
     * @param \Iris\Transfer\Catalog\ConfigCollection $products
0 ignored issues
show
There is no parameter named $products. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
128
     * @return bool
129
     * @throws \Iris\Exceptions\RetryMessage
130
     */
131 1
    public function updateProductsOnPartner(
132
        \Iris\Transfer\Catalog\ConfigCollection $configCollection
133
    ) {
134 1
        $this->getVentureApiClient()->updateProducts($configCollection);
135 1
    }
136
137
    /**
138
     * Update stock on partner
139
     *
140
     * @param string $skuSimple
141
     * @param int $stock
142
     * @return bool
143
     * @throws \Iris\Exceptions\RetryMessage
144
     */
145 1
    public function updateStockOnPartner($skuSimple, $stock)
146
    {
147 1
        $this->getVentureApiClient()->updateStock($skuSimple, $stock);
148 1
    }
149
150
    /**
151
     * Update price on partner
152
     *
153
     * @param string $skuSimple
154
     * @param float $price
155
     * @param float $specialPrice
156
     * @param string $specialFromDate
157
     * @param string $specialToDate
158
     * @return bool
159
     * @throws \Iris\Exceptions\RetryMessage
160
     */
161 1
    public function updatePriceOnPartner(
162
        $skuSimple,
163
        $price,
164
        $specialPrice = null,
165
        $specialFromDate = null,
166
        $specialToDate = null
167
    ) {
168 1
        $this->getVentureApiClient()->updatePrice(
169 1
            $skuSimple,
170 1
            $price,
171 1
            $specialPrice ?: $price,
172 1
            $specialFromDate,
173
            $specialToDate
174 1
        );
175 1
    }
176
177
    /**
178
     * Change order items to shipped status
179
     *
180
     * @param \Iris\Transfer\Tracking\ShippedCollection
181
     * @return bool|\GuzzleHttp\Message\Response
182
     * @throws \Iris\Exceptions\RetryMessage
183
     */
184 1
    public function setStatusToShippedOnPartner(
185
        \Iris\Transfer\Tracking\ShippedCollection $items
186
    ) {
187 1
        return $this->getVentureApiClient()->setStatusToShippedOnPartner($items);
188
    }
189
190
    /**
191
     * Change order items to delivered status
192
     *
193
     * @param \Iris\Transfer\Tracking\DeliveredCollection
194
     * @return bool|\GuzzleHttp\Message\Response
195
     * @throws \Iris\Exceptions\RetryMessage
196
     */
197 1
    public function setStatusToDeliveredOnPartner(
198
        \Iris\Transfer\Tracking\DeliveredCollection $items
199
    ) {
200 1
        return $this->getVentureApiClient()->setStatusToDeliveredOnPartner($items);
201
    }
202
203
    /**
204
     * Change order items canceled status
205
     *
206
     * @param \Iris\Transfer\Tracking\CanceledCollection
207
     * @return bool|\GuzzleHttp\Message\Response
208
     * @throws \Iris\Exceptions\RetryMessage
209
     */
210 1
    public function setStatusToCanceledOnPartner(
211
        \Iris\Transfer\Tracking\CanceledCollection $items
212
    ) {
213 1
        return $this->getVentureApiClient()->setStatusToCanceledOnPartner($items);
214
    }
215
216
    /**
217
     * Change order items to failed delivery status
218
     *
219
     * @param \Iris\Transfer\Tracking\FailedDeliveryCollection
220
     * @return bool|\GuzzleHttp\Message\Response
221
     * @throws \Iris\Exceptions\RetryMessage
222
     */
223 1
    public function setStatusToFailedDeliveryOnPartner(
224
        \Iris\Transfer\Tracking\FailedDeliveryCollection $items
225
    ) {
226 1
        return $this->getVentureApiClient()->setStatusToFailedDeliveryOnPartner($items);
227
    }
228
}
229