OpenBazaar / openbazaar-go

OpenBazaar 2.0 Server Daemon in Go
MIT License
991 stars 284 forks source link

Invalid Payment Address on Moderated ETH Purchase #1993

Open jjeffryes opened 4 years ago

jjeffryes commented 4 years ago

When attempting to purchase a listing, I got this error: vendor rejected order, reason: invalid payment address

This was on a listing I had previously purchased, but since that purchase I (as the seller) added a moderator to my store.

The buyer purchased the updated moderated version of the listing.

ob://QmVF14jczeRFii8ptcvXScFVkHWCg9WnThU2dPoqqDjLep/store/test-eth-precision

{
  "address": "",
  "addressNotes": "",
  "alternateContactInfo": "",
  "city": "",
  "countryCode": "",
  "items": [
    {
      "listingHash": "QmNXS56Cef4pC4gigHrocXNmhrpJ8Qf4yHqFqBsYNCLZDB",
      "options": [],
      "shipping": {
        "name": ""
      },
      "memo": "",
      "coupons": [],
      "bigQuantity": "100000"
    }
  ],
  "moderator": "QmS8SNk8WzDMZRtfoAngPKoBt2HCiQo8bJnU5NRCMMz3B6",
  "paymentCoin": "ETH",
  "postalCode": "",
  "shipTo": "",
  "state": ""
}
jjeffryes commented 4 years ago

I get this error on 2 different listings (same seller) if I try to make a moderated purchase, but making a direct purchase works normally with both.

jjeffryes commented 4 years ago

Here's the log from the buyer's server when a purchase is made with an invalid payment:

2020-02-24 15:40:40.884 [DEBUG] [recordAgingNotifier/PerformTask] notifications created/records updated: dispute: 0/0, sales: 0/0, purchaseTimeout: 0/0, purchaseExpire: 0/0
2020-02-24 15:40:42.166 [DEBUG] [service/SendRequest] Sending ORDER request to QmdE1iJkTvbvRVf9pj6t7vCiv46VepP53t8AZsnkobC5Zw
2020-02-24 15:40:42.167 [DEBUG] [service/messageSenderForPeer] Found existing message sender for: QmdE1iJkTvbvRVf9pj6t7vCiv46VepP53t8AZsnkobC5Zw
2020-02-24 15:40:42.237 [DEBUG] [service/handleNewMessage] received response message from QmdE1iJkTvbvRVf9pj6t7vCiv46VepP53t8AZsnkobC5Zw: 1540949909
2020-02-24 15:40:42.237 [DEBUG] [service/handleNewMessage] found matching request for: 1540949909
2020-02-24 15:40:42.237 [DEBUG] [service/SendRequest] Received response from QmdE1iJkTvbvRVf9pj6t7vCiv46VepP53t8AZsnkobC5Zw

Here's the log from the seller's server when a purchase is made with an invalid payment:

