Class: Pago::V2026_04::Services::CustomerPortal::Orders

Inherits:
Service
  • Object
show all
Defined in:
lib/pago/v2026_04/services/customer_portal.rb,
sig/pago/v2026_04/generated.rbs

Instance Attribute Summary

Attributes inherited from Service

#client

Instance Method Summary collapse

Methods inherited from Service

#initialize

Constructor Details

This class inherits a constructor from Pago::Service

Instance Method Details

#confirm_retry_payment(id, body: {}) ⇒ Models::CustomerOrderPaymentConfirmation

Confirm a retry payment using a Stripe confirmation token.

Parameters:

Returns:

Raises:



984
985
986
987
988
989
990
991
992
993
994
995
# File 'lib/pago/v2026_04/services/customer_portal.rb', line 984

def confirm_retry_payment(id, body: {})
  data = client.request(
    http_method: "POST",
    path: "/v1/customer-portal/orders/{id}/confirm-payment",
    path_params: { "id" => id },
    query: {},
    body: body,
    response_type: :json,
    errors: { 404 => Errors::ResourceNotFound, 409 => Errors::PaymentAlreadyInProgress, 422 => Errors::OrderNotEligibleForRetry, 429 => Errors::ManualRetryLimitExceeded }
  )
  Models::CustomerOrderPaymentConfirmation.from_json(data)
end

#generate_invoice(id) ⇒ Object

Trigger generation of an order's invoice.

Parameters:

  • id (String)

    The order ID.

Returns:

  • (Object)

Raises:



924
925
926
927
928
929
930
931
932
933
934
# File 'lib/pago/v2026_04/services/customer_portal.rb', line 924

def generate_invoice(id)
  data = client.request(
    http_method: "POST",
    path: "/v1/customer-portal/orders/{id}/invoice",
    path_params: { "id" => id },
    query: {},
    response_type: :json,
    errors: { 404 => Errors::ResourceNotFound, 409 => Errors::OrderNotEligibleForInvoice, 422 => Errors::MissingInvoiceBillingDetails }
  )
  data
end

#get(id) ⇒ Models::CustomerOrder

Get an order by ID for the authenticated customer.

Parameters:

  • id (String)

    The order ID.

Returns:

Raises:



864
865
866
867
868
869
870
871
872
873
874
# File 'lib/pago/v2026_04/services/customer_portal.rb', line 864

def get(id)
  data = client.request(
    http_method: "GET",
    path: "/v1/customer-portal/orders/{id}",
    path_params: { "id" => id },
    query: {},
    response_type: :json,
    errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError }
  )
  Models::CustomerOrder.from_json(data)
end

#get_payment_status(id) ⇒ Models::CustomerOrderPaymentStatus

Get the current payment status for an order.

Parameters:

  • id (String)

    The order ID.

Returns:

Raises:



962
963
964
965
966
967
968
969
970
971
972
# File 'lib/pago/v2026_04/services/customer_portal.rb', line 962

def get_payment_status(id)
  data = client.request(
    http_method: "GET",
    path: "/v1/customer-portal/orders/{id}/payment-status",
    path_params: { "id" => id },
    query: {},
    response_type: :json,
    errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError }
  )
  Models::CustomerOrderPaymentStatus.from_json(data)
end

#invoice(id) ⇒ Models::CustomerOrderInvoice

Get an order's invoice data.

Parameters:

  • id (String)

    The order ID.

Returns:

Raises:



904
905
906
907
908
909
910
911
912
913
914
# File 'lib/pago/v2026_04/services/customer_portal.rb', line 904

def invoice(id)
  data = client.request(
    http_method: "GET",
    path: "/v1/customer-portal/orders/{id}/invoice",
    path_params: { "id" => id },
    query: {},
    response_type: :json,
    errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError }
  )
  Models::CustomerOrderInvoice.from_json(data)
end

#list(product_id: nil, product_billing_type: nil, subscription_id: nil, query: nil, page: 1, limit: 10, sorting: ["-created_at"]) ⇒ Models::ListResourceCustomerOrder

List orders of the authenticated customer.

