Payment Providers: Order Property Mapping
Hi Matt,
Looking at existing payment providers, it appears that there is a common trend for having to map order properties to payment properties in order to pass them across to a payment providers end point (in what ever way it's needed).
It would be great if there was a simple to use pattern for doing this rather than having to map each one as individual payment provider settings.
My thoughts sit 2 fold with ideas:
- A setting property type of
OrderPropertyMap : CollectionOfSomeSort<OrderPropertyMapItem>, where OrderPropertyMapItem has 3 fields:
Keyread only, must be unique,Optionalread only, true/false, (indicates if required by the payment provider or optional)Value, if Optional = false then this must be populated This could then have a pre-defined view. and saves creators of Payment Providers having to roll their own version/view to handle this
- A mapping json file - probably the simplest as a template one can be included in the payment provider nuget/umbraco package. However it would most likely required file access to modify it rather than being editable in the back office. This is generally okay though I'd have thought as when you get to this point you'd probably be a dev?
Just ideas (I like both options, and 2 could be nice if infinte editing could be used to load out an editor for it, but would be harder to validate probably).
Hey @NikRimington im not sure I understand. Can you show a code example of what you currently have to do and may a pseudo code example of the proposed ideas?
Oh, you mean like billing address fields. Yea, good point 👍🏻
Hey @mattbrailsford , yeah I mean things like billing fields etc. Working on a SagePay Provider there is a lot of mapping that needs to be done for order properties:
- Billing details (surname, forename, address 1, 2 , city. ....)
- Delivery details (surname, forename, address 1, 2 , city. ....)
Some of which are manditory, some of which are optional, and some of which are manditory based on other things (I have no idea how I'm going to do this effectively tbh). For example State is mandatory is the country is the US!
What we do with SagePay is, for uk addresses, use the county, e.g. Greater Manchester for the State. For USA addresses it is the actual state, e.g. california, etc.