Skip to content

Instantly share code, notes, and snippets.

@brunoluiz
Last active August 7, 2018 22:51
Show Gist options
  • Save brunoluiz/1fc6ff013c34b198c758a35a3012db22 to your computer and use it in GitHub Desktop.
Save brunoluiz/1fc6ff013c34b198c758a35a3012db22 to your computer and use it in GitHub Desktop.
diffs.md

Old format:

{
    "clientId": "hering",
    "origin": {
      "type": "CLIENT",
      "name": "Cia Hering",
      "account": "voucher"
    },
    "destination": {
      "type": "STORE",
      "storeId": "site",
      "name": "Site",
      "cnpj": "12312312312312",
      "costCenter": null,
      "checkAccount": null,
      "businessCode": null
    },
    "clousureDate": "",
    "totalPercent": 0.024750933997509,
    "orderDate": "2018-07-30T22:41:34.000Z",
    "devolutionDate": null,
    "payment": {
      "method": "BOLETO",
      "brand": null,
      "acquirer": null,
      "condition": "atSight"
    },
    "deliveryType": "SHIPMENT",
    "installments": {
      "current": 0,
      "total": 1
    },
    "event": {
      "type": "cost",
      "totalPercent": 0.024750933997509
    },
    "order": {
      "id": "teste30076",
      "price": 64.24,
      "freight": 24.86
    },
    "total": 1.59
}

New format:

{
  "id": 3,
  "clientId": "centauro",
  "orderId": "xyz",
  "fulfillmentId": "FF1",
  "destination": "site",
  "origin": "VOUCHER",
  "accountType": "MERCHANDISE",
  "storeDirection": "FROM_DESTINATION",
  "operation": "CREDIT",
  "value": 94.03,
  "description": "Pagamento mercadoria",
  "installment": 1,
  "numberOfInstallments": 1,
  "paymentCondition": "AT_SIGHT",
  "payments": [
    {
      "type": "CREDIT_CARD",
      "brand": "VISA",
      "amount": 100,
      "method": "CIELO",
      "currency": "BRL",
      "isCaptured": false,
      "installments": 3,
      "paymentNumber": 1,
      "fraudCheckStatus": "WAITING",
      "transactionNumber": "2146020520"
    }
  ],
  "order": {
    "price": 207.32,
    "freight": 11.43
  },
  "deliveryType": "SHIPMENT",
  "totalPercent": 0.94,
  "eventDate": "2017-08-20T11:17:38.000Z",
  "date": "2017-08-20T11:17:38.000Z",
  "placedAt": "2017-08-20T11:17:38.000Z",
  "exceptionType": null,
  "exceptionAt": null
}

Differences:

  • destination: pode ser a loja ou conta do cliente e será uma string
  • origin: pode ser a loja ou conta do cliente e será uma string
  • storeDirection: indica se a loja está em destination o origin
  • accountType: antigo event.type
  • installments.current\total: vira numberOfInstallments e installment
  • order.id: está na raiz, como orderId
  • devolutionDate: será o exceptionAt e exceptionType (visto que depois terá outras exceções)
  • total: antigo value
  • payments: novos campos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment