Umbraco.Commerce.Issues icon indicating copy to clipboard operation
Umbraco.Commerce.Issues copied to clipboard

Payment Providers: Order Property Mapping

Open NikRimington opened this issue 5 years ago • 4 comments

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:

  1. A setting property type of OrderPropertyMap : CollectionOfSomeSort<OrderPropertyMapItem>, where OrderPropertyMapItem has 3 fields:

Key read only, must be unique, Optional read 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

  1. 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).

NikRimington avatar Jul 18 '20 23:07 NikRimington

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?

mattbrailsford avatar Jul 19 '20 07:07 mattbrailsford

Oh, you mean like billing address fields. Yea, good point 👍🏻

mattbrailsford avatar Jul 19 '20 08:07 mattbrailsford

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!

NikRimington avatar Jul 20 '20 07:07 NikRimington

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.

seanrockster avatar Jul 20 '20 09:07 seanrockster