mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 02:07:33 -05:00 
			
		
		
		
	Store ip addresses for payments and payment methods
This commit is contained in:
		
							parent
							
								
									29c4f16970
								
							
						
					
					
						commit
						1f11d88d6b
					
				@ -835,7 +835,7 @@ class ClientPortalController extends BaseController
 | 
			
		||||
        $gateway = $accountGateway->gateway;
 | 
			
		||||
 | 
			
		||||
        if ($token && $paymentType == PAYMENT_TYPE_BRAINTREE_PAYPAL) {
 | 
			
		||||
            $sourceReference = $this->paymentService->createToken($this->paymentService->createGateway($accountGateway), array('token'=>$token), $accountGateway, $client, $invitation->contact_id);
 | 
			
		||||
            $sourceReference = $this->paymentService->createToken($this->paymentService->createGateway($accountGateway), array('token'=>$token), $accountGateway, $client, $contact->id);
 | 
			
		||||
 | 
			
		||||
            if(empty($sourceReference)) {
 | 
			
		||||
                $this->paymentMethodError('Token-No-Ref', $this->paymentService->lastError, $accountGateway);
 | 
			
		||||
@ -916,7 +916,7 @@ class ClientPortalController extends BaseController
 | 
			
		||||
 | 
			
		||||
        if (!empty($details)) {
 | 
			
		||||
            $gateway = $this->paymentService->createGateway($accountGateway);
 | 
			
		||||
            $sourceReference = $this->paymentService->createToken($gateway, $details, $accountGateway, $client, $invitation->contact_id);
 | 
			
		||||
            $sourceReference = $this->paymentService->createToken($gateway, $details, $accountGateway, $client, $contact->id);
 | 
			
		||||
        } else {
 | 
			
		||||
            return Redirect::to('client/paymentmethods/add/' . $typeLink)->withInput(Request::except('cvv'));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -667,7 +667,7 @@ class PaymentController extends BaseController
 | 
			
		||||
            } elseif (method_exists($gateway, 'completePurchase') 
 | 
			
		||||
                && !$accountGateway->isGateway(GATEWAY_TWO_CHECKOUT)
 | 
			
		||||
                && !$accountGateway->isGateway(GATEWAY_CHECKOUT_COM)) {
 | 
			
		||||
                $details = $this->paymentService->getPaymentDetails($invitation, $accountGateway);
 | 
			
		||||
                $details = $this->paymentService->getPaymentDetails($invitation, $accountGateway, array());
 | 
			
		||||
 | 
			
		||||
                $response = $this->paymentService->completePurchase($gateway, $accountGateway, $details, $token);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -88,6 +88,10 @@ class PaymentService extends BaseService
 | 
			
		||||
            'transactionType' => 'Purchase',
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        if ($input !== null) {
 | 
			
		||||
            $data['ip_address'] = \Request::ip();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($accountGateway->isGateway(GATEWAY_PAYPAL_EXPRESS) || $accountGateway->isGateway(GATEWAY_PAYPAL_PRO)) {
 | 
			
		||||
            $data['ButtonSource'] = 'InvoiceNinja_SP';
 | 
			
		||||
        };
 | 
			
		||||
@ -442,6 +446,8 @@ class PaymentService extends BaseService
 | 
			
		||||
            $accountGatewayToken->save();
 | 
			
		||||
 | 
			
		||||
            $paymentMethod = $this->convertPaymentMethodFromGatewayResponse($tokenResponse, $accountGateway, $accountGatewayToken, $contactId);
 | 
			
		||||
            $paymentMethod->ip_address = \Request::ip();
 | 
			
		||||
            $paymentMethod->save();
 | 
			
		||||
 | 
			
		||||
        } else {
 | 
			
		||||
            $this->lastError = $tokenResponse->getMessage();
 | 
			
		||||
@ -644,6 +650,10 @@ class PaymentService extends BaseService
 | 
			
		||||
            $payment->payment_type_id = $this->detectCardType($card->getNumber());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (!empty($paymentDetails['ip_address'])) {
 | 
			
		||||
            $payment->ip_address = $paymentDetails['ip_address'];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $savePaymentMethod = !empty($paymentMethod);
 | 
			
		||||
 | 
			
		||||
        // This will convert various gateway's formats to a known format
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user