-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2508 from mercadopago/feature/rdc-migration
feature/rdc-migration
- Loading branch information
Showing
81 changed files
with
2,319 additions
and
869 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Launch Camera via Callback | ||
|
||
This mode centralizes the flow of launching the scanner camera in a single method, `launchScanner`, which, along with the use of callbacks for handling responses, simplifies the implementation and reading of codes. | ||
|
||
For this implementation, you will need to differentiate which type of code you want to scan using the `ScanType` class, and provide the callback to be invoked with the result of the operation, as shown in the example below and in the descriptions of the fields to be completed. | ||
|
||
[[[ | ||
```kotlin | ||
val cameraScanner = MPManager.cameraScanner | ||
/** | ||
* launch camera for QR scanner code | ||
**/ | ||
cameraScanner.launchScanner(ScanType.CAMERA_SCANNER_QR) { response -> | ||
response | ||
.doIfSuccess { result -> // Handling the successful scanner result result.message } | ||
|
||
.doIfError { error -> // Handling the error resulting from the scanner error.message.orEmpty() } | ||
|
||
} | ||
|
||
/** | ||
* launch camera for Barcode scanner | ||
**/ | ||
|
||
cameraScanner.launchScanner(ScanType.CAMERA_SCANNER_BARCODE) { response -> | ||
response | ||
.doIfSuccess { result -> // Handling the successful scanner result result.message } | ||
|
||
.doIfError { error -> // Handling the error resulting from the scanner error.message.orEmpty() } | ||
|
||
} | ||
``` | ||
```java | ||
final CameraScanner cameraScanner = MPManager.INSTANCE.getCameraScanner(); | ||
final Function<MPResponse<CameraScannerResponse>, Unit> callback = new Function<MPResponse<CameraScannerResponse>, Unit>() { | ||
@Override | ||
public Unit apply(MPResponse<CameraScannerResponse> response) { | ||
if (response.getStatus() == ResponseStatus.SUCCESS) { | ||
|
||
// Handle the successful response | ||
CameraScannerResponse cameraScannerResponse = response.getData(); | ||
|
||
String result = cameraScannerResponse.getMessage(); | ||
// ... Do something with the result | ||
} else { | ||
|
||
// Handle the error in the response | ||
String errorMessage = response.getError(); | ||
// ... Do something with the error | ||
} | ||
return Unit.INSTANCE; | ||
} | ||
}; | ||
|
||
/** | ||
* Launch the camera scanner for QR or Barcode with the callback: ScanType.CAMERA_SCANNER_QR - ScanType.CAMERA_SCANNER_BARCODE | ||
*/ | ||
|
||
cameraScanner.launchScanner(ScanType.CAMERA_SCANNER_QR, callback); | ||
``` | ||
]]] | ||
|
||
| Field | Description | | ||
|---|---| | ||
|**ScanType**| Class that contains the types of codes to be read by the camera. Possible values are:<br><br> - `CAMERA_SCANNER_QR`: represents the reading of QR codes.<br><br> - `CAMERA_SCANNER_BARCODE`: represents the reading of barcodes.| | ||
|**callback (MPResponse<CameraScannerResponse>) -> Unit**| Callback to be invoked with the result of the scanner operation. Receives an `MPResponse` object with a `CameraScannerResponse`.| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Lanzar cámara por callback | ||
|
||
Esta modalidad centraliza el flujo de lanzamiento de la cámara scanner en un sólo método, `launchScanner`, que junto con la utilización de callbacks para el manejo de respuestas, simplifica el proceso de implementación y lectura de códigos. | ||
|
||
Para esta implementación, deberás diferenciar qué tipo de código deseas escanear mediante la clase `ScanType`, y proporcionar el callback a ser invocado con el resultado de la operación, tal como se muestra en el ejemplo a continuación y en las descripciones de los campos a completar. | ||
|
||
[[[ | ||
```kotlin | ||
val cameraScanner = MPManager.cameraScanner | ||
/** | ||
* launch camera for scanner code QR | ||
**/ | ||
cameraScanner.launchScanner(ScanType.CAMERA_SCANNER_QR) { response -> | ||
response | ||
.doIfSuccess { result -> // Manejo del resultado success del scanner result.message } | ||
|
||
.doIfError { error -> // Manejo del error que resulte del scanner error.message.orEmpty() } | ||
|
||
} | ||
|
||
/** | ||
* launch camera for scanner Bar code | ||
**/ | ||
|
||
cameraScanner.launchScanner(ScanType.CAMERA_SCANNER_BARCODE) { response -> | ||
response | ||
.doIfSuccess { result -> // Manejo del resultado success del scanner result.message } | ||
|
||
.doIfError { error -> // Manejo del error que resulte del scanner error.message.orEmpty() } | ||
|
||
} | ||
``` | ||
```java | ||
final CameraScanner cameraScanner = MPManager.INSTANCE.getCameraScanner(); | ||
final Function<MPResponse<CameraScannerResponse>, Unit> callback = new Function<MPResponse<CameraScannerResponse>, Unit>() { | ||
@Override | ||
public Unit apply(MPResponse<CameraScannerResponse> response) { | ||
if (response.getStatus() == ResponseStatus.SUCCESS) { | ||
|
||
// Manejar la respuesta exitosa | ||
CameraScannerResponse cameraScannerResponse = response.getData(); | ||
|
||
String result = cameraScannerResponse.getMessage(); | ||
// ... Hacer algo con el resultado | ||
} else { | ||
|
||
// Manejar el error en la respuesta | ||
String errorMessage = response.getError(); | ||
// ... Hacer algo con el error | ||
} | ||
return Unit.INSTANCE; | ||
} | ||
}; | ||
|
||
/** | ||
* Lanzar el escáner de cámara QR o Barra con el callback: ScanType.CAMERA_SCANNER_QR - ScanType.CAMERA_SCANNER_BARCODE | ||
*/ | ||
|
||
cameraScanner.launchScanner(ScanType.CAMERA_SCANNER_QR, callback); | ||
``` | ||
]]] | ||
|
||
| Campo | Descripción | | ||
|---|---| | ||
|**ScanType**| Clase que contiene los tipos de código a ser leídos por la cámara. Los valores posibles son:<br><br> - `CAMERA_SCANNER_QR`: representa la lectura de códigos QR.<br><br> - `CAMERA_SCANNER_BARCODE`: representa la lectura de códigos de barras.| | ||
|**callback (MPResponse<CameraScannerResponse>) -> Unit**| Callback a ser invocado con el resultado de la operación del escáner. Recibe un objeto `MPResponse` con un `CameraScannerResponse`.| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Iniciar câmera via callback | ||
|
||
Esta modalidade centraliza o fluxo de lançamento da câmera scanner em um único método, `launchScanner`, que junto com a utilização de callbacks para o manuseio de respostas, simplifica o processo de implementação e leitura de códigos. | ||
|
||
Para essa implementação, você deverá diferenciar qual tipo de código deseja escanear através da classe `ScanType`, e fornecer o callback a ser chamado com o resultado da operação, como mostrado no exemplo abaixo e nas descrições dos campos a serem preenchidos. | ||
|
||
[[[ | ||
```kotlin | ||
val cameraScanner = MPManager.cameraScanner | ||
/** | ||
* iniciar câmera para escanear código QR | ||
**/ | ||
cameraScanner.launchScanner(ScanType.CAMERA_SCANNER_QR) { response -> | ||
response | ||
.doIfSuccess { result -> // Manuseio do resultado de sucesso do scanner result.message } | ||
|
||
.doIfError { error -> // Manuseio do erro resultante do scanner error.message.orEmpty() } | ||
|
||
} | ||
|
||
/** | ||
* iniciar câmera para escanear código de barras | ||
**/ | ||
|
||
cameraScanner.launchScanner(ScanType.CAMERA_SCANNER_BARCODE) { response -> | ||
response | ||
.doIfSuccess { result -> // Manuseio do resultado de sucesso do scanner result.message } | ||
|
||
.doIfError { error -> // Manuseio do erro resultante do scanner error.message.orEmpty() } | ||
|
||
} | ||
``` | ||
```java | ||
final CameraScanner cameraScanner = MPManager.INSTANCE.getCameraScanner(); | ||
final Function<MPResponse<CameraScannerResponse>, Unit> callback = new Function<MPResponse<CameraScannerResponse>, Unit>() { | ||
@Override | ||
public Unit apply(MPResponse<CameraScannerResponse> response) { | ||
if (response.getStatus() == ResponseStatus.SUCCESS) { | ||
|
||
// Manusear a resposta bem-sucedida | ||
CameraScannerResponse cameraScannerResponse = response.getData(); | ||
|
||
String result = cameraScannerResponse.getMessage(); | ||
// ... Fazer algo com o resultado | ||
} else { | ||
|
||
// Manusear o erro na resposta | ||
String errorMessage = response.getError(); | ||
// ... Fazer algo com o erro | ||
} | ||
return Unit.INSTANCE; | ||
} | ||
}; | ||
|
||
/** | ||
* Iniciar o escâner de câmera QR ou Barra com o callback: ScanType.CAMERA_SCANNER_QR - ScanType.CAMERA_SCANNER_BARCODE | ||
*/ | ||
|
||
cameraScanner.launchScanner(ScanType.CAMERA_SCANNER_QR, callback); | ||
``` | ||
]]] | ||
|
||
| Campo | Descrição | | ||
|---|---| | ||
|**ScanType**| Classe que contém os tipos de código a serem lidos pela câmera. Os valores possíveis são:<br><br> - `CAMERA_SCANNER_QR`: representa a leitura de códigos QR.<br><br> - `CAMERA_SCANNER_BARCODE`: representa a leitura de códigos de barras.| | ||
|**callback (MPResponse<CameraScannerResponse>) -> Unit**| Callback a ser invocado com o resultado da operação do escâner. Recebe um objeto `MPResponse` com um `CameraScannerResponse`.| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Launch Camera Scanner | ||
|
||
Using our SDKs, it is possible to launch the scanner camera of the Point Smart devices to read QR codes and barcodes. | ||
|
||
To do this, the **recommended option** is to implement the [Callback method](/developers/en/docs/main-apps/camscanner/callback), which allows for straightforward integration by centralizing the launch in a single method. | ||
|
||
> WARNING | ||
> | ||
> Important | ||
> | ||
> If you have an old integration of Main Apps, it is likely that you have implemented a **legacy method to launch the scanner camera**, based on an additional implementation (`onActivityResult`). While this method is still operational, we recommend updating your integration to the Callback method for a simplified implementation. If you need support for your old implementation, please refer to the [documentation](/developers/en/docs/main-apps/camscanner/legacy). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Lanzar cámara scanner | ||
|
||
Utilizando nuestros SDKs, es posible lanzar la cámara scanner de los dispositivos Point Smart para leer córidos QR y de barras. | ||
|
||
Para hacerlo, la **opción recomendada** es implementar el [método Callback](/developers/es/docs/main-apps/camscanner/callback), que permite una integración sencilla al centralizar el lanzamiento en un solo método. | ||
|
||
> WARNING | ||
> | ||
> Importante | ||
> | ||
> Si cuentas con una integración antigua de Main Apps, es probable que tengas implementado un **método legacy para lanzar cámara scanner**, basado una implementación adicional (`onActivityResult`). Si bien este método continúa en funcionamiento, recomendamos actualizar tu integración al método Callback para contar con una implementación simplificada. Si necesitas soporte para tu implementación antigua, accede a la [documentación](/developers/es/docs/main-apps/camscanner/legacy). |
Oops, something went wrong.