Skip to content

Commit bedb96d

Browse files
Add mercanet processor
1 parent da470b6 commit bedb96d

File tree

3 files changed

+76
-3
lines changed

3 files changed

+76
-3
lines changed

CRM/Core/Payment/OmnipayMultiProcessor.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,8 +468,7 @@ public function doTransferCheckout(&$params, $component = 'contribute') {
468468
* @throws CiviCRM_API3_Exception
469469
*/
470470
public function getPaymentFormFields() {
471-
if ($this->_paymentProcessor['billing_mode'] == 4) {
472-
$this->isTransparentRedirect();
471+
if ($this->_paymentProcessor['billing_mode'] == 4 || $this->isTransparentRedirect()) {
473472
return array();
474473
}
475474
return $this->_paymentProcessor['payment_type'] == 1 ? $this->getCreditCardFormFields() : $this->getDirectDebitFormFields();

composer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
{
2424
"type": "git",
2525
"url": "https://github.com/eileenmcnaughton/omnipay-authorizenet.git"
26+
},
27+
{
28+
"type": "git",
29+
"url": "https://github.com/eileenmcnaughton/omnipay-mercanet.git"
2630
}
2731
],
2832
"require":
@@ -37,7 +41,8 @@
3741
"pointybeard/omnipay-nabtransact": "dev-transact",
3842
"fzaninotto/faker": "^1.6@dev",
3943
"omnipay/paymentexpress": "dev-master",
40-
"omnipay/authorizenet": "dev-master"
44+
"omnipay/authorizenet": "dev-master",
45+
"fuzion/omnipay-mercanet": "dev-master"
4146
},
4247
"require-dev":
4348
{

omnipay_Mercanet_Offsite.mgd.php

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: eileen
5+
* Date: 17/06/2014
6+
* Time: 10:14 PM
7+
*
8+
* To add a new processor you need to add an item to this array. It is sequentially numerically indexed and the important aspects are
9+
*
10+
* - name - omnipay_{Processor_Name}, Omnipay calls the gateway method create with the processor name as the parameter.
11+
* To get the processor name take a look at the Readme for the gateway you are adding - you will generally see
12+
* The following gateways are provided by this package: Mollie so the name should be ominpay_Mollie (note matching capitalisation)
13+
*
14+
* A more complex example is omnipay_SecurePay_DirectPayment.
15+
* This breaks down as
16+
* - omnipay_ - our label within CiviCRM to denote Omnipay
17+
* - SecurePay - the namespace as declared within the composer.json within the securepay gateway
18+
* - DirectPost - the prefix on the Gateway file. It is called DirectPostGateway.php - this portion is excluded when the file is simply
19+
* named 'Gateway.php'
20+
*
21+
* - user_name_label, password_label, signature_label, subject_label - these are generally about telling the plugin what to call these when they pass them to
22+
* Omnipay. They are also shown to users so some reformatting is done to turn it into lower-first-letter camel case. Take a look at the gateway file for your gateway. This is directly under src.
23+
* Some provide more than one and the 'getName' function distinguishes them. The getDefaultParameters will tell you what to pass. eg if you see
24+
* 'apiKey' you should enter 'user_name' => 'Api Key' (you might ? be able to get away with 'API Key' - need to check). You can provide as many or as
25+
* few as you want of these and it's irrelevant which field you put them in but note that the signature field is the longest and that
26+
* in future versions of CiviCRM hashing may be done on password and signature on the screen.
27+
*
28+
* - 'class_name' => 'Payment_OmnipayMultiProcessor', (always)
29+
*
30+
* - 'url_site_default' - this is ignored. But, by giving one you make it easier for people adding processors
31+
*
32+
* - 'billing_mode' - 1 = onsite, 4 = redirect offsite (including transparent redirects).
33+
*
34+
* - payment_mode - 1 = credit card, 2 = debit card, 3 = transparent redirect. In practice 3 means that billing details are gathered on-site so
35+
* it may also be used with automatic redirects where address fields need to be mandatory for the signature.
36+
*
37+
* The record will be automatically inserted, updated, or deleted from the
38+
* database as appropriate. For more details, see "hook_civicrm_managed" at:
39+
* http://wiki.civicrm.org/confluence/display/CRMDOC/Hook+Reference
40+
*/
41+
return array(
42+
array(
43+
'name' => 'OmniPay - Mercanet',
44+
'entity' => 'payment_processor_type',
45+
'params' =>
46+
array(
47+
'version' => 3,
48+
'title' => 'OmniPay - Mercanet Offsite',
49+
'name' => 'omnipay_Mercanet_Offsite',
50+
'description' => 'Omnipay Mercanet Payment Processor',
51+
'user_name_label' => 'Merchant ID',
52+
'password_label' => 'Secret Key',
53+
'signature_label' => '',
54+
'site_url' => '',
55+
'class_name' => 'Payment_OmnipayMultiProcessor',
56+
'billing_mode' => 1,
57+
'payment_type' => 3,
58+
),
59+
'metadata' => array(
60+
'transparent_redirect' => array(
61+
'fields' => array(
62+
// place holder for more work on adding fields to transparent_redirect payment form.
63+
// leave empty for only hidden fields.
64+
),
65+
'billing_fields' => array(),
66+
),
67+
),
68+
),
69+
);

0 commit comments

Comments
 (0)