Class: MangoApi::KycDocuments
- Inherits:
-
Object
- Object
- MangoApi::KycDocuments
- Extended by:
- UriProvider
- Defined in:
- lib/mangopay/api/service/kyc_documents.rb
Overview
Provides API method delegates concerning the KycDocument
entity
Class Method Summary collapse
-
.all {|filter_request = FilterRequest.new| ... } ⇒ Array
Retrieves pages of KYC document entities belonging to current environment’s client.
-
.consult(id) ⇒ Array
Creates temporary URLs where each page of a KYC document can be viewed.
-
.create(kyc_document, user_id, id_key = nil) ⇒ KycDocument
Creates a new KYC document entity.
-
.of_user(id) {|filter_request = FilterRequest.new| ... } ⇒ Array
Retrieves pages of KYC document entities belonging to a certain user entity.
-
.submit(id, user_id, tag = nil) ⇒ KycDocument
Submits a KYC document entity for approval.
-
.upload_page(id, user_id, path) ⇒ Object
Uploads a KYC document page.
Methods included from UriProvider
Class Method Details
.all {|filter_request = FilterRequest.new| ... } ⇒ Array
Retrieves pages of KYC document entities belonging to current environment’s client. Allows configuration of paging and sorting parameters by yielding a filtering object to a provided block. When no filters are specified, will retrieve the first page of 10 newest results.
Allowed FilterRequest
params:
-
page
-
per_page
-
sort_field and sort_direction
-
before_date
-
after_date
-
status
77 78 79 80 81 82 83 |
# File 'lib/mangopay/api/service/kyc_documents.rb', line 77 def all uri = provide_uri(:get_kyc_documents) filter_request = nil yield filter_request = FilterRequest.new if block_given? results = HttpClient.get(uri, filter_request) parse_docs results end |
.consult(id) ⇒ Array
Creates temporary URLs where each page of a KYC document can be viewed.
113 114 115 116 117 |
# File 'lib/mangopay/api/service/kyc_documents.rb', line 113 def consult(id) uri = provide_uri(:consult_kyc_document, id) results = HttpClient.post(uri, nil) parse_consults results end |
.create(kyc_document, user_id, id_key = nil) ⇒ KycDocument
Creates a new KYC document entity.
KycDocument
properties:
-
Required
-
type
-
-
Optional
-
tag
-
to be created created for
27 28 29 30 31 |
# File 'lib/mangopay/api/service/kyc_documents.rb', line 27 def create(kyc_document, user_id, id_key = nil) uri = provide_uri(:create_kyc_document, user_id) response = HttpClient.post(uri, kyc_document, id_key) parse response end |
.of_user(id) {|filter_request = FilterRequest.new| ... } ⇒ Array
Retrieves pages of KYC document entities belonging to a certain user entity. Allows configuration of paging and sorting parameters by yielding a filtering object to a provided block. When no filters are specified, will retrieve the first page of 10 newest results.
Allowed FilterRequest
params:
-
page
-
per_page
-
sort_field and sort_direction
-
before_date
-
after_date
-
status
100 101 102 103 104 105 106 |
# File 'lib/mangopay/api/service/kyc_documents.rb', line 100 def of_user(id) uri = provide_uri(:get_users_kyc_documents, id) filter_request = nil yield filter_request = FilterRequest.new if block_given? results = HttpClient.get(uri, filter_request) parse_docs results end |
.submit(id, user_id, tag = nil) ⇒ KycDocument
Submits a KYC document entity for approval.
submitted for
55 56 57 58 59 60 |
# File 'lib/mangopay/api/service/kyc_documents.rb', line 55 def submit(id, user_id, tag = nil) uri = provide_uri(:submit_kyc_document, user_id, id) request = SubmitDocumentRequest.new(tag) response = HttpClient.put(uri, request) parse response end |
.upload_page(id, user_id, path) ⇒ Object
Uploads a KYC document page. Allowed file extensions: .pdf .jpeg .jpg .gif .png
is being uploaded for updated for
41 42 43 44 45 46 |
# File 'lib/mangopay/api/service/kyc_documents.rb', line 41 def upload_page(id, user_id, path) uri = provide_uri(:upload_kyc_document_page, user_id, id) body = UploadFileRequest.new body.file = FileEncoder.encode_base64 path HttpClient.post(uri, body) end |