2020-02-24 15:40:42.167 [DEBUG] [service/handleOrder] handling normal order from: QmXAFp8nQZKBeLY2ecsmS5gm3kguXnQeidBJxtJazTVijT
2020-02-24 15:40:42.173 [DEBUG] [service/handleOrder] incoming order linked to TETH wallet
2020-02-24 15:40:42.173 [DEBUG] [service/handleOrder] processing moderated online order from QmXAFp8nQZKBeLY2ecsmS5gm3kguXnQeidBJxtJazTVijT
2020-02-24 15:40:42.236 [DEBUG] [service/handleNewMessage] ORDER handle message error from QmXAFp8nQZKBeLY2ecsmS5gm3kguXnQeidBJxtJazTVijT: invalid payment address
2020-02-24 15:40:42.236 [DEBUG] [service/handleNewMessage] sending response message to: QmXAFp8nQZKBeLY2ecsmS5gm3kguXnQeidBJxtJazTVijT
2020-02-24 15:40:42.476 [DEBUG] [recordAgingNotifier/PerformTask] notifications created/records updated: sales: 0/0, purchaseTimeout: 0/0, purchaseExpire: 0/0, dispute: 0/0
jjeffryes commented 4 years ago
{
    "listing": {
        "slug": "jj-test-usd-to-eth-conversion",
        "vendorID": {
            "peerID": "QmdE1iJkTvbvRVf9pj6t7vCiv46VepP53t8AZsnkobC5Zw",
            "handle": "",
            "pubkeys": {
                "identity": "CAESIKWy9WR9N9wxhM1/5mqnx83NsUV5YeIsDc6Cc831AhUw",
                "bitcoin": "AkCez6qEcbOoY4ejKd6aw//uzb6riZ/HIZ+hpU9B9Mfh"
            },
            "bitcoinSig": "MEUCIQDtjbdwjDOQvgXzwMgNj6OfZ3x+l4JCfGx0y7QHf+3CjgIgG8LVdK7YAzxrfFbtWwhTs3wJkmNlvy5vu5WKE8Ug8XI="
        },
        "metadata": {
            "version": 5,
            "contractType": "PHYSICAL_GOOD",
            "format": "FIXED_PRICE",
            "expiry": "2037-12-31T05:00:00.000Z",
            "acceptedCurrencies": [
                "TLTC",
                "TETH"
            ],
            "pricingCurrency": "",
            "language": "",
            "escrowTimeoutHours": 1,
            "coinType": "",
            "coinDivisibility": 0,
            "priceModifier": 0
        },
        "item": {
            "title": "JJ test USD to ETH conversion v2",
            "description": "test",
            "processingTime": "",
            "price": 0,
            "nsfw": false,
            "tags": [
            ],
            "images": [
                {
                    "filename": "Sinestro-14-var-56e3a-620x953.jpg",
                    "original": "QmfKWDCJf9VTDgcDQyFnfoZ5N97mvmYKEWH5cpdX7VRtqx",
                    "large": "QmWJDPdnHT3GaUMyKF2JcJMXNWW2WLaCeFd4UjEdetykUA",
                    "medium": "QmPFfmGg5WK9khrk1hPS6qkUyEuJf9vnxjHfQ6xL7LZf7d",
                    "small": "QmZXJ5iSTQS3VARKyVpmsjjmEx5BySba47VVQR4t8gF8an",
                    "tiny": "Qme9mHH72ADEEY9XSEAmLiEcsQxD9TgyyK9qiZtvov2nVT"
                }
            ],
            "categories": [
            ],
            "grams": 0,
            "condition": "NEW",
            "options": [
                {
                    "name": "upcharge",
                    "description": "",
                    "variants": [
                        {
                            "name": "0"
                        },
                        {
                            "name": "1"
                        },
                        {
                            "name": "2"
                        }
                    ]
                }
            ],
            "skus": [
                {
                    "variantCombo": [
                        0
                    ],
                    "productID": "",
                    "surcharge": 0,
                    "quantity": 0,
                    "bigSurcharge": "0",
                    "bigQuantity": "0"
                },
                {
                    "variantCombo": [
                        1
                    ],
                    "productID": "",
                    "surcharge": 0,
                    "quantity": 0,
                    "bigSurcharge": "1",
                    "bigQuantity": "0"
                },
                {
                    "variantCombo": [
                        2
                    ],
                    "productID": "",
                    "surcharge": 0,
                    "quantity": 0,
                    "bigSurcharge": "2",
                    "bigQuantity": "0"
                }
            ],
            "priceModifier": 0,
            "bigPrice": "1",
            "priceCurrency": {
                "code": "USD",
                "divisibility": 2
            }
        },
        "shippingOptions": [
            {
                "name": "test",
                "type": "FIXED_PRICE",
                "regions": [
                    "ALAND_ISLANDS"
                ],
                "services": [
                    {
                        "name": "0.01 then 0",
                        "price": 0,
                        "estimatedDelivery": "test del time",
                        "additionalItemPrice": 0,
                        "bigPrice": "1",
                        "bigAdditionalItemPrice": "0"
                    },
                    {
                        "name": "0 then 0.01",
                        "price": 0,
                        "estimatedDelivery": "test del time",
                        "additionalItemPrice": 0,
                        "bigPrice": "0",
                        "bigAdditionalItemPrice": "1"
                    }
                ]
            }
        ],
        "coupons": [
            {
                "title": "test",
                "hash": "QmZ5NmGeStdit7tV6gdak1F8FyZhPsfA843YS9f2ywKH6w",
                "percentDiscount": 10,
                "priceDiscount": 0,
                "bigPriceDiscount": ""
            }
        ],
        "moderators": [
            "QmanJzX92hfe6MFD16JouBKRYD4Bit9QF5KRS3Mu2q9E5C"
        ],
        "termsAndConditions": "",
        "refundPolicy": ""
    },
    "hash": "QmUPfjehs2vkuUURPdzi8zVQL4hKBzferRZfyE5zxGNzPu",
    "signature": "61loYVQ0EnaE8nI67UYfkwCxVscFgtj4Fz5W/brORqJJULoTY1BT293HPCZoYsVeh09fHfG8sUn+v3G2C3RdCg=="
}
drwasho commented 4 years ago

So the issue here may be that the purchase order is specifying the incorrect currency, TETH instead of ETH... this is something @jjeffryes you'll have to test fixes the problem.

There is a secondary issue that specifying the incorrect payment coin should fail consistently with a meaniful error.

drwasho commented 4 years ago

As a side note, I've made dozens of TETH purchases without a problem so far.

drwasho commented 4 years ago

@hoffmabc to check out an order in one of his nodes where he saw this.