Ejemplos
Ejemplo 1: Crear una tarjeta personalizada y usarla en un flujo de trabajo
Paso 1: Crear la tarjeta
{
"app_manifest": {
"id": "com.example.invoice-tools",
"name": "Invoice Tools",
"version": "1.0.0",
"partner": {
"id": "example-partner",
"name": "Example Corp"
}
},
"card_manifest": {
"id": "high-value-check",
"title": {"en": "High Value Invoice Check"},
"entry_point": "src/high_value.py",
"class_name": "HighValueCheck",
"args": [
{
"id": "threshold",
"title": {"en": "Amount Threshold"},
"type": "number",
"required": true
}
]
},
"card_type": "condition",
"source_code": "from api.sdk.base import PartnerCard\nfrom api.sdk.result import CardResult, CardStatus\n\nclass HighValueCheck(PartnerCard):\n def execute(self, context):\n threshold = float(self.variables.get('threshold', 1000))\n total = float(context.document_fields.get('total_amount', 0))\n if total > threshold:\n return CardResult(status=CardStatus.SUCCESS, message=f'High value: {total}')\n return CardResult(status=CardStatus.FAILURE, message=f'Below threshold: {total}')",
"test_code": "def test_high_value():\n assert True # Basic test"
}Paso 2: Validar la tarjeta
Paso 3: Probar la tarjeta
Paso 4: Aprobar la tarjeta
Paso 5: Construir un flujo de trabajo con la tarjeta
Paso 6: Probar el flujo de trabajo
Ejemplo 2: Construir un flujo de trabajo con tarjetas integradas
Paso 1: Descubrir las tarjetas disponibles
Paso 2: Crear el flujo de trabajo
Ejemplo 3: Importar tarjetas desde GitHub
Last updated
Was this helpful?