mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-02-11 05:19:14 +00:00
falta vista de pagos
This commit is contained in:
@ -1,12 +0,0 @@
|
||||
// IdempotencyKeyRepository.java
|
||||
package com.imprimelibros.erp.payments.repo;
|
||||
|
||||
import com.imprimelibros.erp.payments.model.IdempotencyKey;
|
||||
import com.imprimelibros.erp.payments.model.IdempotencyScope;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public interface IdempotencyKeyRepository extends JpaRepository<IdempotencyKey, Long> {
|
||||
Optional<IdempotencyKey> findByScopeAndIdemKey(IdempotencyScope scope, String idemKey);
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
// PaymentMethodRepository.java
|
||||
package com.imprimelibros.erp.payments.repo;
|
||||
|
||||
import com.imprimelibros.erp.payments.model.PaymentMethod;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface PaymentMethodRepository extends JpaRepository<PaymentMethod, Long> {}
|
||||
@ -2,6 +2,9 @@
|
||||
package com.imprimelibros.erp.payments.repo;
|
||||
|
||||
import com.imprimelibros.erp.payments.model.PaymentTransaction;
|
||||
import com.imprimelibros.erp.payments.model.PaymentTransactionStatus;
|
||||
import com.imprimelibros.erp.payments.model.PaymentTransactionType;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.Optional;
|
||||
@ -9,4 +12,9 @@ import java.util.Optional;
|
||||
public interface PaymentTransactionRepository extends JpaRepository<PaymentTransaction, Long> {
|
||||
Optional<PaymentTransaction> findByGatewayTransactionId(String gatewayTransactionId);
|
||||
Optional<PaymentTransaction> findByIdempotencyKey(String idempotencyKey);
|
||||
Optional<PaymentTransaction> findFirstByPaymentIdAndTypeAndStatusOrderByIdDesc(
|
||||
Long paymentId,
|
||||
PaymentTransactionType type,
|
||||
PaymentTransactionStatus status
|
||||
);
|
||||
}
|
||||
|
||||
@ -7,6 +7,6 @@ import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
public interface RefundRepository extends JpaRepository<Refund, Long> {
|
||||
@Query("select coalesce(sum(r.amountCents),0) from Refund r where r.payment.id = :paymentId and r.status = com.imprimelibros.erp.payments.model.RefundStatus.SUCCEEDED")
|
||||
@Query("select coalesce(sum(r.amountCents),0) from Refund r where r.payment.id = :paymentId and r.status = com.imprimelibros.erp.payments.model.RefundStatus.succeeded")
|
||||
long sumSucceededByPaymentId(@Param("paymentId") Long paymentId);
|
||||
}
|
||||
|
||||
@ -4,4 +4,9 @@ package com.imprimelibros.erp.payments.repo;
|
||||
import com.imprimelibros.erp.payments.model.WebhookEvent;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface WebhookEventRepository extends JpaRepository<WebhookEvent, Long> {}
|
||||
import java.util.Optional;
|
||||
|
||||
public interface WebhookEventRepository extends JpaRepository<WebhookEvent, Long> {
|
||||
|
||||
Optional<WebhookEvent> findByProviderAndEventId(String provider, String eventId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user