Skip to content

Commit e96aab9

Browse files
committed
Rename create/update/delete with a sufix Card, add tests
1 parent 36f4d53 commit e96aab9

23 files changed

+135
-105
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,9 @@ try {
351351
Token billing is still under development. Most likely gateways will be able to implement the
352352
following methods:
353353

354-
* `create($options)` - returns a response object which includes a `token`, which can be used for future transactions
355-
* `delete($options)` - remove a stored card, not all gateways support this method
354+
* `createCard($options)` - returns a response object which includes a `token`, which can be used for future transactions
355+
* `updateCard($options)` - update a stored card, not all gateways support this method
356+
* `deleteCard($options)` - remove a stored card, not all gateways support this method
356357

357358
## Recurring Billing
358359

example/index.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@
200200
));
201201
});
202202

203-
// create gateway create
204-
$app->get('/gateways/{name}/create', function($name) use ($app) {
203+
// create gateway create Credit Card
204+
$app->get('/gateways/{name}/create-card', function($name) use ($app) {
205205
$gateway = Omnipay\Common\GatewayFactory::create($name);
206206
$sessionVar = 'omnipay.'.$gateway->getShortName();
207207
$gateway->initialize((array) $app['session']->get($sessionVar));
@@ -211,14 +211,14 @@
211211

212212
return $app['twig']->render('request.twig', array(
213213
'gateway' => $gateway,
214-
'method' => 'create',
214+
'method' => 'createCard',
215215
'params' => $params,
216216
'card' => $card->getParameters(),
217217
));
218218
});
219219

220-
// submit gateway create
221-
$app->post('/gateways/{name}/create', function($name) use ($app) {
220+
// submit gateway create Credit Card
221+
$app->post('/gateways/{name}/create-card', function($name) use ($app) {
222222
$gateway = Omnipay\Common\GatewayFactory::create($name);
223223
$sessionVar = 'omnipay.'.$gateway->getShortName();
224224
$gateway->initialize((array) $app['session']->get($sessionVar));
@@ -233,16 +233,16 @@
233233

234234
$params['card'] = $card;
235235
$params['clientIp'] = $app['request']->getClientIp();
236-
$response = $gateway->create($params)->send();
236+
$response = $gateway->createCard($params)->send();
237237

238238
return $app['twig']->render('response.twig', array(
239239
'gateway' => $gateway,
240240
'response' => $response,
241241
));
242242
});
243243

244-
// create gateway update
245-
$app->get('/gateways/{name}/update', function($name) use ($app) {
244+
// create gateway update Credit Card
245+
$app->get('/gateways/{name}/update-card', function($name) use ($app) {
246246
$gateway = Omnipay\Common\GatewayFactory::create($name);
247247
$sessionVar = 'omnipay.'.$gateway->getShortName();
248248
$gateway->initialize((array) $app['session']->get($sessionVar));
@@ -252,14 +252,14 @@
252252

253253
return $app['twig']->render('request.twig', array(
254254
'gateway' => $gateway,
255-
'method' => 'update',
255+
'method' => 'updateCard',
256256
'params' => $params,
257257
'card' => $card->getParameters(),
258258
));
259259
});
260260

261-
// submit gateway update
262-
$app->post('/gateways/{name}/update', function($name) use ($app) {
261+
// submit gateway update Credit Card
262+
$app->post('/gateways/{name}/update-card', function($name) use ($app) {
263263
$gateway = Omnipay\Common\GatewayFactory::create($name);
264264
$sessionVar = 'omnipay.'.$gateway->getShortName();
265265
$gateway->initialize((array) $app['session']->get($sessionVar));
@@ -274,16 +274,16 @@
274274

275275
$params['card'] = $card;
276276
$params['clientIp'] = $app['request']->getClientIp();
277-
$response = $gateway->update($params)->send();
277+
$response = $gateway->updateCard($params)->send();
278278

279279
return $app['twig']->render('response.twig', array(
280280
'gateway' => $gateway,
281281
'response' => $response,
282282
));
283283
});
284284

285-
// create gateway delete
286-
$app->get('/gateways/{name}/delete', function($name) use ($app) {
285+
// create gateway delete Credit Card
286+
$app->get('/gateways/{name}/delete-card', function($name) use ($app) {
287287
$gateway = Omnipay\Common\GatewayFactory::create($name);
288288
$sessionVar = 'omnipay.'.$gateway->getShortName();
289289
$gateway->initialize((array) $app['session']->get($sessionVar));
@@ -292,13 +292,13 @@
292292

293293
return $app['twig']->render('request.twig', array(
294294
'gateway' => $gateway,
295-
'method' => 'delete',
295+
'method' => 'deleteCard',
296296
'params' => $params,
297297
));
298298
});
299299

300-
// submit gateway delete
301-
$app->post('/gateways/{name}/delete', function($name) use ($app) {
300+
// submit gateway delete Credit Card
301+
$app->post('/gateways/{name}/delete-card', function($name) use ($app) {
302302
$gateway = Omnipay\Common\GatewayFactory::create($name);
303303
$sessionVar = 'omnipay.'.$gateway->getShortName();
304304
$gateway->initialize((array) $app['session']->get($sessionVar));
@@ -310,7 +310,7 @@
310310
$app['session']->set($sessionVar.'.delete', $params);
311311

312312
$params['clientIp'] = $app['request']->getClientIp();
313-
$response = $gateway->delete($params)->send();
313+
$response = $gateway->deleteCard($params)->send();
314314

315315
return $app['twig']->render('response.twig', array(
316316
'gateway' => $gateway,

example/views/gateway.twig

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ $response = $gateway->initialize($params);</pre>
4242
{% if gateway.supportsVoid() %}
4343
<li>void()</li>
4444
{% endif %}
45-
{% if gateway.supportsCreate() %}
46-
<li><a href="/gateways/{{gateway.shortName}}/create">create()</a></li>
45+
{% if gateway.supportsCreateCard() %}
46+
<li><a href="/gateways/{{gateway.shortName}}/create-card">createCard()</a></li>
4747
{% endif %}
48-
{% if gateway.supportsUpdate() %}
49-
<li><a href="/gateways/{{gateway.shortName}}/update">update()</a></li>
48+
{% if gateway.supportsUpdateCard() %}
49+
<li><a href="/gateways/{{gateway.shortName}}/update-card">updateCard()</a></li>
5050
{% endif %}
51-
{% if gateway.supportsDelete() %}
52-
<li><a href="/gateways/{{gateway.shortName}}/delete">delete()</a></li>
51+
{% if gateway.supportsDeleteCard() %}
52+
<li><a href="/gateways/{{gateway.shortName}}/delete-card">deleteCard()</a></li>
5353
{% endif %}
5454
</ul>
5555

src/Omnipay/Common/AbstractGateway.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,33 +170,33 @@ public function supportsVoid()
170170
}
171171

172172
/**
173-
* Supports Create
173+
* Supports CreateCard
174174
*
175175
* @return boolean True if this gateway supports the create() method
176176
*/
177-
public function supportsCreate()
177+
public function supportsCreateCard()
178178
{
179-
return method_exists($this, 'create');
179+
return method_exists($this, 'createCard');
180180
}
181181

182182
/**
183-
* Supports Delete
183+
* Supports DeleteCard
184184
*
185185
* @return boolean True if this gateway supports the delete() method
186186
*/
187-
public function supportsDelete()
187+
public function supportsDeleteCard()
188188
{
189-
return method_exists($this, 'delete');
189+
return method_exists($this, 'deleteCard');
190190
}
191191

192192
/**
193-
* Supports Update
193+
* Supports UpdateCard
194194
*
195195
* @return boolean True if this gateway supports the update() method
196196
*/
197-
public function supportsUpdate()
197+
public function supportsUpdateCard()
198198
{
199-
return method_exists($this, 'update');
199+
return method_exists($this, 'updateCard');
200200
}
201201

202202
/**

src/Omnipay/PaymentExpress/Message/PxPostCreateRequest.php renamed to src/Omnipay/PaymentExpress/Message/PxPostCreateCardRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
namespace Omnipay\PaymentExpress\Message;
1313

1414
/**
15-
* PaymentExpress PxPost Create Request
15+
* PaymentExpress PxPost Create Credit Card Request
1616
*/
17-
class PxPostCreateRequest extends PxPostAuthorizeRequest
17+
class PxPostCreateCardRequest extends PxPostAuthorizeRequest
1818
{
1919
public function getData()
2020
{

src/Omnipay/PaymentExpress/PxPostGateway.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ public function refund(array $parameters = array())
7575
return $this->createRequest('\Omnipay\PaymentExpress\Message\PxPostRefundRequest', $parameters);
7676
}
7777

78-
public function create(array $parameters = array())
78+
public function createCard(array $parameters = array())
7979
{
80-
return $this->createRequest('\Omnipay\PaymentExpress\Message\PxPostCreateRequest', $parameters);
80+
return $this->createRequest('\Omnipay\PaymentExpress\Message\PxPostCreateCardRequest', $parameters);
8181
}
8282
}

src/Omnipay/Stripe/Gateway.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,18 @@ public function refund(array $parameters = array())
5454
return $this->createRequest('\Omnipay\Stripe\Message\RefundRequest', $parameters);
5555
}
5656

57-
public function create(array $parameters = array())
57+
public function createCard(array $parameters = array())
5858
{
59-
return $this->createRequest('\Omnipay\Stripe\Message\CreateRequest', $parameters);
59+
return $this->createRequest('\Omnipay\Stripe\Message\CreateCardRequest', $parameters);
6060
}
6161

62-
public function update(array $parameters = array())
62+
public function updateCard(array $parameters = array())
6363
{
64-
return $this->createRequest('\Omnipay\Stripe\Message\UpdateRequest', $parameters);
64+
return $this->createRequest('\Omnipay\Stripe\Message\UpdateCardRequest', $parameters);
6565
}
6666

67-
public function delete(array $parameters = array())
67+
public function deleteCard(array $parameters = array())
6868
{
69-
return $this->createRequest('\Omnipay\Stripe\Message\DeleteRequest', $parameters);
69+
return $this->createRequest('\Omnipay\Stripe\Message\DeleteCardRequest', $parameters);
7070
}
7171
}

src/Omnipay/Stripe/Message/CreateRequest.php renamed to src/Omnipay/Stripe/Message/CreateCardRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
namespace Omnipay\Stripe\Message;
1313

1414
/**
15-
* Stripe Create Request
15+
* Stripe Create Credit Card Request
1616
*/
17-
class CreateRequest extends PurchaseRequest
17+
class CreateCardRequest extends PurchaseRequest
1818
{
1919
public function getData()
2020
{

src/Omnipay/Stripe/Message/DeleteRequest.php renamed to src/Omnipay/Stripe/Message/DeleteCardRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
namespace Omnipay\Stripe\Message;
1313

1414
/**
15-
* Stripe Delete Request
15+
* Stripe Delete Credit Card Request
1616
*/
17-
class DeleteRequest extends PurchaseRequest
17+
class DeleteCardRequest extends PurchaseRequest
1818
{
1919
public function getData()
2020
{

src/Omnipay/Stripe/Message/UpdateRequest.php renamed to src/Omnipay/Stripe/Message/UpdateCardRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
namespace Omnipay\Stripe\Message;
1313

1414
/**
15-
* Stripe Update Request
15+
* Stripe Update Credit Card Request
1616
*/
17-
class UpdateRequest extends PurchaseRequest
17+
class UpdateCardRequest extends PurchaseRequest
1818
{
1919
public function getData()
2020
{

0 commit comments

Comments
 (0)