pact-foundation / pact-jvm

JVM version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.
https://docs.pact.io
Apache License 2.0
1.08k stars 479 forks source link

BodyMismatch: $.data.user.wallet.cards.2 BodyMismatch: Expected a Map with at least 10 elements but received 6 elements #1207

Open stephenwang1011 opened 4 years ago

stephenwang1011 commented 4 years ago

Hi, I met this issue, and confused me too long. JAVA:8 Broker: latest docker image au.com.dius.pact.provider:gradle:4.1.0 au.com.dius:pact-jvm-consumer-junit:4.0.10 au.com.dius:pact-jvm-consumer-java8:4.0.10 Here is my code:

@RunWith(SpringRunner.class)
@SpringBootTest
public class GetDemo_GetMobileMeAPITest extends ConsumerPactTest {

    @Override
    @Pact(provider = "NeuronPublic", consumer = "GetMobileMeInfo")
    protected RequestResponsePact createPact(PactDslWithProvider builder) {
        Map<String, String> responseHeaders = new HashMap<String, String>();
        responseHeaders.put("Content-Type", "application/json;charset=UTF-8");

        DslPart responseBody = new PactDslJsonBody()
            .object("data")
            /*****************第1个User对象 start*****************/
            .object("user")
                .id("id")
                .stringType("username")
                .stringType("mobile")
                .stringType("roleCode")
                .stringType("email")
                .stringType("fullName")
                .stringType("status")
                .stringType("countryCode")
                .stringType("city")
                .stringType("avatar")
                .booleanType("emailMarketing")
                .booleanType("notificationMarketing")
                .booleanType("smsMarketing")
                .booleanType("vip")
                .numberType("createdAt")
                .booleanType("disabled")
                .numberType("tripCount")
                .stringType("stripePublicKey")
                .booleanType("emailVerified")
                .booleanType("subscribed")
                .booleanType("notificationSubscribed")
                .object("wallet")
                    .id("id")
                    .numberType("balance")
                    .numberType("couponBalance")
                    .numberType("createdAt")
                    .numberType("updatedAt")
                    .minArrayLike("cards",1,1)
                            .stringType("id")
                            .stringType("customer")
                            .stringType("brand")
                            .stringType("funding")
                            .stringType("last4")
                            .numberType("expMonth")
                            .numberType("expYear")
                            .booleanType("primary")
                            .stringType("platform")
                            .stringType("account")
                        .closeObject()
                    .closeArray()
                    .minArrayLike("coupons",1,1)
                        .id()
                        .numberType("userId")
                        .decimalType("balance")
                        .stringType("status")
                        .numberType("expiredAt")
                        .numberType("createdAt")
                        .numberType("createdBy")
                        .stringType("scope")
                        .stringType("source")
                        .stringType("name")
                        .object("promoCode")
                            .id()
                            .stringType("name")
                            .decimalType("value")
                            .numberType("validTime")
                            .stringType("scope")
                        .closeObject()
                      .closeObject()
                    .closeArray()
                .closeObject()
                .minArrayLike("platforms",1,1)
                        .id("id")
                        .stringType("customerId")
                        .stringType("country")
                        .numberType("createdAt")
                        .stringType("platform")
                        .stringType("account")
                        .booleanType("primary")
                    .closeObject()
                .closeArray()
            .closeObject()

            .object("version")
                .id("id")
                .stringType("platform")
                .stringType("versionName")
                .numberType("versionCode")
                .stringType("updateLog")
                .booleanType("forceUpdate")
                .numberType("createdAt")
            .closeObject()

            .object("referCode")
            .stringType("referCode")
            .object("senderPromoCode")
            .stringValue("type", "REFER_SENDER")
            .decimalType("value")
            .closeObject()
            .object("receiverPromoCode")
            .stringValue("type", "REFER_RECEIVER")
            .decimalType("value")
            .closeObject()
            .closeObject()

            .object("mobileConfig")
            .numberType("convenienceFee")
            .closeObject()
            .closeObject();

        RequestResponsePact pact = ConsumerPactBuilder
            .consumer("GetMobileMeInfo")
            .hasPactWith("NeuronPublic")
            .given("")
            .uponReceiving("Get mobile me api info")
            .path("/api/mobile/me")
            .query("platform=android")
            .method("GET")
            .willRespondWith()
            .headers(responseHeaders)
            .status(200)
            .body(responseBody)
            .toPact();

        return pact;
    }

