VGSCollectFieldNameMappingPolicy

public enum VGSCollectFieldNameMappingPolicy

Defines fieldName mapping to JSON.

  • Map fieldName to JSON without applying any transformations. FieldName is used as single key. Example: card_data.number => JSON

    {
     "card_data.number" : "4111-1111-1111-1111"
    }
    

    Declaration

    Swift

    case flatJSON
  • Map fieldName to nested JSON. Example: card_data.number => nested JSON

    {
        "card_data" :
            {
                "number" : "4111111111111111"
            }
    }
    

    Declaration

    Swift

    case nestedJSON
  • Map field name to nested JSON and array if array index is specified. Example: card_data[1].number => nested JSON with array

    {
        "card_data" :
            [
                null,
    
                { "number" : "4111111111111111" }
            ]
    }
    

    Merge arrays content at the same nested level if possible.

            // Collect fields JSON:
            [
             { "cvc" : "555" }
            ]
    
            // Extra data JSON:
            [
             { "number" : "4111111111111111" }
            ]
    
            // JSON to submit:
            [
             {
                "cvc" : "555",
                "number" : "4111111111111111"
             }
            ]
    

    Declaration

    Swift

    case nestedJSONWithArrayMerge
  • Map field name to nested JSON and array if array index is specified. Example: card_data[1].number => nested JSON with array

    {
        "card_data" :
            [
                null,
    
                { "number" : "4111111111111111" }
            ]
    }
    

    Completely overwrite extra data array with Collect Array data.

            // Collect fields JSON:
            [
             { "cvc" : "555" }
            ]
    
            // Extra data JSON:
            [
             { "number" : "4111111111111111" },
             { "id" : "1111" }
            ]
    
            // JSON to submit:
            [
             {
                "cvc" : "555",
             }
            ]
    

    Declaration

    Swift

    case nestedJSONWithArrayOverwrite