Issues (4)

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/RequestData/RateTrait.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
namespace Omnipay\BillPay\Message\RequestData;
4
5
use Omnipay\BillPay\Message\AuthorizeRequest;
6
use Omnipay\Common\Exception\InvalidRequestException;
7
use Omnipay\Common\Message\AbstractRequest;
8
use SimpleXMLElement;
9
10
/**
11
 * Class RateTrait.
12
 *
13
 * @author    Andreas Lange <[email protected]>
14
 * @copyright 2016, Connox GmbH
15
 * @license   MIT
16
 */
17
trait RateTrait
18
{
19
    /**
20
     * Get the payment issuer.
21
     *
22
     * @return string
23
     *
24
     * @codeCoverageIgnore
25
     */
26
    abstract public function getPaymentMethod();
27
28
    /**
29
     * Gets count of installments to be paid during the term.
30
     *
31
     * @return int|null Count of installments to be paid during the term.
32
     */
33 3
    public function getRateCount()
34
    {
35 3
        return $this->getParameter('rateCount');
36
    }
37
38
    /**
39
     * Gets term of the installment plan.
40
     *
41
     * @return int|null months
42
     */
43 3
    public function getRateTerm()
44
    {
45 3
        return $this->getParameter('rateTerm');
46
    }
47
48
    /**
49
     * Gets total amount of the installments plan including the transaction credit interest / PayLater fee.
50
     *
51
     * @return float|null adjusted amount including all fees and interest
52
     */
53 3
    public function getRateTotalAmount()
54
    {
55 3
        return $this->getParameter('rateTotalAmount');
56
    }
57
58
    /**
59
     * Sets count of installments to be paid during the term.
60
     *
61
     * @param string $value Count of installments to be paid during the term.
62
     *
63
     * @return AuthorizeRequest
64
     */
65 11
    public function setRateCount($value)
66
    {
67 11
        return $this->setParameter('rateCount', $value);
68
    }
69
70
    /**
71
     * Sets term of the installment plan.
72
     *
73
     * @param int $value months
74
     *
75
     * @return AuthorizeRequest
76
     */
77 11
    public function setRateTerm($value)
78
    {
79 11
        return $this->setParameter('rateTerm', $value);
80
    }
81
82
    /**
83
     * Sets total amount of the installments plan including the transaction credit interest / PayLater fee.
84
     *
85
     * @param float $value
86
     *
87
     * @return AuthorizeRequest
88
     */
89 11
    public function setRateTotalAmount($value)
90
    {
91 11
        return $this->setParameter('rateTotalAmount', $value);
92
    }
93
94
    /**
95
     * Appends the rate request node to the SimpleXMLElement.
96
     *
97
     * @param SimpleXMLElement $data
98
     *
99
     * @throws InvalidRequestException
100
     */
101 9 View Code Duplication
    protected function appendRate(SimpleXMLElement $data)
0 ignored issues
show
This method 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...
102
    {
103 9
        if ($this->getPaymentMethod() !== 'pay_later') {
104 7
            return;
105
        }
106
107 2
        $data->addChild('rate_request');
108 2
        $data->rate_request[0]['term'] = $this->getRateTerm();
109 2
        $data->rate_request[0]['ratecount'] = $this->getRateCount();
110 2
        $data->rate_request[0]['totalamount'] = round(bcmul($this->getRateTotalAmount(), 100, 8));
111 2
    }
112
113
    /**
114
     * Get a single parameter.
115
     *
116
     * @param string $key The parameter key
117
     *
118
     * @return mixed
119
     *
120
     * @codeCoverageIgnore
121
     */
122
    abstract protected function getParameter($key);
123
124
    /**
125
     * Set a single parameter.
126
     *
127
     * @param string $key   The parameter key
128
     * @param mixed  $value The value to set
129
     *
130
     * @return AbstractRequest Provides a fluent interface
131
     *
132
     * @codeCoverageIgnore
133
     */
134
    abstract protected function setParameter($key, $value);
135
}
136