1 | <?php |
||||||
2 | |||||||
3 | namespace ByTIC\Payments\Actions\Transactions; |
||||||
4 | |||||||
5 | use ByTIC\Payments\Actions\GatewayNotifications\UpdatePaymentModelsFromResponse; |
||||||
6 | use ByTIC\Payments\Exception\RequestNotSupportedException; |
||||||
7 | use ByTIC\Payments\Models\Transactions\Transaction; |
||||||
8 | use Omnipay\Common\Message\AbstractResponse; |
||||||
9 | |||||||
10 | /** |
||||||
11 | * Class ChargeWithToken |
||||||
12 | * @package ByTIC\Payments\Actions\Transactions |
||||||
13 | */ |
||||||
14 | class ChargeWithToken |
||||||
15 | { |
||||||
16 | /** |
||||||
17 | * @param Transaction $transaction |
||||||
18 | */ |
||||||
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); |
||||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||||
27 | } |
||||||
28 | |||||||
29 | $parameters = $purchase->getPurchaseParameters(); |
||||||
30 | $parameters['token'] = $transaction->getToken()->getTokenId(); |
||||||
31 | |||||||
32 | /** @var AbstractResponse $response */ |
||||||
33 | $response = $gateway->purchaseWithToken($parameters); |
||||||
0 ignored issues
–
show
The method
purchaseWithToken() does not exist on ByTIC\Payments\Gateways\...way\Traits\GatewayTrait . Since you implemented __call , consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
34 | |||||||
35 | $response->processModel(); |
||||||
0 ignored issues
–
show
The method
processModel() does not exist on Omnipay\Common\Message\AbstractResponse . It seems like you code against a sub-type of Omnipay\Common\Message\AbstractResponse such as Paytic\Payments\Stripe\M...ompletePurchaseResponse or Paytic\Payments\Simplify...ompletePurchaseResponse or Paytic\Payments\Twispay\...ompletePurchaseResponse or Paytic\Payments\Twispay\...ompletePurchaseResponse or Paytic\Payments\PlatiOnl...ompletePurchaseResponse or Paytic\Payments\PlatiOnl...ompletePurchaseResponse or ByTIC\Payments\Gateways\...ompletePurchaseResponse or Paytic\Payments\Payu\Mes...ompletePurchaseResponse or Paytic\Payments\Payu\Mes...ompletePurchaseResponse or Paytic\Payments\Euplates...ompletePurchaseResponse or Paytic\Payments\Euplates...ompletePurchaseResponse or Paytic\Payments\Mobilpay...\Payment\DoPayTResponse or ByTIC\Payments\Gateways\...ompletePurchaseResponse or Paytic\Payments\Mobilpay...ompletePurchaseResponse or Paytic\Payments\Mobilpay...ompletePurchaseResponse or Paytic\Payments\Librapay...ompletePurchaseResponse or Paytic\Payments\Librapay...ompletePurchaseResponse .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
36 | UpdatePaymentModelsFromResponse::handle($response, $model, 'IPN'); |
||||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||||
37 | |||||||
38 | return $response; |
||||||
39 | } |
||||||
40 | } |
||||||
41 |