Skip to content

Commit 36f4d53

Browse files
committed
Globar renamed store/create, unstore/delete gateway requests
1 parent 0831779 commit 36f4d53

20 files changed

+94
-94
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,8 @@ 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+
* `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
356356

357357
## Recurring Billing
358358

example/index.php

Lines changed: 16 additions & 16 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
204+
$app->get('/gateways/{name}/create', 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' => 'create',
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
221+
$app->post('/gateways/{name}/create', 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,12 +228,12 @@
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->create($params)->send();
237237

238238
return $app['twig']->render('response.twig', array(
239239
'gateway' => $gateway,
@@ -282,23 +282,23 @@
282282
));
283283
});
284284

285-
// create gateway unstore
286-
$app->get('/gateways/{name}/unstore', function($name) use ($app) {
285+
// create gateway delete
286+
$app->get('/gateways/{name}/delete', 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' => 'delete',
296296
'params' => $params,
297297
));
298298
});
299299

300-
// submit gateway unstore
301-
$app->post('/gateways/{name}/unstore', function($name) use ($app) {
300+
// submit gateway delete
301+
$app->post('/gateways/{name}/delete', 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->delete($params)->send();
314314

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

example/views/gateway.twig

Lines changed: 4 additions & 4 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.supportsCreate() %}
46+
<li><a href="/gateways/{{gateway.shortName}}/create">create()</a></li>
4747
{% endif %}
4848
{% if gateway.supportsUpdate() %}
4949
<li><a href="/gateways/{{gateway.shortName}}/update">update()</a></li>
5050
{% endif %}
51-
{% if gateway.supportsUnstore() %}
52-
<li><a href="/gateways/{{gateway.shortName}}/unstore">unstore()</a></li>
51+
{% if gateway.supportsDelete() %}
52+
<li><a href="/gateways/{{gateway.shortName}}/delete">delete()</a></li>
5353
{% endif %}
5454
</ul>
5555

src/Omnipay/Common/AbstractGateway.php

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

172172
/**
173-
* Supports Store
173+
* Supports Create
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 supportsCreate()
178178
{
179-
return method_exists($this, 'store');
179+
return method_exists($this, 'create');
180180
}
181181

182182
/**
183-
* Supports Unstore
183+
* Supports Delete
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 supportsDelete()
188188
{
189-
return method_exists($this, 'unstore');
189+
return method_exists($this, 'delete');
190190
}
191191

192192
/**

src/Omnipay/PaymentExpress/Message/PxPostStoreRequest.php renamed to src/Omnipay/PaymentExpress/Message/PxPostCreateRequest.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 Request
1616
*/
17-
class PxPostStoreRequest extends PxPostAuthorizeRequest
17+
class PxPostCreateRequest 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 create(array $parameters = array())
7979
{
80-
return $this->createRequest('\Omnipay\PaymentExpress\Message\PxPostStoreRequest', $parameters);
80+
return $this->createRequest('\Omnipay\PaymentExpress\Message\PxPostCreateRequest', $parameters);
8181
}
8282
}

src/Omnipay/Stripe/Gateway.php

Lines changed: 4 additions & 4 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 create(array $parameters = array())
5858
{
59-
return $this->createRequest('\Omnipay\Stripe\Message\StoreRequest', $parameters);
59+
return $this->createRequest('\Omnipay\Stripe\Message\CreateRequest', $parameters);
6060
}
6161

6262
public function update(array $parameters = array())
6363
{
6464
return $this->createRequest('\Omnipay\Stripe\Message\UpdateRequest', $parameters);
6565
}
6666

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

src/Omnipay/Stripe/Message/StoreRequest.php renamed to src/Omnipay/Stripe/Message/CreateRequest.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 Request
1616
*/
17-
class StoreRequest extends PurchaseRequest
17+
class CreateRequest extends PurchaseRequest
1818
{
1919
public function getData()
2020
{

src/Omnipay/Stripe/Message/UnstoreRequest.php renamed to src/Omnipay/Stripe/Message/DeleteRequest.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 Request
1616
*/
17-
class UnstoreRequest extends PurchaseRequest
17+
class DeleteRequest extends PurchaseRequest
1818
{
1919
public function getData()
2020
{

tests/Omnipay/GatewayTestCase.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -149,27 +149,27 @@ public function testSupportsVoid()
149149
}
150150
}
151151

152-
public function testSupportsStore()
152+
public function testSupportsCreate()
153153
{
154-
$supportsStore = $this->gateway->supportsStore();
155-
$this->assertInternalType('boolean', $supportsStore);
154+
$supportsCreate = $this->gateway->supportsCreate();
155+
$this->assertInternalType('boolean', $supportsCreate);
156156

157-
if ($supportsStore) {
158-
$this->assertInstanceOf('Omnipay\Common\Message\RequestInterface', $this->gateway->store());
157+
if ($supportsCreate) {
158+
$this->assertInstanceOf('Omnipay\Common\Message\RequestInterface', $this->gateway->create());
159159
} else {
160-
$this->assertFalse(method_exists($this->gateway, 'store'));
160+
$this->assertFalse(method_exists($this->gateway, 'create'));
161161
}
162162
}
163163

164-
public function testSupportsUnstore()
164+
public function testSupportsDelete()
165165
{
166-
$supportsUnstore = $this->gateway->supportsUnstore();
167-
$this->assertInternalType('boolean', $supportsUnstore);
166+
$supportsDelete = $this->gateway->supportsDelete();
167+
$this->assertInternalType('boolean', $supportsDelete);
168168

169-
if ($supportsUnstore) {
170-
$this->assertInstanceOf('Omnipay\Common\Message\RequestInterface', $this->gateway->unstore());
169+
if ($supportsDelete) {
170+
$this->assertInstanceOf('Omnipay\Common\Message\RequestInterface', $this->gateway->delete());
171171
} else {
172-
$this->assertFalse(method_exists($this->gateway, 'unstore'));
172+
$this->assertFalse(method_exists($this->gateway, 'delete'));
173173
}
174174
}
175175

@@ -290,9 +290,9 @@ public function testVoidParameters()
290290
}
291291
}
292292

293-
public function testStoreParameters()
293+
public function testCreateParameters()
294294
{
295-
if ($this->gateway->supportsStore()) {
295+
if ($this->gateway->supportsCreate()) {
296296
foreach ($this->gateway->getDefaultParameters() as $key => $default) {
297297
// set property on gateway
298298
$getter = 'get'.ucfirst($key);
@@ -301,15 +301,15 @@ public function testStoreParameters()
301301
$this->gateway->$setter($value);
302302

303303
// request should have matching property, with correct value
304-
$request = $this->gateway->store();
304+
$request = $this->gateway->create();
305305
$this->assertSame($value, $request->$getter());
306306
}
307307
}
308308
}
309309

310-
public function testUnstoreParameters()
310+
public function testDeleteParameters()
311311
{
312-
if ($this->gateway->supportsUnstore()) {
312+
if ($this->gateway->supportsDelete()) {
313313
foreach ($this->gateway->getDefaultParameters() as $key => $default) {
314314
// set property on gateway
315315
$getter = 'get'.ucfirst($key);
@@ -318,7 +318,7 @@ public function testUnstoreParameters()
318318
$this->gateway->$setter($value);
319319

320320
// request should have matching property, with correct value
321-
$request = $this->gateway->unstore();
321+
$request = $this->gateway->delete();
322322
$this->assertSame($value, $request->$getter());
323323
}
324324
}

0 commit comments

Comments
 (0)