Issues (5)

Security Analysis    not enabled

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/Message/XmlSettlementRequest.php (1 issue)

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
 * w-vision
4
 *
5
 * LICENSE
6
 *
7
 * This source file is subject to the MIT License
8
 * For the full copyright and license information, please view the LICENSE.md
9
 * file that are distributed with this source code.
10
 *
11
 * @copyright  Copyright (c) 2016 Woche-Pass AG (http://www.w-vision.ch)
12
 * @license    MIT License
13
 */
14
15
namespace Omnipay\Datatrans\Message;
16
17
/**
18
 * Class XmlSettlementRequest
19
 *
20
 * @package Omnipay\Datatrans\Message
21
 */
22
class XmlSettlementRequest extends XmlRequest
23
{
24
    /**
25
     * @var array
26
     */
27
    protected $optionalParameters = array(
28
        'transtype', 'acqAuthorizationCode', 'errorEmail'
29
    );
30
31
    /**
32
     * @var string
33
     */
34
    protected $apiEndpoint = 'XML_processor.jsp';
35
36
    /**
37
     * @var string
38
     */
39
    protected $serviceName = 'paymentService';
40
41
    /**
42
     * @var int
43
     */
44
    protected $serviceVersion = 3;
45
46
    /**
47
     * Settlement Debit/Credit
48
     */
49
    const DATATRANS_REQUEST_TYPE_COA = 'COA';
50
51
    /**
52
     * Submission of acqAuthorizationCode after referral
53
     */
54
    const DATATRANS_REQUEST_TYPE_REF = 'REF';
55
56
    /**
57
     * Submission of acqAuthorizationCode after denial
58
     */
59
    const DATATRANS_REQUEST_TYPE_REC = 'REC';
60
61
    /**
62
     * Transaction status request
63
     */
64
    const DATATRANS_REQUEST_TYPE_STA = 'STA';
65
66
    /**
67
     * Transaction cancel request
68
     */
69
    const DATATRANS_REQUEST_TYPE_DOA = 'DOA';
70
71
    /**
72
     * Re-Authorization of old transaction
73
     */
74
    const DATATRANS_REQUEST_TYPE_REA = 'REA';
75
76
    /**
77
     * Debit Transaction
78
     */
79
    const DATATRANS_TRANSACTION_TYPE_DEBIT = '05';
80
81
    /**
82
     * Credit Transaction
83
     */
84
    const DATATRANS_TRANSACTION_TYPE_CREDIT = '06';
85
86
    /**
87
     * @return array
88
     */
89 6
    public function getData()
90
    {
91 6
        $this->validate('merchantId', 'transactionId', 'sign', 'uppTransactionId');
92
93 6
        $requestType = $this->getRequestType();
94
95 6
        if (is_null($requestType)) {
96 5
            $requestType = self::DATATRANS_REQUEST_TYPE_COA;
97 5
        }
98
99
        $data = array(
100 6
            'merchantId'        => $this->getMerchantId(),
101 6
            'sign'              => $this->getSign(),
102 6
            'amount'            => $this->getAmountInteger(),
103 6
            'currency'          => $this->getCurrency(),
104 6
            'uppTransactionId'  => $this->getUppTransactionId(),
105 6
            'refno'             => $this->getTransactionId(),
106 6
            'reqtype'           => $requestType,
107 6
            'transtype'         => $this->getTransactionType()
108 6
        );
109
110 6 View Code Duplication
        foreach ($this->optionalParameters as $param) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
111 6
            $value = $this->getParameter($param);
112
113 6
            if ($value) {
114
                $data[$param] = $value;
115
            }
116 6
        }
117
118 6
        return $data;
119
    }
120
121
   /**
122
     * @param $value
123
     *
124
     * @return static
125
     */
126 8
    public function setUppTransactionId($value)
127
    {
128 8
        return $this->setParameter("uppTransactionId", $value);
129
    }
130
131
    /**
132
     * @return string
133
     */
134 8
    public function getUppTransactionId()
135
    {
136 8
        return $this->getParameter("uppTransactionId");
137
    }
138
139
    /**
140
     * @param $value
141
     *
142
     * @return static
143
     */
144
    public function setRequestType($value)
145
    {
146
        return $this->setParameter("requestType", $value);
147
    }
148
149
    /**
150
     * @return string
151
     */
152 5
    public function getRequestType()
153
    {
154 5
        return $this->getParameter("requestType");
155
    }
156
157
    /**
158
     * @return string
159
     */
160 2
    public function getTransactionType()
161
    {
162 2
        return static::DATATRANS_TRANSACTION_TYPE_DEBIT;
163
    }
164
165
    /**
166
     * @param $data
167
     * @return XmlResponse
168
     */
169 8
    protected function createResponse($data)
170
    {
171 8
        return $this->response = new XmlResponse($this, $data);
172
    }
173
}
174