Currently, we are developing a WSO2 ESB connetor for PPal REST API. "Store Credit Card" API call in PPal is having four required parameters and five optional parameters as shown in the below link.
https://developer.p--pal.com/webapps/developer/docs/api/#store-a-credit-card Corresponding message payloadfactory for the aforementioned method was created as below. <payloadfactory> <format> { "number":"$1", "type":"$2", "expire_month":"$3", "expire_year":"$4", "payer_id":"$5", "cvv2":"$6", "first_name":"$7", "last_name":"$8", "billing_address":$9 } </format> <args> </args> </payloadfactory> Problem with this approach is that, when an optional parameters is not passed, API gives a validation error saying "value is missing". The reason for this is that, even though the value is empty, the attribute is still there in the payload. Therefore the corresponding attribute/value pair should be omitted from the payload when an optional parameter is not passed. This can be achieved by using filters to check the whether the optional parameters are empty and creating the payloads accordingly. But when the number of optional parameters increases, it becomes difficult to track each and every combination of payload. Is there a workaround for this issue?
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
