Skip to content

Commit be11bd3

Browse files
author
iampersistent
committed
add support for MerchantAccounts
1 parent 86b34dd commit be11bd3

14 files changed

+1787
-0
lines changed

src/Gateway.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,24 @@ public function find(array $parameters = array())
149149
return $this->createRequest('\Omnipay\Braintree\Message\FindRequest', $parameters);
150150
}
151151

152+
/**
153+
* @param array $parameters
154+
* @return Message\CreateMerchantAccountRequest
155+
*/
156+
public function createMerchantAccount(array $parameters = array())
157+
{
158+
return $this->createRequest('\Omnipay\Braintree\Message\CreateMerchantAccountRequest', $parameters);
159+
}
160+
161+
/**
162+
* @param array $parameters
163+
* @return Message\UpdateMerchantAccountRequest
164+
*/
165+
public function updateMerchantAccount(array $parameters = array())
166+
{
167+
return $this->createRequest('\Omnipay\Braintree\Message\UpdateMerchantAccountRequest', $parameters);
168+
}
169+
152170
/**
153171
* @param array $parameters
154172
* @return Message\CreatePaymentMethodRequest

src/MerchantBusiness.php

Lines changed: 264 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,264 @@
1+
<?php
2+
3+
namespace Omnipay\Braintree;
4+
5+
use DateTime;
6+
use DateTimeZone;
7+
use Omnipay\Common\Helper;
8+
use Symfony\Component\HttpFoundation\ParameterBag;
9+
10+
/**
11+
* Data for an individual, used to create a MerchantAccount.
12+
*
13+
* The following parameters can be set:
14+
*
15+
* city
16+
* dbaName
17+
* email
18+
* legalName
19+
* postCode
20+
* state
21+
* streetAddress
22+
* taxId
23+
*/
24+
class MerchantBusiness
25+
{
26+
/**
27+
* Internal storage of all of the individual parameters.
28+
*
29+
* @var \Symfony\Component\HttpFoundation\ParameterBag
30+
*/
31+
protected $parameters;
32+
33+
/**
34+
* Create a new MerchantIndividual object using the specified parameters
35+
*
36+
* @param array $parameters An array of parameters to set on the new object
37+
*/
38+
public function __construct($parameters = null)
39+
{
40+
$this->initialize($parameters);
41+
}
42+
43+
/**
44+
* @return mixed
45+
*/
46+
public function getAddress1()
47+
{
48+
return $this->getParameter('address1');
49+
}
50+
51+
/**
52+
* @param mixed $streetAddress
53+
* @return $this
54+
*/
55+
public function setAddress1($streetAddress)
56+
{
57+
$this->setParameter('address1', $streetAddress);
58+
59+
return $this;
60+
}
61+
62+
/**
63+
* @return mixed
64+
*/
65+
public function getCity()
66+
{
67+
return $this->getParameter('city');
68+
}
69+
70+
/**
71+
* @param string $city
72+
* @return $this
73+
*/
74+
public function setCity($city)
75+
{
76+
$this->setParameter('city', $city);
77+
78+
return $this;
79+
}
80+
81+
/**
82+
* @return mixed
83+
*/
84+
public function getDbaName()
85+
{
86+
return $this->getParameter('dbaName');
87+
}
88+
89+
/**
90+
* @param string $dbaName
91+
* @return $this
92+
*/
93+
public function setDbaName($dbaName)
94+
{
95+
$this->setParameter('dbaName', $dbaName);
96+
97+
return $this;
98+
}
99+
100+
/**
101+
* @return mixed
102+
*/
103+
public function getEmail()
104+
{
105+
return $this->getParameter('email');
106+
}
107+
108+
/**
109+
* @param mixed $email
110+
* @return $this
111+
*/
112+
public function setEmail($email)
113+
{
114+
$this->setParameter('email', $email);
115+
116+
return $this;
117+
}
118+
119+
/**
120+
* @return mixed
121+
*/
122+
public function getLegalName()
123+
{
124+
return $this->getParameter('legalName');
125+
}
126+
127+
/**
128+
* @param string $legalName
129+
* @return $this
130+
*/
131+
public function setLegalName($legalName)
132+
{
133+
$this->setParameter('legalName', $legalName);
134+
135+
return $this;
136+
}
137+
138+
/**
139+
* Initialize the object with parameters.
140+
*
141+
* If any unknown parameters passed, they will be ignored.
142+
*
143+
* @param array $parameters An associative array of parameters
144+
* @return CreditCard provides a fluent interface.
145+
*/
146+
public function initialize($parameters = null)
147+
{
148+
$this->parameters = new ParameterBag();
149+
150+
Helper::initialize($this, $parameters);
151+
152+
return $this;
153+
}
154+
155+
/**
156+
* Get all parameters.
157+
*
158+
* @return array An associative array of parameters.
159+
*/
160+
public function getParameters()
161+
{
162+
return $this->parameters->all();
163+
}
164+
165+
/**
166+
* @return mixed
167+
*/
168+
public function getPhone()
169+
{
170+
return $this->getParameter('phone');
171+
}
172+
173+
/**
174+
* @param mixed $phone
175+
* @return $this
176+
*/
177+
public function setPhone($phone)
178+
{
179+
$this->setParameter('phone', $phone);
180+
181+
return $this;
182+
}
183+
184+
/**
185+
* @return mixed
186+
*/
187+
public function getPostCode()
188+
{
189+
return $this->getParameter('postCode');
190+
}
191+
192+
/**
193+
* @param mixed $postCode
194+
* @return $this
195+
*/
196+
public function setPostCode($postCode)
197+
{
198+
$this->setParameter('postCode', $postCode);
199+
200+
return $this;
201+
}
202+
203+
/**
204+
* @return mixed
205+
*/
206+
public function getState()
207+
{
208+
return $this->getParameter('state');
209+
}
210+
211+
/**
212+
* @param string $state
213+
* @return $this
214+
*/
215+
public function setState($state)
216+
{
217+
$this->setParameter('state', $state);
218+
219+
return $this;
220+
}
221+
222+
/**
223+
* @return mixed
224+
*/
225+
public function getTaxId()
226+
{
227+
return $this->getParameter('taxId');
228+
}
229+
230+
/**
231+
* @param string $taxId
232+
* @return $this
233+
*/
234+
public function setTaxId($taxId)
235+
{
236+
$this->setParameter('taxId', $taxId);
237+
238+
return $this;
239+
}
240+
241+
/**
242+
* Get one parameter.
243+
*
244+
* @return mixed A single parameter value.
245+
*/
246+
protected function getParameter($key)
247+
{
248+
return $this->parameters->get($key);
249+
}
250+
251+
/**
252+
* Set one parameter.
253+
*
254+
* @param string $key Parameter key
255+
* @param mixed $value Parameter value
256+
* @return CreditCard provides a fluent interface.
257+
*/
258+
protected function setParameter($key, $value)
259+
{
260+
$this->parameters->set($key, $value);
261+
262+
return $this;
263+
}
264+
}

0 commit comments

Comments
 (0)