Skip to content

Commit ac4fc23

Browse files
committed
Merge pull request #50 from pilot/renaming
Globar renamed store/create, unstore/delete gateway requests
2 parents 0831779 + e96aab9 commit ac4fc23

23 files changed

+147
-117
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-
* `store($options)` - returns a response object which includes a `token`, which can be used for future transactions
355-
* `unstore($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: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -200,25 +200,25 @@
200200
));
201201
});
202202

203-
// create gateway store
204-
$app->get('/gateways/{name}/store', 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));
208208

209-
$params = $app['session']->get($sessionVar.'.store', array());
209+
$params = $app['session']->get($sessionVar.'.create', array());
210210
$card = new Omnipay\Common\CreditCard($app['session']->get($sessionVar.'.card'));
211211

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

220-
// submit gateway store
221-
$app->post('/gateways/{name}/store', 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));
@@ -228,21 +228,21 @@
228228
$card = $app['request']->get('card');
229229

230230
// save POST data into session
231-
$app['session']->set($sessionVar.'.store', $params);
231+
$app['session']->set($sessionVar.'.create', $params);
232232
$app['session']->set($sessionVar.'.card', $card);
233233

234234
$params['card'] = $card;
235235
$params['clientIp'] = $app['request']->getClientIp();
236-
$response = $gateway->store($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,31 +274,31 @@
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 unstore
286-
$app->get('/gateways/{name}/unstore', 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));
290290

291-
$params = $app['session']->get($sessionVar.'.unstore', array());
291+
$params = $app['session']->get($sessionVar.'.delete', array());
292292

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

300-
// submit gateway unstore
301-
$app->post('/gateways/{name}/unstore', 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));
@@ -307,10 +307,10 @@
307307
$params = $app['request']->get('params');
308308

309309
// save POST data into session
310-
$app['session']->set($sessionVar.'.unstore', $params);
310+
$app['session']->set($sessionVar.'.delete', $params);
311311

312312
$params['clientIp'] = $app['request']->getClientIp();
313-
$response = $gateway->unstore($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.supportsStore() %}
46-
<li><a href="/gateways/{{gateway.shortName}}/store">store()</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.supportsUnstore() %}
52-
<li><a href="/gateways/{{gateway.shortName}}/unstore">unstore()</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: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -170,33 +170,33 @@ public function supportsVoid()
170170
}
171171

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

182182
/**
183-
* Supports Unstore
183+
* Supports DeleteCard
184184
*
185-
* @return boolean True if this gateway supports the unstore() method
185+
* @return boolean True if this gateway supports the delete() method
186186
*/
187-
public function supportsUnstore()
187+
public function supportsDeleteCard()
188188
{
189-
return method_exists($this, 'unstore');
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/PxPostStoreRequest.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 Store Request
15+
* PaymentExpress PxPost Create Credit Card Request
1616
*/
17-
class PxPostStoreRequest 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 store(array $parameters = array())
78+
public function createCard(array $parameters = array())
7979
{
80-
return $this->createRequest('\Omnipay\PaymentExpress\Message\PxPostStoreRequest', $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 store(array $parameters = array())
57+
public function createCard(array $parameters = array())
5858
{
59-
return $this->createRequest('\Omnipay\Stripe\Message\StoreRequest', $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 unstore(array $parameters = array())
67+
public function deleteCard(array $parameters = array())
6868
{
69-
return $this->createRequest('\Omnipay\Stripe\Message\UnstoreRequest', $parameters);
69+
return $this->createRequest('\Omnipay\Stripe\Message\DeleteCardRequest', $parameters);
7070
}
7171
}

src/Omnipay/Stripe/Message/StoreRequest.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 Store Request
15+
* Stripe Create Credit Card Request
1616
*/
17-
class StoreRequest extends PurchaseRequest
17+
class CreateCardRequest extends PurchaseRequest
1818
{
1919
public function getData()
2020
{

src/Omnipay/Stripe/Message/UnstoreRequest.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 Unstore Request
15+
* Stripe Delete Credit Card Request
1616
*/
17-
class UnstoreRequest 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)