moov_ruby 0.3.22 → 0.3.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/moov/client.rb +2 -1
- data/lib/moov/invoices.rb +288 -0
- data/lib/moov/models/components/createinvoicepayment.rb +41 -0
- data/lib/moov/models/components/createinvoicepayment.rbi +17 -0
- data/lib/moov/models/components/createwebhook.rb +45 -0
- data/lib/moov/models/components/createwebhook.rbi +19 -0
- data/lib/moov/models/components/eventtype.rb +41 -0
- data/lib/moov/models/components/eventtype.rbi +17 -0
- data/lib/moov/models/components/invoiceexternalpayment.rb +2 -6
- data/lib/moov/models/components/invoiceexternalpayment.rbi +0 -2
- data/lib/moov/models/components/invoicepayment.rb +9 -5
- data/lib/moov/models/components/invoicepayment.rbi +4 -2
- data/lib/moov/models/components/invoicetransferpayment.rb +2 -6
- data/lib/moov/models/components/invoicetransferpayment.rbi +0 -2
- data/lib/moov/models/components/pingresponse.rb +41 -0
- data/lib/moov/models/components/pingresponse.rbi +17 -0
- data/lib/moov/models/components/updatewebhook.rb +45 -0
- data/lib/moov/models/components/updatewebhook.rbi +19 -0
- data/lib/moov/models/components/webhook.rb +61 -0
- data/lib/moov/models/components/webhook.rbi +27 -0
- data/lib/moov/models/components/webhooksecret.rb +33 -0
- data/lib/moov/models/components/webhooksecret.rbi +13 -0
- data/lib/moov/models/components/{invoiceexternalpayment_paymenttype.rb → webhookstatus.rb} +4 -3
- data/lib/moov/models/components/webhookstatus.rbi +11 -0
- data/lib/moov/models/components.rb +8 -2
- data/lib/moov/models/errors/createinvoicepaymenterror.rb +45 -0
- data/lib/moov/models/errors/createinvoicepaymenterror.rbi +19 -0
- data/lib/moov/models/errors/createwebhookvalidationerror.rb +49 -0
- data/lib/moov/models/errors/createwebhookvalidationerror.rbi +21 -0
- data/lib/moov/models/errors/updatewebhookvalidationerror.rb +49 -0
- data/lib/moov/models/errors/updatewebhookvalidationerror.rbi +21 -0
- data/lib/moov/models/errors.rb +3 -0
- data/lib/moov/models/operations/createinvoicepayment_request.rb +54 -0
- data/lib/moov/models/operations/createinvoicepayment_request.rbi +19 -0
- data/lib/moov/models/operations/createinvoicepayment_response.rb +49 -0
- data/lib/moov/models/operations/createinvoicepayment_response.rbi +21 -0
- data/lib/moov/models/operations/createwebhook_request.rb +46 -0
- data/lib/moov/models/operations/createwebhook_request.rbi +15 -0
- data/lib/moov/models/operations/createwebhook_response.rb +49 -0
- data/lib/moov/models/operations/createwebhook_response.rbi +21 -0
- data/lib/moov/models/operations/disablewebhook_request.rb +46 -0
- data/lib/moov/models/operations/disablewebhook_request.rbi +15 -0
- data/lib/moov/models/operations/disablewebhook_response.rb +45 -0
- data/lib/moov/models/operations/disablewebhook_response.rbi +19 -0
- data/lib/moov/models/operations/getwebhook_request.rb +46 -0
- data/lib/moov/models/operations/getwebhook_request.rbi +15 -0
- data/lib/moov/models/operations/getwebhook_response.rb +49 -0
- data/lib/moov/models/operations/getwebhook_response.rbi +21 -0
- data/lib/moov/models/operations/getwebhooksecret_request.rb +46 -0
- data/lib/moov/models/operations/getwebhooksecret_request.rbi +15 -0
- data/lib/moov/models/operations/getwebhooksecret_response.rb +49 -0
- data/lib/moov/models/operations/getwebhooksecret_response.rbi +21 -0
- data/lib/moov/models/operations/listeventtypes_request.rb +42 -0
- data/lib/moov/models/operations/listeventtypes_request.rbi +13 -0
- data/lib/moov/models/operations/listeventtypes_response.rb +49 -0
- data/lib/moov/models/operations/listeventtypes_response.rbi +21 -0
- data/lib/moov/models/operations/listinvoicepayments_request.rb +50 -0
- data/lib/moov/models/operations/listinvoicepayments_request.rbi +17 -0
- data/lib/moov/models/operations/listinvoicepayments_response.rb +49 -0
- data/lib/moov/models/operations/listinvoicepayments_response.rbi +21 -0
- data/lib/moov/models/operations/listwebhooks_request.rb +42 -0
- data/lib/moov/models/operations/listwebhooks_request.rbi +13 -0
- data/lib/moov/models/operations/listwebhooks_response.rb +49 -0
- data/lib/moov/models/operations/listwebhooks_response.rbi +21 -0
- data/lib/moov/models/operations/pingwebhook_request.rb +46 -0
- data/lib/moov/models/operations/pingwebhook_request.rbi +15 -0
- data/lib/moov/models/operations/pingwebhook_response.rb +49 -0
- data/lib/moov/models/operations/pingwebhook_response.rbi +21 -0
- data/lib/moov/models/operations/updatewebhook_request.rb +50 -0
- data/lib/moov/models/operations/updatewebhook_request.rbi +17 -0
- data/lib/moov/models/operations/updatewebhook_response.rb +49 -0
- data/lib/moov/models/operations/updatewebhook_response.rbi +21 -0
- data/lib/moov/models/operations.rb +20 -0
- data/lib/moov/sdkconfiguration.rb +2 -2
- data/lib/moov/webhooks.rb +1056 -0
- data/lib/moov_ruby.rb +1 -0
- metadata +65 -6
- data/lib/moov/models/components/invoiceexternalpayment_paymenttype.rbi +0 -11
- data/lib/moov/models/components/invoicetransferpayment_paymenttype.rb +0 -21
- data/lib/moov/models/components/invoicetransferpayment_paymenttype.rbi +0 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b938c13ffea98d10ce59eafa2f3082b0ebdf4493466c3a96e1116ba693417ce3
|
|
4
|
+
data.tar.gz: 8026d785fb2e95d93e8da13672b32e7057ba811a59cbca106c72a2069bdfaee9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1f651e623ab43f490808d4ac1722f3b7ae19e6fe981ae51c13421e156a83159ec81dd5cf05ab1f9755eee89a2bbe223f447281b5489bd97a0fac052c29122b56
|
|
7
|
+
data.tar.gz: 94ecf0b055ea098c1ec08b87ad7f3b4313f142647d423ca56c33c1362e776ec5ba1c1d56fb578166f623cc9c0f3309f7e3ff210d4ef7ee3ab63ed00d5f24ff44
|
data/lib/moov/client.rb
CHANGED
|
@@ -16,7 +16,7 @@ module Moov
|
|
|
16
16
|
class Client
|
|
17
17
|
extend T::Sig
|
|
18
18
|
|
|
19
|
-
attr_accessor :accounts, :adjustments, :apple_pay, :bank_accounts, :branding, :capabilities, :cards, :disputes, :fee_plans, :files, :images, :invoices, :payment_links, :payment_methods, :products, :representatives, :scheduling, :statements, :sweeps, :account_terminal_applications, :support, :transfers, :underwriting, :wallets, :wallet_transactions, :avatars, :end_to_end_encryption, :enriched_address, :enriched_profile, :industries, :institutions, :issuing_transactions, :card_issuing, :authentication, :onboarding, :ping, :receipts, :terminal_applications
|
|
19
|
+
attr_accessor :accounts, :adjustments, :apple_pay, :bank_accounts, :branding, :capabilities, :cards, :disputes, :fee_plans, :files, :images, :invoices, :payment_links, :payment_methods, :products, :representatives, :scheduling, :statements, :sweeps, :account_terminal_applications, :support, :transfers, :underwriting, :wallets, :wallet_transactions, :avatars, :end_to_end_encryption, :enriched_address, :enriched_profile, :webhooks, :industries, :institutions, :issuing_transactions, :card_issuing, :authentication, :onboarding, :ping, :receipts, :terminal_applications
|
|
20
20
|
|
|
21
21
|
# Instantiates the SDK, configuring it with the provided parameters.
|
|
22
22
|
#
|
|
@@ -122,6 +122,7 @@ module Moov
|
|
|
122
122
|
@end_to_end_encryption = EndToEndEncryption.new(@sdk_configuration)
|
|
123
123
|
@enriched_address = EnrichedAddress.new(@sdk_configuration)
|
|
124
124
|
@enriched_profile = EnrichedProfile.new(@sdk_configuration)
|
|
125
|
+
@webhooks = Webhooks.new(@sdk_configuration)
|
|
125
126
|
@industries = Industries.new(@sdk_configuration)
|
|
126
127
|
@institutions = Institutions.new(@sdk_configuration)
|
|
127
128
|
@issuing_transactions = IssuingTransactions.new(@sdk_configuration)
|
data/lib/moov/invoices.rb
CHANGED
|
@@ -622,5 +622,293 @@ module Moov
|
|
|
622
622
|
|
|
623
623
|
end
|
|
624
624
|
end
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
sig { params(create_invoice_payment: Models::Components::CreateInvoicePayment, account_id: ::String, invoice_id: ::String, x_moov_version: T.nilable(::String), timeout_ms: T.nilable(Integer)).returns(Models::Operations::CreateInvoicePaymentResponse) }
|
|
628
|
+
def create_invoice_payment(create_invoice_payment:, account_id:, invoice_id:, x_moov_version: nil, timeout_ms: nil)
|
|
629
|
+
# create_invoice_payment - Creates a payment resource to represent that an invoice was paid outside of the Moov platform.
|
|
630
|
+
# If a payment link was created for the invoice, the corresponding payment link is canceled, but a receipt is still sent.
|
|
631
|
+
#
|
|
632
|
+
# To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
|
|
633
|
+
# you'll need to specify the `/accounts/{accountID}/invoices.write` scope.
|
|
634
|
+
request = Models::Operations::CreateInvoicePaymentRequest.new(
|
|
635
|
+
account_id: account_id,
|
|
636
|
+
invoice_id: invoice_id,
|
|
637
|
+
create_invoice_payment: create_invoice_payment,
|
|
638
|
+
x_moov_version: x_moov_version
|
|
639
|
+
)
|
|
640
|
+
url, params = @sdk_configuration.get_server_details
|
|
641
|
+
base_url = Utils.template_url(url, params)
|
|
642
|
+
url = Utils.generate_url(
|
|
643
|
+
Models::Operations::CreateInvoicePaymentRequest,
|
|
644
|
+
base_url,
|
|
645
|
+
'/accounts/{accountID}/invoices/{invoiceID}/payments',
|
|
646
|
+
request,
|
|
647
|
+
@sdk_configuration.globals
|
|
648
|
+
)
|
|
649
|
+
headers = Utils.get_headers(request, @sdk_configuration.globals)
|
|
650
|
+
headers = T.cast(headers, T::Hash[String, String])
|
|
651
|
+
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :create_invoice_payment, :json)
|
|
652
|
+
headers['content-type'] = req_content_type
|
|
653
|
+
raise StandardError, 'request body is required' if data.nil? && form.nil?
|
|
654
|
+
|
|
655
|
+
if form
|
|
656
|
+
body = Utils.encode_form(form)
|
|
657
|
+
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
|
658
|
+
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
659
|
+
else
|
|
660
|
+
body = data
|
|
661
|
+
end
|
|
662
|
+
headers['Accept'] = 'application/json'
|
|
663
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
|
664
|
+
|
|
665
|
+
security = @sdk_configuration.security_source&.call
|
|
666
|
+
|
|
667
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
668
|
+
timeout ||= @sdk_configuration.timeout
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
connection = @sdk_configuration.client
|
|
672
|
+
|
|
673
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
674
|
+
config: @sdk_configuration,
|
|
675
|
+
base_url: base_url,
|
|
676
|
+
oauth2_scopes: nil,
|
|
677
|
+
operation_id: 'createInvoicePayment',
|
|
678
|
+
security_source: @sdk_configuration.security_source
|
|
679
|
+
)
|
|
680
|
+
|
|
681
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
682
|
+
http_response = T.let(nil, T.nilable(Faraday::Response))
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
begin
|
|
686
|
+
http_response = T.must(connection).post(url) do |req|
|
|
687
|
+
req.body = body
|
|
688
|
+
req.headers.merge!(headers)
|
|
689
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
690
|
+
Utils.configure_request_security(req, security)
|
|
691
|
+
|
|
692
|
+
@sdk_configuration.hooks.before_request(
|
|
693
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
694
|
+
hook_ctx: hook_ctx
|
|
695
|
+
),
|
|
696
|
+
request: req
|
|
697
|
+
)
|
|
698
|
+
end
|
|
699
|
+
rescue StandardError => e
|
|
700
|
+
error = e
|
|
701
|
+
ensure
|
|
702
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
703
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
704
|
+
error: error,
|
|
705
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
706
|
+
hook_ctx: hook_ctx
|
|
707
|
+
),
|
|
708
|
+
response: http_response
|
|
709
|
+
)
|
|
710
|
+
else
|
|
711
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
712
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
713
|
+
hook_ctx: hook_ctx
|
|
714
|
+
),
|
|
715
|
+
response: http_response
|
|
716
|
+
)
|
|
717
|
+
end
|
|
718
|
+
|
|
719
|
+
if http_response.nil?
|
|
720
|
+
raise error if !error.nil?
|
|
721
|
+
raise 'no response'
|
|
722
|
+
end
|
|
723
|
+
end
|
|
724
|
+
|
|
725
|
+
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
|
726
|
+
if Utils.match_status_code(http_response.status, ['200'])
|
|
727
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
728
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
729
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
730
|
+
hook_ctx: hook_ctx
|
|
731
|
+
),
|
|
732
|
+
response: http_response
|
|
733
|
+
)
|
|
734
|
+
response_data = http_response.env.response_body
|
|
735
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Components::InvoicePayment)
|
|
736
|
+
response = Models::Operations::CreateInvoicePaymentResponse.new(
|
|
737
|
+
status_code: http_response.status,
|
|
738
|
+
content_type: content_type,
|
|
739
|
+
raw_response: http_response,
|
|
740
|
+
headers: http_response.headers,
|
|
741
|
+
invoice_payment: T.unsafe(obj)
|
|
742
|
+
)
|
|
743
|
+
|
|
744
|
+
return response
|
|
745
|
+
else
|
|
746
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
747
|
+
end
|
|
748
|
+
elsif Utils.match_status_code(http_response.status, ['400', '409'])
|
|
749
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
750
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
751
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
752
|
+
hook_ctx: hook_ctx
|
|
753
|
+
),
|
|
754
|
+
response: http_response
|
|
755
|
+
)
|
|
756
|
+
response_data = http_response.env.response_body
|
|
757
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::GenericError)
|
|
758
|
+
obj.raw_response = http_response
|
|
759
|
+
raise obj
|
|
760
|
+
else
|
|
761
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
762
|
+
end
|
|
763
|
+
elsif Utils.match_status_code(http_response.status, ['422'])
|
|
764
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
765
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
766
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
767
|
+
hook_ctx: hook_ctx
|
|
768
|
+
),
|
|
769
|
+
response: http_response
|
|
770
|
+
)
|
|
771
|
+
response_data = http_response.env.response_body
|
|
772
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::CreateInvoicePaymentError)
|
|
773
|
+
obj.raw_response = http_response
|
|
774
|
+
raise obj
|
|
775
|
+
else
|
|
776
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
777
|
+
end
|
|
778
|
+
elsif Utils.match_status_code(http_response.status, ['401', '403', '404', '429'])
|
|
779
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
780
|
+
elsif Utils.match_status_code(http_response.status, ['500', '504'])
|
|
781
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
782
|
+
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
783
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
784
|
+
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
785
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
786
|
+
else
|
|
787
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown status code received'
|
|
788
|
+
|
|
789
|
+
end
|
|
790
|
+
end
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
sig { params(account_id: ::String, invoice_id: ::String, x_moov_version: T.nilable(::String), timeout_ms: T.nilable(Integer)).returns(Models::Operations::ListInvoicePaymentsResponse) }
|
|
794
|
+
def list_invoice_payments(account_id:, invoice_id:, x_moov_version: nil, timeout_ms: nil)
|
|
795
|
+
# list_invoice_payments - List all the payments made towards an invoice.
|
|
796
|
+
#
|
|
797
|
+
# To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
|
|
798
|
+
# you'll need to specify the `/accounts/{accountID}/invoices.read` scope.
|
|
799
|
+
request = Models::Operations::ListInvoicePaymentsRequest.new(
|
|
800
|
+
account_id: account_id,
|
|
801
|
+
invoice_id: invoice_id,
|
|
802
|
+
x_moov_version: x_moov_version
|
|
803
|
+
)
|
|
804
|
+
url, params = @sdk_configuration.get_server_details
|
|
805
|
+
base_url = Utils.template_url(url, params)
|
|
806
|
+
url = Utils.generate_url(
|
|
807
|
+
Models::Operations::ListInvoicePaymentsRequest,
|
|
808
|
+
base_url,
|
|
809
|
+
'/accounts/{accountID}/invoices/{invoiceID}/payments',
|
|
810
|
+
request,
|
|
811
|
+
@sdk_configuration.globals
|
|
812
|
+
)
|
|
813
|
+
headers = Utils.get_headers(request, @sdk_configuration.globals)
|
|
814
|
+
headers = T.cast(headers, T::Hash[String, String])
|
|
815
|
+
headers['Accept'] = 'application/json'
|
|
816
|
+
headers['user-agent'] = @sdk_configuration.user_agent
|
|
817
|
+
|
|
818
|
+
security = @sdk_configuration.security_source&.call
|
|
819
|
+
|
|
820
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
821
|
+
timeout ||= @sdk_configuration.timeout
|
|
822
|
+
|
|
823
|
+
|
|
824
|
+
connection = @sdk_configuration.client
|
|
825
|
+
|
|
826
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
827
|
+
config: @sdk_configuration,
|
|
828
|
+
base_url: base_url,
|
|
829
|
+
oauth2_scopes: nil,
|
|
830
|
+
operation_id: 'listInvoicePayments',
|
|
831
|
+
security_source: @sdk_configuration.security_source
|
|
832
|
+
)
|
|
833
|
+
|
|
834
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
835
|
+
http_response = T.let(nil, T.nilable(Faraday::Response))
|
|
836
|
+
|
|
837
|
+
|
|
838
|
+
begin
|
|
839
|
+
http_response = T.must(connection).get(url) do |req|
|
|
840
|
+
req.headers.merge!(headers)
|
|
841
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
842
|
+
Utils.configure_request_security(req, security)
|
|
843
|
+
|
|
844
|
+
@sdk_configuration.hooks.before_request(
|
|
845
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
846
|
+
hook_ctx: hook_ctx
|
|
847
|
+
),
|
|
848
|
+
request: req
|
|
849
|
+
)
|
|
850
|
+
end
|
|
851
|
+
rescue StandardError => e
|
|
852
|
+
error = e
|
|
853
|
+
ensure
|
|
854
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
855
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
856
|
+
error: error,
|
|
857
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
858
|
+
hook_ctx: hook_ctx
|
|
859
|
+
),
|
|
860
|
+
response: http_response
|
|
861
|
+
)
|
|
862
|
+
else
|
|
863
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
864
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
865
|
+
hook_ctx: hook_ctx
|
|
866
|
+
),
|
|
867
|
+
response: http_response
|
|
868
|
+
)
|
|
869
|
+
end
|
|
870
|
+
|
|
871
|
+
if http_response.nil?
|
|
872
|
+
raise error if !error.nil?
|
|
873
|
+
raise 'no response'
|
|
874
|
+
end
|
|
875
|
+
end
|
|
876
|
+
|
|
877
|
+
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
|
878
|
+
if Utils.match_status_code(http_response.status, ['200'])
|
|
879
|
+
if Utils.match_content_type(content_type, 'application/json')
|
|
880
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
881
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
882
|
+
hook_ctx: hook_ctx
|
|
883
|
+
),
|
|
884
|
+
response: http_response
|
|
885
|
+
)
|
|
886
|
+
response_data = http_response.env.response_body
|
|
887
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Crystalline::Array.new(Models::Components::InvoicePayment))
|
|
888
|
+
response = Models::Operations::ListInvoicePaymentsResponse.new(
|
|
889
|
+
status_code: http_response.status,
|
|
890
|
+
content_type: content_type,
|
|
891
|
+
raw_response: http_response,
|
|
892
|
+
headers: http_response.headers,
|
|
893
|
+
invoice_payments: T.unsafe(obj)
|
|
894
|
+
)
|
|
895
|
+
|
|
896
|
+
return response
|
|
897
|
+
else
|
|
898
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown content type received'
|
|
899
|
+
end
|
|
900
|
+
elsif Utils.match_status_code(http_response.status, ['401', '403', '429'])
|
|
901
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
902
|
+
elsif Utils.match_status_code(http_response.status, ['500', '504'])
|
|
903
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
904
|
+
elsif Utils.match_status_code(http_response.status, ['4XX'])
|
|
905
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
906
|
+
elsif Utils.match_status_code(http_response.status, ['5XX'])
|
|
907
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'API error occurred'
|
|
908
|
+
else
|
|
909
|
+
raise ::Moov::Models::Errors::APIError.new(status_code: http_response.status, body: http_response.env.response_body, raw_response: http_response), 'Unknown status code received'
|
|
910
|
+
|
|
911
|
+
end
|
|
912
|
+
end
|
|
625
913
|
end
|
|
626
914
|
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
# typed: true
|
|
4
|
+
# frozen_string_literal: true
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Moov
|
|
8
|
+
module Models
|
|
9
|
+
module Components
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class CreateInvoicePayment
|
|
13
|
+
extend T::Sig
|
|
14
|
+
include Crystalline::MetadataFields
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
field :foreign_id, Crystalline::Nilable.new(::String), { 'format_json': { 'letter_case': ::Moov::Utils.field_name('foreignID') } }
|
|
18
|
+
|
|
19
|
+
field :description, Crystalline::Nilable.new(::String), { 'format_json': { 'letter_case': ::Moov::Utils.field_name('description') } }
|
|
20
|
+
|
|
21
|
+
field :payment_date, Crystalline::Nilable.new(::DateTime), { 'format_json': { 'letter_case': ::Moov::Utils.field_name('paymentDate'), 'decoder': Utils.datetime_from_iso_format(true) } }
|
|
22
|
+
|
|
23
|
+
sig { params(foreign_id: T.nilable(::String), description: T.nilable(::String), payment_date: T.nilable(::DateTime)).void }
|
|
24
|
+
def initialize(foreign_id: nil, description: nil, payment_date: nil)
|
|
25
|
+
@foreign_id = foreign_id
|
|
26
|
+
@description = description
|
|
27
|
+
@payment_date = payment_date
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
sig { params(other: T.untyped).returns(T::Boolean) }
|
|
31
|
+
def ==(other)
|
|
32
|
+
return false unless other.is_a? self.class
|
|
33
|
+
return false unless @foreign_id == other.foreign_id
|
|
34
|
+
return false unless @description == other.description
|
|
35
|
+
return false unless @payment_date == other.payment_date
|
|
36
|
+
true
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Moov::Models::Components::CreateInvoicePayment
|
|
6
|
+
extend ::Crystalline::MetadataFields::ClassMethods
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Moov::Models::Components::CreateInvoicePayment
|
|
11
|
+
def foreign_id(); end
|
|
12
|
+
def foreign_id=(str_); end
|
|
13
|
+
def description(); end
|
|
14
|
+
def description=(str_); end
|
|
15
|
+
def payment_date(); end
|
|
16
|
+
def payment_date=(str_); end
|
|
17
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
# typed: true
|
|
4
|
+
# frozen_string_literal: true
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Moov
|
|
8
|
+
module Models
|
|
9
|
+
module Components
|
|
10
|
+
|
|
11
|
+
# Request body for creating a new webhook.
|
|
12
|
+
class CreateWebhook
|
|
13
|
+
extend T::Sig
|
|
14
|
+
include Crystalline::MetadataFields
|
|
15
|
+
|
|
16
|
+
# The URL where webhook events will be sent.
|
|
17
|
+
field :url, ::String, { 'format_json': { 'letter_case': ::Moov::Utils.field_name('url'), required: true } }
|
|
18
|
+
# The status of the webhook.
|
|
19
|
+
field :status, Models::Components::WebhookStatus, { 'format_json': { 'letter_case': ::Moov::Utils.field_name('status'), required: true, 'decoder': Utils.enum_from_string(Models::Components::WebhookStatus, false) } }
|
|
20
|
+
# The list of event types this webhook should subscribe to.
|
|
21
|
+
field :event_types, Crystalline::Array.new(Models::Components::WebhookEventType), { 'format_json': { 'letter_case': ::Moov::Utils.field_name('eventTypes'), required: true } }
|
|
22
|
+
# A description of the webhook for reference. Can be an empty string.
|
|
23
|
+
field :description, ::String, { 'format_json': { 'letter_case': ::Moov::Utils.field_name('description'), required: true } }
|
|
24
|
+
|
|
25
|
+
sig { params(url: ::String, status: Models::Components::WebhookStatus, event_types: T::Array[Models::Components::WebhookEventType], description: ::String).void }
|
|
26
|
+
def initialize(url:, status:, event_types:, description:)
|
|
27
|
+
@url = url
|
|
28
|
+
@status = status
|
|
29
|
+
@event_types = event_types
|
|
30
|
+
@description = description
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
sig { params(other: T.untyped).returns(T::Boolean) }
|
|
34
|
+
def ==(other)
|
|
35
|
+
return false unless other.is_a? self.class
|
|
36
|
+
return false unless @url == other.url
|
|
37
|
+
return false unless @status == other.status
|
|
38
|
+
return false unless @event_types == other.event_types
|
|
39
|
+
return false unless @description == other.description
|
|
40
|
+
true
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Moov::Models::Components::CreateWebhook
|
|
6
|
+
extend ::Crystalline::MetadataFields::ClassMethods
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Moov::Models::Components::CreateWebhook
|
|
11
|
+
def url(); end
|
|
12
|
+
def url=(str_); end
|
|
13
|
+
def status(); end
|
|
14
|
+
def status=(str_); end
|
|
15
|
+
def event_types(); end
|
|
16
|
+
def event_types=(str_); end
|
|
17
|
+
def description(); end
|
|
18
|
+
def description=(str_); end
|
|
19
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
# typed: true
|
|
4
|
+
# frozen_string_literal: true
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
module Moov
|
|
8
|
+
module Models
|
|
9
|
+
module Components
|
|
10
|
+
|
|
11
|
+
# Describes an available event type that can be subscribed to.
|
|
12
|
+
class EventType
|
|
13
|
+
extend T::Sig
|
|
14
|
+
include Crystalline::MetadataFields
|
|
15
|
+
|
|
16
|
+
# Unique identifier for the event type.
|
|
17
|
+
field :event_type_id, ::String, { 'format_json': { 'letter_case': ::Moov::Utils.field_name('eventTypeID'), required: true } }
|
|
18
|
+
# The type identifier string.
|
|
19
|
+
field :type, ::String, { 'format_json': { 'letter_case': ::Moov::Utils.field_name('type'), required: true } }
|
|
20
|
+
# A human-readable description of the event type.
|
|
21
|
+
field :description, ::String, { 'format_json': { 'letter_case': ::Moov::Utils.field_name('description'), required: true } }
|
|
22
|
+
|
|
23
|
+
sig { params(event_type_id: ::String, type: ::String, description: ::String).void }
|
|
24
|
+
def initialize(event_type_id:, type:, description:)
|
|
25
|
+
@event_type_id = event_type_id
|
|
26
|
+
@type = type
|
|
27
|
+
@description = description
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
sig { params(other: T.untyped).returns(T::Boolean) }
|
|
31
|
+
def ==(other)
|
|
32
|
+
return false unless other.is_a? self.class
|
|
33
|
+
return false unless @event_type_id == other.event_type_id
|
|
34
|
+
return false unless @type == other.type
|
|
35
|
+
return false unless @description == other.description
|
|
36
|
+
true
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Moov::Models::Components::EventType
|
|
6
|
+
extend ::Crystalline::MetadataFields::ClassMethods
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Moov::Models::Components::EventType
|
|
11
|
+
def event_type_id(); end
|
|
12
|
+
def event_type_id=(str_); end
|
|
13
|
+
def type(); end
|
|
14
|
+
def type=(str_); end
|
|
15
|
+
def description(); end
|
|
16
|
+
def description=(str_); end
|
|
17
|
+
end
|
|
@@ -14,8 +14,6 @@ module Moov
|
|
|
14
14
|
include Crystalline::MetadataFields
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
field :payment_type, Models::Components::InvoiceExternalPaymentPaymentType, { 'format_json': { 'letter_case': ::Moov::Utils.field_name('paymentType'), required: true, 'decoder': Utils.enum_from_string(Models::Components::InvoiceExternalPaymentPaymentType, false) } }
|
|
18
|
-
|
|
19
17
|
field :description, ::String, { 'format_json': { 'letter_case': ::Moov::Utils.field_name('description'), required: true } }
|
|
20
18
|
|
|
21
19
|
field :amount, Models::Components::AmountDecimal, { 'format_json': { 'letter_case': ::Moov::Utils.field_name('amount'), required: true } }
|
|
@@ -24,9 +22,8 @@ module Moov
|
|
|
24
22
|
|
|
25
23
|
field :payment_date, Crystalline::Nilable.new(::DateTime), { 'format_json': { 'letter_case': ::Moov::Utils.field_name('paymentDate'), 'decoder': Utils.datetime_from_iso_format(true) } }
|
|
26
24
|
|
|
27
|
-
sig { params(
|
|
28
|
-
def initialize(
|
|
29
|
-
@payment_type = payment_type
|
|
25
|
+
sig { params(description: ::String, amount: Models::Components::AmountDecimal, foreign_id: T.nilable(::String), payment_date: T.nilable(::DateTime)).void }
|
|
26
|
+
def initialize(description:, amount:, foreign_id: nil, payment_date: nil)
|
|
30
27
|
@description = description
|
|
31
28
|
@amount = amount
|
|
32
29
|
@foreign_id = foreign_id
|
|
@@ -36,7 +33,6 @@ module Moov
|
|
|
36
33
|
sig { params(other: T.untyped).returns(T::Boolean) }
|
|
37
34
|
def ==(other)
|
|
38
35
|
return false unless other.is_a? self.class
|
|
39
|
-
return false unless @payment_type == other.payment_type
|
|
40
36
|
return false unless @description == other.description
|
|
41
37
|
return false unless @amount == other.amount
|
|
42
38
|
return false unless @foreign_id == other.foreign_id
|
|
@@ -14,15 +14,18 @@ module Moov
|
|
|
14
14
|
include Crystalline::MetadataFields
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
field :
|
|
17
|
+
field :invoice_payment_id, ::String, { 'format_json': { 'letter_case': ::Moov::Utils.field_name('invoicePaymentID'), required: true } }
|
|
18
|
+
|
|
19
|
+
field :invoice_payment_type, Models::Components::InvoicePaymentType, { 'format_json': { 'letter_case': ::Moov::Utils.field_name('invoicePaymentType'), required: true, 'decoder': Utils.enum_from_string(Models::Components::InvoicePaymentType, false) } }
|
|
18
20
|
|
|
19
21
|
field :transfer, Crystalline::Nilable.new(Models::Components::InvoiceTransferPayment), { 'format_json': { 'letter_case': ::Moov::Utils.field_name('transfer') } }
|
|
20
22
|
|
|
21
23
|
field :external, Crystalline::Nilable.new(Models::Components::InvoiceExternalPayment), { 'format_json': { 'letter_case': ::Moov::Utils.field_name('external') } }
|
|
22
24
|
|
|
23
|
-
sig { params(
|
|
24
|
-
def initialize(
|
|
25
|
-
@
|
|
25
|
+
sig { params(invoice_payment_id: ::String, invoice_payment_type: Models::Components::InvoicePaymentType, transfer: T.nilable(Models::Components::InvoiceTransferPayment), external: T.nilable(Models::Components::InvoiceExternalPayment)).void }
|
|
26
|
+
def initialize(invoice_payment_id:, invoice_payment_type:, transfer: nil, external: nil)
|
|
27
|
+
@invoice_payment_id = invoice_payment_id
|
|
28
|
+
@invoice_payment_type = invoice_payment_type
|
|
26
29
|
@transfer = transfer
|
|
27
30
|
@external = external
|
|
28
31
|
end
|
|
@@ -30,7 +33,8 @@ module Moov
|
|
|
30
33
|
sig { params(other: T.untyped).returns(T::Boolean) }
|
|
31
34
|
def ==(other)
|
|
32
35
|
return false unless other.is_a? self.class
|
|
33
|
-
return false unless @
|
|
36
|
+
return false unless @invoice_payment_id == other.invoice_payment_id
|
|
37
|
+
return false unless @invoice_payment_type == other.invoice_payment_type
|
|
34
38
|
return false unless @transfer == other.transfer
|
|
35
39
|
return false unless @external == other.external
|
|
36
40
|
true
|
|
@@ -8,8 +8,10 @@ end
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class Moov::Models::Components::InvoicePayment
|
|
11
|
-
def
|
|
12
|
-
def
|
|
11
|
+
def invoice_payment_id(); end
|
|
12
|
+
def invoice_payment_id=(str_); end
|
|
13
|
+
def invoice_payment_type(); end
|
|
14
|
+
def invoice_payment_type=(str_); end
|
|
13
15
|
def transfer(); end
|
|
14
16
|
def transfer=(str_); end
|
|
15
17
|
def external(); end
|
|
@@ -14,20 +14,16 @@ module Moov
|
|
|
14
14
|
include Crystalline::MetadataFields
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
field :payment_type, Models::Components::InvoiceTransferPaymentPaymentType, { 'format_json': { 'letter_case': ::Moov::Utils.field_name('paymentType'), required: true, 'decoder': Utils.enum_from_string(Models::Components::InvoiceTransferPaymentPaymentType, false) } }
|
|
18
|
-
|
|
19
17
|
field :transfer_id, ::String, { 'format_json': { 'letter_case': ::Moov::Utils.field_name('transferID'), required: true } }
|
|
20
18
|
|
|
21
|
-
sig { params(
|
|
22
|
-
def initialize(
|
|
23
|
-
@payment_type = payment_type
|
|
19
|
+
sig { params(transfer_id: ::String).void }
|
|
20
|
+
def initialize(transfer_id:)
|
|
24
21
|
@transfer_id = transfer_id
|
|
25
22
|
end
|
|
26
23
|
|
|
27
24
|
sig { params(other: T.untyped).returns(T::Boolean) }
|
|
28
25
|
def ==(other)
|
|
29
26
|
return false unless other.is_a? self.class
|
|
30
|
-
return false unless @payment_type == other.payment_type
|
|
31
27
|
return false unless @transfer_id == other.transfer_id
|
|
32
28
|
true
|
|
33
29
|
end
|