    @Override
    protected String providerName() {
        return "NeuronPublic";
    }

    @Override
    protected String consumerName() {
        return "GetMobileMeInfo";
    }

    @Override
    protected void runTest(MockServer mockServer, PactTestExecutionContext context) throws IOException {

        try{
            new ConsumerClient(mockServer.getUrl()).getAsMap("/api/mobile/me","platform=android");

        } catch (Exception e){

            throw new RuntimeException(e);

        }

    }
}

When I run the test, it will produce the below pact files:

{
  "provider": {
    "name": "NeuronPublic"
  },
  "consumer": {
    "name": "GetMobileMeInfo"
  },
  "interactions": [
    {
      "description": "Get mobile me api info",
      "request": {
        "method": "GET",
        "path": "/api/mobile/me",
        "query": {
          "platform": [
            "android"
          ]
        }
      },
      "response": {
        "status": 200,
        "headers": {
          "Content-Type": "application/json;charset=UTF-8"
        },
        "body": {
          "data": {
            "mobileConfig": {
              "convenienceFee": 100
            },
            "referCode": {
              "referCode": "string",
              "senderPromoCode": {
                "type": "REFER_SENDER",
                "value": 100
              },
              "receiverPromoCode": {
                "type": "REFER_RECEIVER",
                "value": 100
              }
            },
            "user": {
              "wallet": {
                "couponBalance": 100,
                "createdAt": 100,
                "cards": [
                  {
                    "last4": "string",
                    "expMonth": 100,
                    "funding": "string",
                    "expYear": 100,
                    "id": "string",
                    "brand": "string",
                    "platform": "string",
                    "account": "string",
                    "customer": "string",
                    "primary": true
                  }
                ],
                "balance": 100,
                "coupons": [
                  {
                    "expiredAt": 100,
                    "createdAt": 100,
                    "balance": 100,
                    "createdBy": 100,
                    "scope": "string",
                    "name": "string",
                    "promoCode": {
                      "scope": "string",
                      "name": "string",
                      "validTime": 100,
                      "id": 1234567890,
                      "value": 100
                    },
                    "id": 1234567890,
                    "source": "string",
                    "userId": 100,
                    "status": "string"
                  }
                ],
                "id": 1234567890,
                "updatedAt": 100
              },
              "city": "string",
              "emailMarketing": true,
              "mobile": "string",
              "notificationMarketing": true,
              "fullName": "string",
              "avatar": "string",
              "platforms": [
                {
                  "country": "string",
                  "createdAt": 100,
                  "customerId": "string",
                  "id": 1234567890,
                  "platform": "string",
                  "account": "string",
                  "primary": true
                }
              ],
              "createdAt": 100,
              "emailVerified": true,
              "subscribed": true,
              "tripCount": 100,
              "stripePublicKey": "string",
              "countryCode": "string",
              "roleCode": "string",
              "smsMarketing": true,
              "disabled": true,
              "id": 1234567890,
              "notificationSubscribed": true,
              "vip": true,
              "email": "string",
              "username": "string",
              "status": "string"
            },
            "version": {
              "createdAt": 100,
              "updateLog": "string",
              "id": 1234567890,
              "forceUpdate": true,
              "versionName": "string",
              "platform": "string",
              "versionCode": 100
            }
          }
        },
        "matchingRules": {
          "body": {
            "$.data.user.id": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.username": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.mobile": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.roleCode": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.email": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.fullName": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.status": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.countryCode": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.city": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.avatar": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.emailMarketing": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.notificationMarketing": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.smsMarketing": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.vip": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.createdAt": {
              "matchers": [
                {
                  "match": "number"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.disabled": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.tripCount": {
              "matchers": [
                {
                  "match": "number"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.stripePublicKey": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.emailVerified": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.subscribed": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.notificationSubscribed": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.id": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.balance": {
              "matchers": [
                {
                  "match": "number"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.couponBalance": {
              "matchers": [
                {
                  "match": "number"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.createdAt": {
              "matchers": [
                {
                  "match": "number"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.updatedAt": {
              "matchers": [
                {
                  "match": "number"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.cards": {
              "matchers": [
                {
                  "match": "type",
                  "min": 1
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.cards[*].id": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.cards[*].customer": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.cards[*].brand": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.cards[*].funding": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.cards[*].last4": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.cards[*].expMonth": {
              "matchers": [
                {
                  "match": "number"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.cards[*].expYear": {
              "matchers": [
                {
                  "match": "number"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.cards[*].primary": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.cards[*].platform": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.cards[*].account": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.coupons": {
              "matchers": [
                {
                  "match": "type",
                  "min": 1
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.coupons[*].id": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.coupons[*].userId": {
              "matchers": [
                {
                  "match": "number"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.coupons[*].balance": {
              "matchers": [
                {
                  "match": "decimal"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.coupons[*].status": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.coupons[*].expiredAt": {
              "matchers": [
                {
                  "match": "number"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.coupons[*].createdAt": {
              "matchers": [
                {
                  "match": "number"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.coupons[*].createdBy": {
              "matchers": [
                {
                  "match": "number"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.coupons[*].scope": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.coupons[*].source": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.coupons[*].name": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.coupons[*].promoCode.id": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.coupons[*].promoCode.name": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.coupons[*].promoCode.value": {
              "matchers": [
                {
                  "match": "decimal"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.coupons[*].promoCode.validTime": {
              "matchers": [
                {
                  "match": "number"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.wallet.coupons[*].promoCode.scope": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.platforms": {
              "matchers": [
                {
                  "match": "type",
                  "min": 1
                }
              ],
              "combine": "AND"
            },
            "$.data.user.platforms[*].id": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.platforms[*].customerId": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.platforms[*].country": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.platforms[*].createdAt": {
              "matchers": [
                {
                  "match": "number"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.platforms[*].platform": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.platforms[*].account": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.user.platforms[*].primary": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.version.id": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.version.platform": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.version.versionName": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.version.versionCode": {
              "matchers": [
                {
                  "match": "number"
                }
              ],
              "combine": "AND"
            },
            "$.data.version.updateLog": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.version.forceUpdate": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.version.createdAt": {
              "matchers": [
                {
                  "match": "number"
                }
              ],
              "combine": "AND"
            },
            "$.data.referCode.referCode": {
              "matchers": [
                {
                  "match": "type"
                }
              ],
              "combine": "AND"
            },
            "$.data.referCode.senderPromoCode.value": {
              "matchers": [
                {
                  "match": "decimal"
                }
              ],
              "combine": "AND"
            },
            "$.data.referCode.receiverPromoCode.value": {
              "matchers": [
                {
                  "match": "decimal"
                }
              ],
              "combine": "AND"
            },
            "$.data.mobileConfig.convenienceFee": {
              "matchers": [
                {
                  "match": "number"
                }
              ],
              "combine": "AND"
            }
          }
        },
        "generators": {
          "body": {
            "$.data.user.id": {
              "type": "RandomInt",
              "min": 0,
              "max": 2147483647
            },
            "$.data.user.username": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.user.mobile": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.user.roleCode": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.user.email": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.user.fullName": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.user.status": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.user.countryCode": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.user.city": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.user.avatar": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.user.createdAt": {
              "type": "RandomInt",
              "min": 0,
              "max": 2147483647
            },
            "$.data.user.tripCount": {
              "type": "RandomInt",
              "min": 0,
              "max": 2147483647
            },
            "$.data.user.stripePublicKey": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.user.wallet.id": {
              "type": "RandomInt",
              "min": 0,
              "max": 2147483647
            },
            "$.data.user.wallet.balance": {
              "type": "RandomInt",
              "min": 0,
              "max": 2147483647
            },
            "$.data.user.wallet.couponBalance": {
              "type": "RandomInt",
              "min": 0,
              "max": 2147483647
            },
            "$.data.user.wallet.createdAt": {
              "type": "RandomInt",
              "min": 0,
              "max": 2147483647
            },
            "$.data.user.wallet.updatedAt": {
              "type": "RandomInt",
              "min": 0,
              "max": 2147483647
            },
            "$.data.user.wallet.cards[*].id": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.user.wallet.cards[*].customer": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.user.wallet.cards[*].brand": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.user.wallet.cards[*].funding": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.user.wallet.cards[*].last4": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.user.wallet.cards[*].expMonth": {
              "type": "RandomInt",
              "min": 0,
              "max": 2147483647
            },
            "$.data.user.wallet.cards[*].expYear": {
              "type": "RandomInt",
              "min": 0,
              "max": 2147483647
            },
            "$.data.user.wallet.cards[*].platform": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.user.wallet.cards[*].account": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.user.wallet.coupons[*].id": {
              "type": "RandomInt",
              "min": 0,
              "max": 2147483647
            },
            "$.data.user.wallet.coupons[*].userId": {
              "type": "RandomInt",
              "min": 0,
              "max": 2147483647
            },
            "$.data.user.wallet.coupons[*].balance": {
              "type": "RandomDecimal",
              "digits": 10
            },
            "$.data.user.wallet.coupons[*].status": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.user.wallet.coupons[*].expiredAt": {
              "type": "RandomInt",
              "min": 0,
              "max": 2147483647
            },
            "$.data.user.wallet.coupons[*].createdAt": {
              "type": "RandomInt",
              "min": 0,
              "max": 2147483647
            },
            "$.data.user.wallet.coupons[*].createdBy": {
              "type": "RandomInt",
              "min": 0,
              "max": 2147483647
            },
            "$.data.user.wallet.coupons[*].scope": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.user.wallet.coupons[*].source": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.user.wallet.coupons[*].name": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.user.wallet.coupons[*].promoCode.id": {
              "type": "RandomInt",
              "min": 0,
              "max": 2147483647
            },
            "$.data.user.wallet.coupons[*].promoCode.name": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.user.wallet.coupons[*].promoCode.value": {
              "type": "RandomDecimal",
              "digits": 10
            },
            "$.data.user.wallet.coupons[*].promoCode.validTime": {
              "type": "RandomInt",
              "min": 0,
              "max": 2147483647
            },
            "$.data.user.wallet.coupons[*].promoCode.scope": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.user.platforms[*].id": {
              "type": "RandomInt",
              "min": 0,
              "max": 2147483647
            },
            "$.data.user.platforms[*].customerId": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.user.platforms[*].country": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.user.platforms[*].createdAt": {
              "type": "RandomInt",
              "min": 0,
              "max": 2147483647
            },
            "$.data.user.platforms[*].platform": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.user.platforms[*].account": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.version.id": {
              "type": "RandomInt",
              "min": 0,
              "max": 2147483647
            },
            "$.data.version.platform": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.version.versionName": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.version.versionCode": {
              "type": "RandomInt",
              "min": 0,
              "max": 2147483647
            },
            "$.data.version.updateLog": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.version.createdAt": {
              "type": "RandomInt",
              "min": 0,
              "max": 2147483647
            },
            "$.data.referCode.referCode": {
              "type": "RandomString",
              "size": 20
            },
            "$.data.referCode.senderPromoCode.value": {
              "type": "RandomDecimal",
              "digits": 10
            },
            "$.data.referCode.receiverPromoCode.value": {
              "type": "RandomDecimal",
              "digits": 10
            },
            "$.data.mobileConfig.convenienceFee": {
              "type": "RandomInt",
              "min": 0,
              "max": 2147483647
            }
          }
        }
      },
      "providerStates": [
        {
          "name": ""
        }
      ]
    }
  ],
  "metadata": {
    "pactSpecification": {
      "version": "3.0.0"
    },
    "pact-jvm": {
      "version": "4.0.10"
    }
  }
}

Then I published this pact file to the pact broker and run the verify test on the provider by using the command: ./gradlew verifyPact The error was shown:

Failures:

1) Verifying a pact between GetMobileMeInfo and NeuronPublic - Get mobile me api info Given 

    1.1) BodyMismatch: $.data.user.wallet.cards.2 BodyMismatch: Expected a Map with at least 10 elements but received 6 elements

        {
        -  "last4": "8y4WfGcGB1tMHTxmCIhi",
        -  "expMonth": 357261960,
        -  "funding": "xPwHPm8eAnaGYHGUOxR7",
        -  "expYear": 1000350898,
        -  "id": "in6Ec9azNZ4juRIPXzBB",
        -  "brand": "RCohr3dE7uECBUsF6jHS",
        -  "platform": "bbkJjh77nERs7T9wSpiv",
        -  "account": "lqn8zLNk7SRxCY8QjVwB",
        -  "customer": "ZQdeOUYilmTahfXyEeIC",
        -  "primary": true
        +  "id": "119355113",
        +  "expMonth": 0,
        +  "expYear": 0,
        +  "primary": true,
        +  "platform": "PAYPAL",
        +  "account": "AU"
        }

    1.2) BodyMismatch: $.data.user.wallet.cards.2 BodyMismatch: Expected last4='8y4WfGcGB1tMHTxmCIhi' but was missing

        {
        -  "last4": "8y4WfGcGB1tMHTxmCIhi",
        -  "expMonth": 357261960,
        -  "funding": "xPwHPm8eAnaGYHGUOxR7",
        -  "expYear": 1000350898,
        -  "id": "in6Ec9azNZ4juRIPXzBB",
        -  "brand": "RCohr3dE7uECBUsF6jHS",
        -  "platform": "bbkJjh77nERs7T9wSpiv",
        -  "account": "lqn8zLNk7SRxCY8QjVwB",
        -  "customer": "ZQdeOUYilmTahfXyEeIC",
        -  "primary": true
        +  "id": "119355113",
        +  "expMonth": 0,
        +  "expYear": 0,
        +  "primary": true,
        +  "platform": "PAYPAL",
        +  "account": "AU"
        }

    1.3) BodyMismatch: $.data.user.wallet.cards.2 BodyMismatch: Expected funding='xPwHPm8eAnaGYHGUOxR7' but was missing

        {
        -  "last4": "8y4WfGcGB1tMHTxmCIhi",
        -  "expMonth": 357261960,
        -  "funding": "xPwHPm8eAnaGYHGUOxR7",
        -  "expYear": 1000350898,
        -  "id": "in6Ec9azNZ4juRIPXzBB",
        -  "brand": "RCohr3dE7uECBUsF6jHS",
        -  "platform": "bbkJjh77nERs7T9wSpiv",
        -  "account": "lqn8zLNk7SRxCY8QjVwB",
        -  "customer": "ZQdeOUYilmTahfXyEeIC",
        -  "primary": true
        +  "id": "119355113",
        +  "expMonth": 0,
        +  "expYear": 0,
        +  "primary": true,
        +  "platform": "PAYPAL",
        +  "account": "AU"
        }

    1.4) BodyMismatch: $.data.user.wallet.cards.2 BodyMismatch: Expected brand='RCohr3dE7uECBUsF6jHS' but was missing

        {
        -  "last4": "8y4WfGcGB1tMHTxmCIhi",
        -  "expMonth": 357261960,
        -  "funding": "xPwHPm8eAnaGYHGUOxR7",
        -  "expYear": 1000350898,
        -  "id": "in6Ec9azNZ4juRIPXzBB",
        -  "brand": "RCohr3dE7uECBUsF6jHS",
        -  "platform": "bbkJjh77nERs7T9wSpiv",
        -  "account": "lqn8zLNk7SRxCY8QjVwB",
        -  "customer": "ZQdeOUYilmTahfXyEeIC",
        -  "primary": true
        +  "id": "119355113",
        +  "expMonth": 0,
        +  "expYear": 0,
        +  "primary": true,
        +  "platform": "PAYPAL",
        +  "account": "AU"
        }

    1.5) BodyMismatch: $.data.user.wallet.cards.2 BodyMismatch: Expected customer='ZQdeOUYilmTahfXyEeIC' but was missing

        {
        -  "last4": "8y4WfGcGB1tMHTxmCIhi",
        -  "expMonth": 357261960,
        -  "funding": "xPwHPm8eAnaGYHGUOxR7",
        -  "expYear": 1000350898,
        -  "id": "in6Ec9azNZ4juRIPXzBB",
        -  "brand": "RCohr3dE7uECBUsF6jHS",
        -  "platform": "bbkJjh77nERs7T9wSpiv",
        -  "account": "lqn8zLNk7SRxCY8QjVwB",
        -  "customer": "ZQdeOUYilmTahfXyEeIC",
        -  "primary": true
        +  "id": "119355113",
        +  "expMonth": 0,
        +  "expYear": 0,
        +  "primary": true,
        +  "platform": "PAYPAL",
        +  "account": "AU"
        }

And here is my API real response:

{
    "data": {
        "user": {
            "id": 42404,
            "username": "8618672701969",
            "mobile": "18672701969",
            "roleCode": "ADMIN",
            "email": "apitest@neuron.sg",
            "fullName": "Young Wang",
            "status": "REGISTERED",
            "wallet": {
                "id": 27,
                "balance": 11.0,
                "couponBalance": 21.0,
                "createdAt": 1567650614000,
                "updatedAt": 1599642570000,
                "cards": [
                    {
                        "id": "card_1HPPJyKtdcKEU6mhIelxXdxP",
                        "customer": "cus_FeOU5TrbPWh0sy",
                        "brand": "MasterCard",
                        "funding": "credit",
                        "last4": "4444",
                        "expMonth": 12,
                        "expYear": 2023,
                        "primary": true,
                        "platform": "STRIPE",
                        "account": "SG"
                    },
                    {
                        "id": "card_1F96GNKtdcKEU6mhZZedaJwE",
                        "customer": "cus_FeOU5TrbPWh0sy",
                        "brand": "Visa",
                        "funding": "credit",
                        "last4": "3063",
                        "expMonth": 12,
                        "expYear": 2025,
                        "primary": false,
                        "platform": "STRIPE",
                        "account": "SG"
                    }
                ],
                "coupons": [
                    {
                        "id": 22192,
                        "userId": 42404,
                        "balance": 10.0,
                        "status": "VALID",
                        "expiredAt": 1685714400000,
                        "createdAt": 1599378816000,
                        "createdBy": 1,
                        "scope": "TRIP",
                        "source": "DASHBOARD",
                        "promoCode": {
                            "id": 0,
                            "name": "Special Offer",
                            "value": 10.0,
                            "validTime": 0,
                            "scope": "TRIP"
                        },
                        "name": "Special Offer"
                    }
                ]
            },
            "countryCode": "86",
            "city": "BNE",
            "avatar": "",
            "emailMarketing": true,
            "notificationMarketing": true,
            "smsMarketing": true,
            "vip": false,
            "createdAt": 1567061654000,
            "disabled": false,
            "tripCount": 1138,
            "stripePublicKey": "pk_test_DZ8VHmJ56OQpYed8Mcj3AowC",
            "platforms": [
                {
                    "id": 579,
                    "customerId": "cus_FeOU5TrbPWh0sy",
                    "country": "SG",
                    "createdAt": 1566201265000,
                    "platform": "STRIPE",
                    "account": "SG",
                    "primary": true
                },
                {
                    "id": 619,
                    "customerId": "119355113",
                    "country": "AU",
                    "createdAt": 1567754740000,
                    "platform": "PAYPAL",
                    "account": "AU",
                    "primary": false
                }
            ],
            "emailVerified": false,
            "subscribed": true,
            "notificationSubscribed": true
        },
        "version": {
            "id": 1,
            "platform": "ANDROID",
            "versionName": "4.9.0",
            "versionCode": 107,
            "updateLog": "test",
            "forceUpdate": false,
            "createdAt": 1589874919000
        },
        "referCode": {
            "referCode": "78MN83P1",
            "senderPromoCode": {
                "type": "REFER_SENDER",
                "value": 5.0
            },
            "receiverPromoCode": {
                "type": "REFER_RECEIVER",
                "value": 5.0
            }
        },
        "mobileConfig": {
            "convenienceFee": 0
        }
    }
}
stephenwang1011 commented 4 years ago

Really need your help @mefellows thank you

stephenwang1011 commented 4 years ago

Actually, When I totally deleted the pact files from the database, then re-run the verification, it worked well and no error happened again! So interesting!

uglyog commented 4 years ago

So, is this not an issue anymore?