def METHOD_NAME(self):
    customer_pk = self.kwargs.get('customer_pk', None)
    payment_method_id = self.kwargs.get('payment_method_id')
    if payment_method_id:
        payment_method = get_object_or_404(PaymentMethod,
                                           id=payment_method_id,
                                           customer__pk=customer_pk)
        return Transaction.objects.filter(
            payment_method=payment_method
        )
    else:
        return Transaction.objects.filter(
            payment_method__customer__pk=customer_pk
        )