Se agregan fetchs

This commit is contained in:
Juan Pablo Vial
2025-05-09 18:05:40 -04:00
parent db84187461
commit 59ecb6cc79
3 changed files with 41 additions and 0 deletions

View File

@ -65,4 +65,18 @@ class Customer extends Ideal\Repository
->where('rut = :rut');
return $this->fetchOne($query, compact('rut'));
}
/**
* @param string $toku_id
* @return Model\MediosPago\Toku\Customer
* @throws Implement\Exception\EmptyResult
*/
public function fetchByTokuId(string $toku_id): Model\MediosPago\Toku\Customer
{
$query = $this->connection->getQueryBuilder()
->select()
->from($this->getTable())
->where('toku_id = :toku_id');
return $this->fetchOne($query, compact('toku_id'));
}
}

View File

@ -42,6 +42,11 @@ class Invoice extends Ideal\Repository
return $this->update($model, ['cuota_id', 'toku_id', 'updated_at'], array_merge($new_data, ['updated_at' => (new DateTimeImmutable())->format('Y-m-d H:i:s.u')]));
}
/**
* @param int $cuota_id
* @return Model\MediosPago\Toku\Invoice
* @throws Implement\Exception\EmptyResult
*/
public function fetchByCuota(int $cuota_id): Model\MediosPago\Toku\Invoice
{
$query = $this->connection->getQueryBuilder()
@ -50,4 +55,18 @@ class Invoice extends Ideal\Repository
->where('cuota_id = :cuota_id');
return $this->fetchOne($query, compact('cuota_id'));
}
/**
* @param string $toku_id
* @return Model\MediosPago\Toku\Invoice
* @throws Implement\Exception\EmptyResult
*/
public function fetchByTokuId(string $toku_id): Model\MediosPago\Toku\Invoice
{
$query = $this->connection->getQueryBuilder()
->select()
->from($this->getTable())
->where('toku_id = :toku_id');
return $this->fetchOne($query, compact('toku_id'));
}
}

View File

@ -51,4 +51,12 @@ class Subscription extends Ideal\Repository
->where('venta_id = :venta_id');
return $this->fetchOne($query, compact('venta_id'));
}
public function fetchByTokuId(string $toku_id): Model\MediosPago\Toku\Subscription
{
$query = $this->connection->getQueryBuilder()
->select()
->from($this->getTable())
->where('toku_id = :toku_id');
return $this->fetchOne($query, compact('toku_id'));
}
}