Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Special chars are changed to � #149

Open
luluhoc opened this issue Oct 5, 2024 · 1 comment
Open

Special chars are changed to � #149

luluhoc opened this issue Oct 5, 2024 · 1 comment

Comments

@luluhoc
Copy link

luluhoc commented Oct 5, 2024

Describe the bug
The letter â in Bâtiment is changed to �

const template = [
  'getcurrentsalesresult/response/sales/sale',
  {
    purchaseId: 'purchaseid',
    purchaseDate: 'purchasedate',
    deliveryInformation: {
      shippingType: 'deliveryinformation/shippingtype',
      isFullRSL: 'boolean(deliveryinformation/isfullrsl = "Y")',
      buyerLogin: 'deliveryinformation/purchasebuyerlogin',
      buyerEmail: 'deliveryinformation/purchasebuyeremail',
      address: {
        civility: 'deliveryinformation/deliveryaddress/civility',
        lastName: 'deliveryinformation/deliveryaddress/lastname',
        firstName: 'deliveryinformation/deliveryaddress/firstname',
        address1: 'deliveryinformation/deliveryaddress/address1',
        address2: 'deliveryinformation/deliveryaddress/address2',
        zipcode: 'deliveryinformation/deliveryaddress/zipcode',
        city: 'deliveryinformation/deliveryaddress/city',
        country: 'deliveryinformation/deliveryaddress/country',
        countryAlpha2: 'deliveryinformation/deliveryaddress/countryalpha2',
        phoneNumber1: 'deliveryinformation/deliveryaddress/phonenumber1',
        phoneNumber2: 'deliveryinformation/deliveryaddress/phonenumber2',
      },
    },
    items: [
      'items/item',
      {
        sku: 'sku',
        advertId: 'advertid',
        advertPriceListed: {
          amount: 'advertpricelisted/amount',
          currency: 'advertpricelisted/currency',
        },
        itemId: 'itemid',
        headline: 'headline',
        itemStatus: 'itemstatus',
        shipped: 'boolean(shipped = "1")',
        isPreorder: 'boolean(ispreorder = "Y")',
        isNegotiated: 'boolean(isnego = "Y")',
        price: {
          amount: 'price/amount',
          currency: 'price/currency',
        },
        isRSL: 'boolean(isrsl = "Y")',
        isbn: 'isbn',
        ean: 'ean',
        paymentStatus: 'paymentstatus',
      },
    ],
  },
]

async transformXMLToJSON(xml: string): any {
    // Transform
    return transform(xml, template)
  }

[
  {
    "purchaseId": "534534534",
    "purchaseDate": "05/10/2024-12:23",
    "deliveryInformation": {
      "shippingType": "Suivi",
      "isFullRSL": false,
      "buyerLogin": "XXXX",
      "buyerEmail": "[email protected]",
      "address": {
        "civility": "M.",
        "lastName": "XXX",
        "firstName": "XXX",
        "address1": "XXX",
        "address2": "B�timent ",
        "zipcode": "XXX",
        "city": "XXX",
        "country": "France",
        "countryAlpha2": "FX",
        "phoneNumber1": "",
        "phoneNumber2": "XXX"
      }
    },
    "items": [
      {
        "sku": "534543534",
        "advertId": "53453453",
        "advertPriceListed": {
          "amount": "27.99",
          "currency": "EUR"
        },
        "itemId": "534543534",
        "headline": "XXX",
        "itemStatus": "COMMITTED",
        "shipped": true,
        "isPreorder": false,
        "isNegotiated": false,
        "price": {
          "amount": "27.99",
          "currency": "EUR"
        },
        "isRSL": false,
        "isbn": "",
        "ean": "5345435435435345; 5345436534546; ",
        "paymentStatus": "INCOMING"
      }
    ]
  }
]

@tuananh
Copy link
Owner

tuananh commented Oct 14, 2024

@luluhoc can you upload the original xml here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants