Skip to main content

luna.payments.yapily

PaymentStatus Objects

@enum.unique
class PaymentStatus(enum.Enum)

Enum for various payment statuses.

  • NEW: The payment has been created but not processed yet.
  • PENDING_CONSENT: The payment is awaiting user consent for processing.
  • PENDING_SETTLEMENT: The payment has been consented to and is pending settlement.
  • SETTLED: The payment has been settled successfully.
  • CANCELLED: The payment has been cancelled.
  • FAILED: The payment has failed.

PaymentStatusWrapper Objects

class PaymentStatusWrapper()

Wraps the payment status along with an identifier for tracking.

  • payment_status: The current status of the payment.
  • id: A unique identifier for the payment.

LinkSender Objects

class LinkSender(ABC)

Abstract base class for sending consent links. Defines a method to send consent links for payment authorization.

@abstractmethod
def send_consent_link(link: str) -> None

Sends a consent link to the user.

  • link: The URL of the consent link to be sent.

YapilyClient Objects

class YapilyClient()

Client for managing interactions with the Yapily API for payment processing.

  • application_id: The application ID for Yapily API.
  • application_secret: The application secret for Yapily API.
  • application_user_id: The user ID associated with the application.

initialize_payment

def initialize_payment(
institution_id: str,
request: PaymentRequest,
consent_link_sender: LinkSender,
callback_url: str | None = None) -> PaymentStatusWrapper

Initializes a payment process with Yapily.

  • institution_id: The ID of the financial institution for the payment.
  • request: The PaymentRequest object containing payment details.
  • consent_link_sender: An instance of LinkSender to send the consent link.
  • callback_url: optional url to redirect the user to after the payment is complete

check_payment_status

def check_payment_status(
consent_id: str, payment_id: str,
payment_request: PaymentRequest) -> PaymentStatusWrapper

Checks the status of a payment with Yapily.

  • consent_id: The ID of the consent associated with the payment.
  • payment_id: The unique identifier of the payment.
  • payment_request: The PaymentRequest object associated with the payment.