Issues (41)

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.

code/DirectCreditPayment.php (39 issues)

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
/**
4
 * Payment object representing a DirectCredit payment.
5
 * @author Nicolaas [at] sunnysideup.co.nz
6
 * @package payment
7
 */
8 View Code Duplication
class DirectCreditPayment extends EcommercePayment
0 ignored issues
show
This class seems to be duplicated in 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...
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
9
{
10
11
    /**
12
     * Message shown before payment is made
13
     * @var String
14
     */
15
    private static $before_payment_message = "";
0 ignored issues
show
The property $before_payment_message is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
16
17
    /**
18
     * Message shown after payment is made
19
     * @var String
20
     */
21
    private static $after_payment_message = "";
0 ignored issues
show
The property $after_payment_message is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
22
23
    /**
24
     * Default Status for Payment
25
     * @var String
26
     */
27
    private static $default_status = "Pending";
0 ignored issues
show
The property $default_status is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
28
29
30
    /**
31
     * Process the DirectCredit payment method
32
     */
33
    public function processPayment($data, $form)
34
    {
35
        $this->Status = Config::inst()->get("DirectCreditPayment", "default_status");
0 ignored issues
show
The property Status does not seem to exist. Did you mean default_status?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
36
        $this->Message = Config::inst()->get("DirectCreditPayment", "after_payment_message");
0 ignored issues
show
The property Message does not seem to exist. Did you mean before_payment_message?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
37
        $this->write();
38
        return EcommercePayment_Success::create();
39
    }
40
41
    public function getPaymentFormFields()
42
    {
43
        return new FieldList(
44
            new LiteralField($this->ClassName.'_BeforeMessage', '<div id="'.$this->ClassName.'_BeforeMessage">' . Config::inst()->get("DirectCreditPayment", "before_payment_message") . '</div>'),
45
            new HiddenField($this->ClassName, $this->ClassName, 0)
46
        );
47
    }
48
49
    public function getPaymentFormRequirements()
50
    {
51
        return null;
52
    }
53
}
54
55 View Code Duplication
class DirectCreditPayment_ViaCreditCart extends EcommercePayment
0 ignored issues
show
This class seems to be duplicated in 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...
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
56
{
57
58
    /**
59
     * Message shown before payment is made
60
     * @var String
61
     */
62
    private static $before_payment_message = "";
0 ignored issues
show
The property $before_payment_message is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
63
64
    /**
65
     * Message shown after payment is made
66
     * @var String
67
     */
68
    private static $after_payment_message = "";
0 ignored issues
show
The property $after_payment_message is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
69
70
    /**
71
     * Default Status for Payment
72
     * @var String
73
     */
74
    private static $default_status = "Pending";
0 ignored issues
show
The property $default_status is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
75
76
    /**
77
     * Process the DirectCredit payment method
78
     */
79
    public function processPayment($data, $form)
80
    {
81
        $this->Status = Config::inst()->get("DirectCreditPayment_ViaCreditCart", "default_status");
0 ignored issues
show
The property Status does not seem to exist. Did you mean default_status?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
82
        $this->Message = Config::inst()->get("DirectCreditPayment_ViaCreditCart", "after_payment_message");
0 ignored issues
show
The property Message does not seem to exist. Did you mean before_payment_message?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
83
        $this->write();
84
        return EcommercePayment_Success::create();
85
    }
86
87
    public function getPaymentFormFields()
88
    {
89
        return new FieldList(
90
            new LiteralField($this->ClassName.'_BeforeMessage', '<div id="'.$this->ClassName.'_BeforeMessage">' . Config::inst()->get("DirectCreditPayment_ViaCreditCart", "before_payment_message") . '</div>'),
91
            new HiddenField($this->ClassName, $this->ClassName, 0)
92
        );
93
    }
94
95
    public function getPaymentFormRequirements()
96
    {
97
        return null;
98
    }
99
}
100
101 View Code Duplication
class DirectCreditPayment_ViaCheque extends EcommercePayment
0 ignored issues
show
This class seems to be duplicated in 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...
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
102
{
103
104
    /**
105
     * Message shown before payment is made
106
     * @var String
107
     */
108
    private static $before_payment_message = "";
0 ignored issues
show
The property $before_payment_message is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
109
110
    /**
111
     * Message shown after payment is made
112
     * @var String
113
     */
114
    private static $after_payment_message = "";
0 ignored issues
show
The property $after_payment_message is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
115
116
    /**
117
     * Default Status for Payment
118
     * @var String
119
     */
120
    private static $default_status = "Pending";
0 ignored issues
show
The property $default_status is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
121
122
    /**
123
     * Process the DirectCredit payment method
124
     */
125
    public function processPayment($data, $form)
126
    {
127
        $this->Status = Config::inst()->get("DirectCreditPayment_ViaCheque", "default_status");
0 ignored issues
show
The property Status does not seem to exist. Did you mean default_status?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
128
        $this->Message = Config::inst()->get("DirectCreditPayment_ViaCheque", "after_payment_message");
0 ignored issues
show
The property Message does not seem to exist. Did you mean before_payment_message?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
129
        $this->write();
130
        return EcommercePayment_Success::create();
131
    }
132
133
    public function getPaymentFormFields()
134
    {
135
        return new FieldList(
136
            new LiteralField($this->ClassName.'_BeforeMessage', '<div id="'.$this->ClassName.'_BeforeMessage">' . Config::inst()->get("DirectCreditPayment_ViaCheque", "before_payment_message") . '</div>'),
137
            new HiddenField($this->ClassName, $this->ClassName, 0)
138
        );
139
    }
140
141
    public function getPaymentFormRequirements()
142
    {
143
        return null;
144
    }
145
}
146
147 View Code Duplication
class DirectCreditPayment_TESTSUCCESS extends EcommercePayment
0 ignored issues
show
This class seems to be duplicated in 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...
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
148
{
149
150
    /**
151
     * Message shown before payment is made
152
     * @var String
153
     */
154
    private static $before_payment_message = "This is for testing purposes only";
0 ignored issues
show
The property $before_payment_message is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
155
156
    /**
157
     * Message shown after payment is made
158
     * @var String
159
     */
160
    private static $after_payment_message = "Payment is always successful";
0 ignored issues
show
The property $after_payment_message is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
161
162
    /**
163
     * Default Status for Payment
164
     * @var String
165
     */
166
    private static $default_status = "Success";
0 ignored issues
show
The property $default_status is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
167
168
    /**
169
     * Process the DirectCredit payment method
170
     */
171
    public function processPayment($data, $form)
172
    {
173
        $this->Status = Config::inst()->get("DirectCreditPayment_TESTSUCCESS", "default_status");
0 ignored issues
show
The property Status does not seem to exist. Did you mean default_status?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
174
        $this->Message = Config::inst()->get("DirectCreditPayment_TESTSUCCESS", "after_payment_message");
0 ignored issues
show
The property Message does not seem to exist. Did you mean before_payment_message?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
175
        $this->write();
176
        return EcommercePayment_Success::create();
177
    }
178
179
    public function getPaymentFormFields()
180
    {
181
        return new FieldList(
182
            new LiteralField($this->ClassName.'_BeforeMessage', '<div id="'.$this->ClassName.'_BeforeMessage">' . Config::inst()->get("DirectCreditPayment_TESTSUCCESS", "before_payment_message") . '</div>'),
183
            new HiddenField($this->ClassName, $this->ClassName, 0)
184
        );
185
    }
186
187
    public function getPaymentFormRequirements()
188
    {
189
        return null;
190
    }
191
}
192
193
194 View Code Duplication
class DirectCreditPayment_TESTFAILURE extends EcommercePayment
0 ignored issues
show
This class seems to be duplicated in 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...
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
195
{
196
197
    /**
198
     * Message shown before payment is made
199
     * @var String
200
     */
201
    private static $before_payment_message = "This is for testing purposes only";
0 ignored issues
show
The property $before_payment_message is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
202
203
    /**
204
     * Message shown after payment is made
205
     * @var String
206
     */
207
    private static $after_payment_message = "Payment is always unsuccessful";
0 ignored issues
show
The property $after_payment_message is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
208
209
    /**
210
     * Default Status for Payment
211
     * @var String
212
     */
213
    private static $default_status = "Failure";
0 ignored issues
show
The property $default_status is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
214
215
    /**
216
     * Process the DirectCredit payment method
217
     */
218
    public function processPayment($data, $form)
219
    {
220
        $this->Status = Config::inst()->get("DirectCreditPayment_TESTFAILURE", "default_status");
0 ignored issues
show
The property Status does not seem to exist. Did you mean default_status?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
221
        $this->Message = Config::inst()->get("DirectCreditPayment_TESTFAILURE", "after_payment_message");
0 ignored issues
show
The property Message does not seem to exist. Did you mean before_payment_message?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
222
        $this->write();
223
        return EcommercePayment_Success::create();
224
    }
225
226
    public function getPaymentFormFields()
227
    {
228
        return new FieldList(
229
            new LiteralField($this->ClassName.'_BeforeMessage', '<div id="'.$this->ClassName.'_BeforeMessage">' . Config::inst()->get("DirectCreditPayment_TESTFAILURE", "before_payment_message") . '</div>'),
230
            new HiddenField($this->ClassName, $this->ClassName, 0)
231
        );
232
    }
233
234
    public function getPaymentFormRequirements()
235
    {
236
        return null;
237
    }
238
}
239