PaymentSourceService

public struct PaymentSourceService : PaymentSourceServicing

A service implementation for managing payment source-related operations.

  • Initializes the PaymentSourceService with the specified repository.

    Declaration

    Swift

    public init(
        repository: PaymentSourceRepositoryProtocol
    )

    Parameters

    repository

    The repository for accessing Payment Source data.

  • Updates a payment source for the specified consumer.

    Declaration

    Swift

    @MainActor
    public func updatePaymentSource(
        consumerId: String,
        payload: PaymentSourceUpdatePayload,
        response: LoadableSubject<PaymentSourceUpdateResponse>
    )

    Parameters

    consumerId

    The ID of the consumer.

    payload

    The payload containing the updated payment source details.

    response

    The loadable subject to track the response. The loadable subject tracks the state of the payment instrument update operation, representing the success state with the loaded PaymentSourceUpdatePayload value or the failure state with the associated NetworkError.

  • Adds a contact card for the specified consumer.

    Declaration

    Swift

    @MainActor
    public func addContactCard(
        consumerId: String,
        payload: AddContactItemPayload,
        response: LoadableSubject<AddContactItemResponse>
    )

    Parameters

    consumerId

    The ID of the consumer.

    payload

    The payload containing the contact card details.

    response

    The loadable subject to track the response. The loadable subject tracks the state of the contact card addition operation, representing the success state with the loaded AddContactItemResponse value or the failure state with the associated NetworkError.

  • Adds a proxy for the specified consumer and instrument profile.

    Declaration

    Swift

    @MainActor
    public func addProxy(
        consumerId: String,
        paymentSourceProfileId: String,
        payload: AddProxyPayload,
        response: LoadableSubject<AddProxyResponse>
    )

    Parameters

    consumerId

    The ID of the consumer.

    instrumentProfileId

    The ID of the instrument profile.

    payload

    The payload containing the proxy details.

    response

    The loadable subject to track the response. The loadable subject tracks the state of the proxy addition operation, representing the success state with the loaded AddProxyResponse value or the failure state with the associated NetworkError.

  • Removes a proxy for the specified consumer and instrument profile.

    Declaration

    Swift

    @MainActor
    public func removeProxy(
        consumerId: String,
        paymentSourceProfileId: String,
        proxyId: String,
        response: LoadableSubject<RemoveProxyResponse>
    )

    Parameters

    consumerId

    The ID of the consumer.

    instrumentProfileId

    The ID of the instrument profile.

    proxyId

    The ID of the proxy to remove.

    response

    The loadable subject to track the response. The loadable subject tracks the state of the proxy removal operation, representing the success state with the loaded RemoveProxyResponse value or the failure state with the associated NetworkError.

  • Validates the provided OTP at the specified URL.

    Declaration

    Swift

    @MainActor
    public func validate(
        otp: ProxyOTPPayload,
        at url: URL,
        response: LoadableSubject<Void>
    )

    Parameters

    otp

    The OTP payload to validate.

    url

    The URL where the OTP validation request will be made.

    response

    The loadable subject to track the response. The loadable subject tracks the state of the OTP validation operation, representing the success state or the failure state with the associated NetworkError.

  • Requests a new OTP at the specified URL.

    Declaration

    Swift

    @MainActor
    public func requestNewOtp(
        at url: URL,
        response: LoadableSubject<RequestOTPResponse>
    )

    Parameters

    url

    The URL where the OTP request will be made.

    response

    The loadable subject to track the response. The loadable subject tracks the state of the OTP request operation, representing the success state with the loaded RequestOTPResponse value or the failure state with the associated NetworkError.

  • Edits the display name for the specified consumer and instrument profile.

    Declaration

    Swift

    @MainActor
    public func editDisplayName(
        consumerId: String,
        paymentSourceProfileId: String,
        payload: EditPaymentSourcePayload,
        response: LoadableSubject<EditPaymentSourceResponse>
    )

    Parameters

    consumerId

    The ID of the consumer.

    instrumentProfileId

    The ID of the instrument profile.

    payload

    The payload containing the updated display name.

    response

    The loadable subject to track the response. The loadable subject tracks the state of the display name edit operation, representing the success state with the loaded EditPaymentSourcePayload value or the failure state with the associated NetworkError.