silverstripe-archive / silverstripe-payment

SilverStripe Payment Module
Other
24 stars 43 forks source link

Field mapping system #9

Open jedateach opened 12 years ago

jedateach commented 12 years ago

Payment gatweays use different field names for similar data, and also require different sets of fields.

The payment module will need to provide a universal set of fields, a standardized list, (a schema?) which can be used to reference such fields in a common way.

for example:

$dataobject->FirstName  |   $payment->data['firstname']  |  $gateway['0_FIRSTNAME']

It may be useful to map some fields to the same thing, for example ZipCode and PostCode have essentially the same meaning.

We should try to be exhaustive in providing field mapping options, helping to make sure all future gateways are supported. As further gateways do get added, we might find that the mapping 'schema' needs to be revised.

The related Active Merchant concept is what they call the Options Hash, which differs because there is no enforcing of field names, just a recommendation that they be common.

A draft list of fields:

For each gateway, we can mark which fields are required, and throw an error when they are not required.

jedateach commented 12 years ago

Could think about grouping (namespacing?) some of these fields into: address, credit card.

Active Merchant does this because there are 3 types of address they use: billing_address, shipping_address, address