Fix for token billing

This commit is contained in:
Hillel Coren 2016-07-15 11:23:19 +03:00
parent c6bf1d5fcc
commit cf3465b5e2
2 changed files with 4 additions and 3 deletions

View File

@ -113,9 +113,9 @@ class PaymentMethod extends EntityModel
*/ */
public function scopeClientId($query, $clientId) public function scopeClientId($query, $clientId)
{ {
return $query->with(['contact' => function($query) use ($clientId) { $query->whereHas('contact', function($query) use ($clientId) {
return $query->whereClientId($clientId); $query->whereClientId($clientId);
}]); });
} }
/** /**

View File

@ -531,6 +531,7 @@ class BasePaymentDriver
public function createPaymentMethod($customer) public function createPaymentMethod($customer)
{ {
$paymentMethod = PaymentMethod::createNew($this->invitation); $paymentMethod = PaymentMethod::createNew($this->invitation);
$paymentMethod->contact_id = $this->contact()->id;
$paymentMethod->ip = Request::ip(); $paymentMethod->ip = Request::ip();
$paymentMethod->account_gateway_token_id = $customer->id; $paymentMethod->account_gateway_token_id = $customer->id;
$paymentMethod->setRelation('account_gateway_token', $customer); $paymentMethod->setRelation('account_gateway_token', $customer);