Conditions | 2 |
Paths | 2 |
Total Lines | 20 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
19 | public static function process($transaction) |
||
20 | { |
||
21 | $purchase = $transaction->getPurchase(); |
||
22 | $method = $transaction->getPaymentMethod(); |
||
23 | $gateway = $method->getGateway(); |
||
24 | |||
25 | if (!method_exists($gateway, 'purchaseWithToken')) { |
||
26 | throw RequestNotSupportedException::create('purchaseWithToken', $gateway); |
||
|
|||
27 | } |
||
28 | |||
29 | $parameters = $purchase->getPurchaseParameters(); |
||
30 | $parameters['token'] = $transaction->getToken()->getTokenId(); |
||
31 | |||
32 | /** @var AbstractResponse $response */ |
||
33 | $response = $gateway->purchaseWithToken($parameters); |
||
34 | |||
35 | $response->processModel(); |
||
36 | UpdatePaymentModelsFromResponse::handle($response, $model, 'IPN'); |
||
37 | |||
38 | return $response; |
||
39 | } |
||
40 | } |