A példa létrehoz egy adószámos partnert, aztán kétszer hívja a guess()-t. A pontos név a meglévő partnert adja vissza, de a taxType a válaszban üres. A név eleje már új partnert hoz létre, holott a cím ugyanaz.
Pontos névre a meglévő partner üres taxType-pal, a név elejére új partner, mindkettő 201.
Futtatás a sandboxbanimport { } from 'tarcajs'
const = ()
const = { : '1111', : 'Budapest', : 'Fő utca 1.' }
const = await ..({
: 'Vevő Kft.',
: ,
: '12345678-2-42',
: 'HAS_TAX_NUMBER',
})
const = await ..({ : 'Vevő Kft.', : })
const = await ..({ : 'Vevő', : })
.('meglévő:', ., .)
.('pontos név:', ., .(.))
.('a név eleje:', ., 'új partner')POST /partners HTTP/1.1
content-type: application/json
{
"name": "Vevő Kft.",
"address": {
"country_code": "HU",
"post_code": "1111",
"city": "Budapest",
"address": "Fő utca 1."
},
"taxcode": "12345678-2-42",
"tax_type": "HAS_TAX_NUMBER"
}POST /partners/guess HTTP/1.1
content-type: application/json
{
"name": "Vevő Kft.",
"address": {
"country_code": "HU",
"post_code": "1111",
"city": "Budapest",
"address": "Fő utca 1."
}
}POST /partners/guess HTTP/1.1
content-type: application/json
{
"name": "Vevő",
"address": {
"country_code": "HU",
"post_code": "1111",
"city": "Budapest",
"address": "Fő utca 1."
}
}HTTP/1.1 201
content-type: application/json
{
"id": 1,
"name": "Vevő Kft.",
"address": {
"country_code": "HU",
"post_code": "1111",
"city": "Budapest",
"address": "Fő utca 1."
},
"emails": [],
"taxcode": "12345678-2-42",
"iban": "",
"swift": "",
"account_number": "",
"phone": "",
"general_ledger_number": "",
"tax_type": "HAS_TAX_NUMBER",
"custom_billing_settings": {
"payment_method": null,
"document_form": null,
"due_days": null,
"document_currency": null,
"template_language_code": null,
"discount": null,
"custom_label": null
},
"group_member_tax_number": "",
"giro_settings": {
"giro_default_settings": true,
"giro_payment_request_enabled": false,
"giro_different_amount_allowed": false
},
"partner_shipping": {
"match": true,
"name": "",
"mode": "none",
"address": {
"country_code": "HU",
"post_code": "",
"city": "",
"address": ""
}
},
"internal_comment": "",
"partner_show_type": "show_all"
}HTTP/1.1 201
content-type: application/json
{
"id": 1,
"name": "Vevő Kft.",
"address": {
"country_code": "HU",
"post_code": "1111",
"city": "Budapest",
"address": "Fő utca 1."
},
"emails": [],
"taxcode": "12345678-2-42",
"iban": "",
"swift": "",
"account_number": "",
"phone": "",
"general_ledger_number": "",
"tax_type": "",
"custom_billing_settings": {
"payment_method": null,
"document_form": null,
"due_days": null,
"document_currency": null,
"template_language_code": null,
"discount": null,
"custom_label": null
},
"group_member_tax_number": "",
"giro_settings": {
"giro_default_settings": true,
"giro_payment_request_enabled": false,
"giro_different_amount_allowed": false
},
"partner_shipping": {
"match": true,
"name": "",
"mode": "none",
"address": {
"country_code": "HU",
"post_code": "",
"city": "",
"address": ""
}
},
"internal_comment": "",
"partner_show_type": "show_all"
}HTTP/1.1 201
content-type: application/json
{
"id": 2,
"name": "Vevő",
"address": {
"country_code": "HU",
"post_code": "1111",
"city": "Budapest",
"address": "Fő utca 1."
},
"emails": [],
"taxcode": "",
"iban": "",
"swift": "",
"account_number": "",
"phone": "",
"general_ledger_number": "",
"tax_type": "",
"custom_billing_settings": {
"payment_method": null,
"document_form": null,
"due_days": null,
"document_currency": null,
"template_language_code": null,
"discount": null,
"custom_label": null
},
"group_member_tax_number": "",
"giro_settings": {
"giro_default_settings": true,
"giro_payment_request_enabled": false,
"giro_different_amount_allowed": false
},
"partner_shipping": {
"match": true,
"name": "",
"mode": "none",
"address": {
"country_code": "HU",
"post_code": "",
"city": "",
"address": ""
}
},
"internal_comment": "",
"partner_show_type": "show_all"
}meglévő: 1 HAS_TAX_NUMBER
pontos név: 1 ""
a név eleje: 2 új partnerA Billingo válasz fülön mindkét PartnerGuess 201-et kap, a meglévő partnerre és az újra is. A hamis Billingo keresőindexe nem késik; élőben egy frissen létrehozott partnerre a pontos név is duplikátumot adhatna.