ghidinelli / cfpayment

ColdFusion payment processing library makes plumbing e-commerce apps easy. Charging credit cards has never been easier. Inspired by Ruby's ActiveMerchant.
Other
90 stars 54 forks source link

Hardcoded path to gateway subdirectory makes extending gateways impossible #35

Closed ghidinelli closed 5 years ago

ghidinelli commented 6 years ago

The current gateway instantiation looks like:

<cfset variables.instance.gateway = createObject("component", "gateway.#lCase(variables.instance.config.path)#").init(config = variables.instance.config, service = this) />

There are circumstances where you want to extend a gateway to override a particular method, like perhaps for error messages or custom response additions, etc. We have a working build with this instead:

<cfset variables.instance.gateway = createObject("component", variables.instance.config.path).init(config = variables.instance.config, service = this) />

That allows configuration like (coldspring example):

`

stripe.stripe gateway.stripe.stripe ${STRIPE_LIVE_SECRET_KEY} ${STRIPE_LIVE_PUB_KEY} ${STRIPE_TEST_SECRET_KEY} ${STRIPE_TEST_PUB_KEY} 2 true
</bean>`

But gateway.stripe.stripe could also be model.payment.customstripe which defines an alternative response.