squareetlabs /
LaravelAuthorizeNet
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace Squareetlabs\AuthorizeNet\Services; |
||||
| 4 | |||||
| 5 | use Squareetlabs\AuthorizeNet\AuthorizeNet; |
||||
| 6 | use net\authorize\api\contract\v1 as AnetAPI; |
||||
| 7 | use net\authorize\api\controller as AnetControllers; |
||||
| 8 | |||||
| 9 | class PaymentProfileRefundService extends AuthorizeNet |
||||
| 10 | { |
||||
| 11 | public function handle(int $cents, $refsTransId, $paymentProfileId) |
||||
| 12 | { |
||||
| 13 | $amount = $this->convertCentsToDollar($cents); |
||||
| 14 | |||||
| 15 | $paymentProfile = new AnetAPI\PaymentProfileType(); |
||||
| 16 | $paymentProfile->setPaymentProfileId($paymentProfileId); |
||||
| 17 | |||||
| 18 | // Set the transaction's refId |
||||
| 19 | $customerProfile = new AnetAPI\CustomerProfilePaymentType(); |
||||
| 20 | $customerProfile->setCustomerProfileId($this->user->anet()->getCustomerProfileId()); |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
It seems like
$this->user->anet()->getCustomerProfileId() can also be of type Illuminate\Database\Eloquent\Builder and Illuminate\Database\Eloq...gHasThroughRelationship; however, parameter $customerProfileId of net\authorize\api\contra...:setCustomerProfileId() does only seem to accept string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 21 | $customerProfile->setPaymentProfile($paymentProfile); |
||||
| 22 | |||||
| 23 | $paymentProfile = new AnetAPI\PaymentProfileType(); |
||||
| 24 | $paymentProfile->setPaymentProfileId($paymentProfileId); |
||||
| 25 | |||||
| 26 | $transactionRequestType = new AnetAPI\TransactionRequestType(); |
||||
| 27 | $transactionRequestType->setTransactionType( "refundTransaction"); |
||||
| 28 | |||||
| 29 | $transactionRequestType->setAmount($amount); |
||||
| 30 | $transactionRequestType->setProfile($customerProfile); |
||||
| 31 | $transactionRequestType->setRefTransId($refsTransId); |
||||
| 32 | |||||
| 33 | $request = new AnetAPI\CreateTransactionRequest(); |
||||
| 34 | $request->setMerchantAuthentication($this->getMerchantAuthentication()); |
||||
| 35 | $request->setRefId($this->getRefId()); |
||||
| 36 | $request->setTransactionRequest($transactionRequestType); |
||||
| 37 | |||||
| 38 | $controller = new AnetControllers\CreateTransactionController($request); |
||||
| 39 | return $this->execute($controller); |
||||
| 40 | } |
||||
| 41 | |||||
| 42 | |||||
| 43 | |||||
| 44 | } |
||||
| 45 |