-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #5 : Convert NBAN to IBAN in importer
- Loading branch information
Showing
7 changed files
with
334 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
# CiviBanking CODA Importer | ||
|
||
CiviBanking CODA importer is an [CiviBanking](https://github.com/Project60/org.project60.banking) extension for importing CODA files. | ||
CiviBanking CODA importer is a [CiviBanking](https://github.com/Project60/org.project60.banking) extension for importing CODA files. | ||
|
||
Development Installation | ||
======================== | ||
|
||
Clone repository into you CiviCRM extensions folder, e.g. like this: | ||
``` | ||
> cd /var/www/drupal/sites/default/files/extensions/ | ||
> git clone https://github.com/Project60/org.project60.banking.git | ||
> cd org.project60.coda | ||
> composer install | ||
1. Install [Little BIC extension](https://github.com/Project60/org.project60.bic) | ||
|
||
2. Clone repository into you CiviCRM extensions folder | ||
> cd /var/www/drupal/sites/default/files/extensions/ | ||
> git clone https://github.com/Project60/org.project60.banking.git | ||
> cd org.project60.coda | ||
|
||
3. Install 3rd party libraries | ||
> composer install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
include_once 'vendor/autoload.php'; | ||
use globalcitizen\php\iban; | ||
|
||
use CRM_Coda_ExtensionUtil as E; | ||
|
||
/** | ||
* BankingAccountReference.Convertnban API specification (optional) | ||
* This is used for documentation and validation. | ||
* | ||
* @param array $spec description of fields supported by this API call | ||
* @return void | ||
* @see http://wiki.civicrm.org/confluence/display/CRMDOC/API+Architecture+Standards | ||
*/ | ||
function _civicrm_api3_banking_account_reference_Convertnban_spec(&$spec) { | ||
$spec['nban']['api.required'] = 1; | ||
$spec['country']['api.required'] = 0; | ||
} | ||
|
||
/** | ||
* BankingAccountReference.Convertnban API | ||
* | ||
* @param array $params | ||
* @return array API result descriptor | ||
* @see civicrm_api3_create_success | ||
* @see civicrm_api3_create_error | ||
* @throws API_Exception | ||
*/ | ||
function civicrm_api3_banking_account_reference_Convertnban($params) { | ||
if (array_key_exists('nban', $params)) { | ||
|
||
if (array_key_exists('country', $params)) { | ||
$country = $params['country']; | ||
} | ||
else { | ||
$country = 'BE'; | ||
} | ||
$iban = $country.'00'.$params['nban']; | ||
$checksum = iban_find_checksum($iban); | ||
|
||
$iban = $country.$checksum.$params['nban']; | ||
|
||
$returnValues = array( | ||
$iban | ||
); | ||
|
||
// Spec: civicrm_api3_create_success($values = 1, $params = array(), $entity = NULL, $action = NULL) | ||
return civicrm_api3_create_success($returnValues, $params, 'NewEntity', 'NewAction'); | ||
} | ||
else { | ||
throw new API_Exception(/*errorMessage*/ 'Everyone knows that the magicword is "sesame"', /*errorCode*/ 1234); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0"?> | ||
<phpunit backupGlobals="false" backupStaticAttributes="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" syntaxCheck="false" bootstrap="tests/phpunit/bootstrap.php"> | ||
<testsuites> | ||
<testsuite name="My Test Suite"> | ||
<directory>./tests/phpunit</directory> | ||
</testsuite> | ||
</testsuites> | ||
<filter> | ||
<whitelist> | ||
<directory suffix=".php">./</directory> | ||
</whitelist> | ||
</filter> | ||
<listeners> | ||
<listener class="Civi\Test\CiviTestListener"> | ||
<arguments/> | ||
</listener> | ||
</listeners> | ||
</phpunit> |
Oops, something went wrong.