Parameters:

  • product_id (String, Array<String>, nil) (defaults to: nil)

    Filter by product ID.

  • product_billing_type (String, Array<String>, nil) (defaults to: nil)

    Filter by product billing type. recurring will filter data corresponding to subscriptions creations or renewals. one_time will filter data corresponding to one-time purchases.

  • subscription_id (String, Array<String>, nil) (defaults to: nil)

    Filter by subscription ID.

  • query (String, nil) (defaults to: nil)

    Search by product or organization name.

  • page (Integer) (defaults to: 1)

    Page number, defaults to 1.

  • limit (Integer) (defaults to: 10)

    Size of a page, defaults to 10. Maximum is 100.

  • sorting (Array<String>, nil) (defaults to: ["-created_at"])

    Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign - before the criteria name to sort by descending order.

  • product_id: (Object) (defaults to: nil)
  • product_billing_type: (Object) (defaults to: nil)
  • subscription_id: (Object) (defaults to: nil)
  • query: (String, nil) (defaults to: nil)
  • page: (Integer, nil) (defaults to: 1)
  • limit: (Integer, nil) (defaults to: 10)
  • sorting: (Array[String], nil) (defaults to: ["-created_at"])

Returns:

Raises:



834
835
836
837
838
839
840
841
842
843
844
# File 'lib/pago/v2026_04/services/customer_portal.rb', line 834

def list(product_id: nil, product_billing_type: nil, subscription_id: nil, query: nil, page: 1, limit: 10, sorting: ["-created_at"])
  data = client.request(
    http_method: "GET",
    path: "/v1/customer-portal/orders/",
    path_params: {},
    query: { "product_id" => product_id, "product_billing_type" => product_billing_type, "subscription_id" => subscription_id, "query" => query, "page" => page, "limit" => limit, "sorting" => sorting },
    response_type: :json,
    errors: { 422 => Errors::HTTPValidationError }
  )
  Models::ListResourceCustomerOrder.from_json(data)
end

#list_each(product_id: nil, product_billing_type: nil, subscription_id: nil, query: nil, limit: 10, sorting: ["-created_at"]) {|item| ... } ⇒ Pago::Paginator

Enumerate every item of list, fetching pages on demand.

Parameters:

  • product_id: (Object) (defaults to: nil)
  • product_billing_type: (Object) (defaults to: nil)
  • subscription_id: (Object) (defaults to: nil)
  • query: (String, nil) (defaults to: nil)
  • limit: (Integer, nil) (defaults to: 10)
  • sorting: (Array[String], nil) (defaults to: ["-created_at"])

Yield Parameters:

Returns:



850
851
852
853
854
855
# File 'lib/pago/v2026_04/services/customer_portal.rb', line 850

def list_each(product_id: nil, product_billing_type: nil, subscription_id: nil, query: nil, limit: 10, sorting: ["-created_at"], &block)
  paginator = ::Pago::Paginator.new do |page_number|
    list(product_id: product_id, product_billing_type: product_billing_type, subscription_id: subscription_id, query: query, page: page_number, limit: limit, sorting: sorting)
  end
  block ? paginator.each(&block) : paginator
end

#receipt(id) ⇒ Models::CustomerOrderReceipt

Get a presigned URL to download an order's receipt PDF.

Parameters:

  • id (String)

    The order ID.

Returns:

Raises:



943
944
945
946
947
948
949
950
951
952
953
# File 'lib/pago/v2026_04/services/customer_portal.rb', line 943

def receipt(id)
  data = client.request(
    http_method: "GET",
    path: "/v1/customer-portal/orders/{id}/receipt",
    path_params: { "id" => id },
    query: {},
    response_type: :json,
    errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError }
  )
  Models::CustomerOrderReceipt.from_json(data)
end

#update(id, body: {}) ⇒ Models::CustomerOrder

Update an order for the authenticated customer.

Parameters:

  • id (String)

    The order ID.

  • body (Hash, Models::CustomerOrderUpdate) (defaults to: {})

    the request body.

  • body: (Object) (defaults to: {})

Returns:

Raises:



884
885
886
887
888
889
890
891
892
893
894
895
# File 'lib/pago/v2026_04/services/customer_portal.rb', line 884

def update(id, body: {})
  data = client.request(
    http_method: "PATCH",
    path: "/v1/customer-portal/orders/{id}",
    path_params: { "id" => id },
    query: {},
    body: body,
    response_type: :json,
    errors: { 404 => Errors::ResourceNotFound, 422 => Errors::HTTPValidationError }
  )
  Models::CustomerOrder.from_json(data)
end