Skip to content

Commit

Permalink
Can add/delete credit card localy
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Mar 14, 2018
1 parent fe68e8a commit 268b07b
Show file tree
Hide file tree
Showing 7 changed files with 230 additions and 42 deletions.
2 changes: 1 addition & 1 deletion htdocs/core/class/html.form.class.php
Expand Up @@ -4780,7 +4780,7 @@ function load_tva($htmlname='tauxtva', $selectedrate='', $societe_vendeuse='', $
* @param string $addplusone Add a link "+1 hour". Value must be name of another select_date field.
* @param datetime $adddateof Add a link "Date of invoice" using the following date.
* @return string|null Nothing or string if nooutput is 1
* @see form_date
* @see form_date, select_month, select_year, select_dayofweek
*/
function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $nooutput=0, $disabled=0, $fullday='', $addplusone='', $adddateof='')
{
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/translate.class.php
Expand Up @@ -231,7 +231,7 @@ function load($domain,$alt=0,$stopafterdirection=0,$forcelangdir='',$loadfromfil

$filelangexists=is_file($file_lang_osencoded);

dol_syslog(get_class($this).'::Load Try to read for alt='.$alt.' langofdir='.$langofdir.' newdomain='.$domain.' modulename='.$modulename.' file_lang='.$file_lang." => filelangexists=".$filelangexists);
//dol_syslog(get_class($this).'::Load Try to read for alt='.$alt.' langofdir='.$langofdir.' newdomain='.$domain.' modulename='.$modulename.' file_lang='.$file_lang." => filelangexists=".$filelangexists);

if ($filelangexists)
{
Expand Down
4 changes: 4 additions & 0 deletions htdocs/install/mysql/migration/7.0.0-8.0.0.sql
Expand Up @@ -119,6 +119,10 @@ ALTER TABLE llx_societe_rib ADD COLUMN starting_date date;
ALTER TABLE llx_societe_rib ADD COLUMN total_amount_of_all_payments double(24,8);
ALTER TABLE llx_societe_rib ADD COLUMN stripe_card_ref varchar(128);
ALTER TABLE llx_societe_rib ADD COLUMN status integer NOT NULL DEFAULT 1;

UPDATE llx_societe_rib set type = 'ban' where type = '' OR type IS NULL;
-- VMYSQL4.3 ALTER TABLE llx_societe_rib MODIFY COLUMN type varchar(32) NOT NULL;
-- VPGSQL8.2 ALTER TABLE llx_societe_rib ALTER COLUMN type SET NOT NULL;

CREATE TABLE llx_ticketsup
(
Expand Down
2 changes: 1 addition & 1 deletion htdocs/install/mysql/tables/llx_societe_rib.sql
Expand Up @@ -23,7 +23,7 @@
create table llx_societe_rib
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
type varchar(32) DEFAULT 'ban', -- 'ban' or 'paypal' or 'card' or 'stripe'
type varchar(32) DEFAULT 'ban' NOT NULL, -- 'ban' or 'paypal' or 'card' or 'stripe'
label varchar(30),
fk_soc integer NOT NULL,
datec datetime,
Expand Down
8 changes: 7 additions & 1 deletion htdocs/langs/en_US/stripe.lang
Expand Up @@ -52,4 +52,10 @@ StripeChargeList=List of Stripe charges
StripeCustomerId=Stripe customer id
StripePaymentModes=Stripe payment modes
LocalID=Local ID
StripeID=Stripe ID
StripeID=Stripe ID
NameOnCard=Name on card
CardNumber=Card Number
ExpiryDate=Expiry Date
CVN=CVN
DeleteACard=Delete Card record
ConfirmDeleteCard=Are you sure you want to delete this Card record?
47 changes: 35 additions & 12 deletions htdocs/societe/class/companypaymentmode.class.php
Expand Up @@ -78,8 +78,6 @@ class CompanyPaymentMode extends CommonObject
public $fields=array(
'rowid' =>array('type'=>'integer', 'label'=>'Rowid', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>10),
'fk_soc' =>array('type'=>'integer', 'label'=>'Fk soc', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>15),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>20),
'tms' =>array('type'=>'timestamp', 'label'=>'Tms', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>25),
'label' =>array('type'=>'varchar(30)', 'label'=>'Label', 'enabled'=>1, 'visible'=>-2, 'position'=>30),
'bank' =>array('type'=>'varchar(255)', 'label'=>'Bank', 'enabled'=>1, 'visible'=>-2, 'position'=>35),
'code_banque' =>array('type'=>'varchar(128)', 'label'=>'Code banque', 'enabled'=>1, 'visible'=>-2, 'position'=>40),
Expand All @@ -95,7 +93,6 @@ class CompanyPaymentMode extends CommonObject
'rum' =>array('type'=>'varchar(32)', 'label'=>'Rum', 'enabled'=>1, 'visible'=>-2, 'position'=>90),
'date_rum' =>array('type'=>'date', 'label'=>'Date rum', 'enabled'=>1, 'visible'=>-2, 'position'=>95),
'frstrecur' =>array('type'=>'varchar(16)', 'label'=>'Frstrecur', 'enabled'=>1, 'visible'=>-2, 'position'=>100),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'Import key', 'enabled'=>1, 'visible'=>-2, 'position'=>105),
'type' =>array('type'=>'varchar(32)', 'label'=>'Type', 'enabled'=>1, 'visible'=>-2, 'position'=>110),
'last_four' =>array('type'=>'varchar(4)', 'label'=>'Last four', 'enabled'=>1, 'visible'=>-2, 'position'=>115),
'card_type' =>array('type'=>'varchar(255)', 'label'=>'Card type', 'enabled'=>1, 'visible'=>-2, 'position'=>120),
Expand All @@ -112,21 +109,47 @@ class CompanyPaymentMode extends CommonObject
'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>175),
'starting_date' =>array('type'=>'date', 'label'=>'Starting date', 'enabled'=>1, 'visible'=>-2, 'position'=>180),
'ending_date' =>array('type'=>'date', 'label'=>'Ending date', 'enabled'=>1, 'visible'=>-2, 'position'=>185),
//'aaa' =>array('type'=>'date', 'label'=>'Ending date', 'enabled'=>0, 'visible'=>-2, 'position'=>185),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>20),
'tms' =>array('type'=>'timestamp', 'label'=>'Tms', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>25),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'Import key', 'enabled'=>1, 'visible'=>-2, 'position'=>105),
//'aaa' =>array('type'=>'date', 'label'=>'Ending date', 'enabled'=>0, 'visible'=>-2, 'position'=>185),
);
public $rowid;
public $fk_soc;
public $label;
public $amount;
public $description;
public $note_public;
public $note_private;
public $date_creation;
public $bank;
public $code_banque;
public $code_guichet;
public $number;
public $cle_rib;
public $bic;
public $iban_prefix;
public $domiciliation;
public $proprio;
public $owner_address;
public $default_rib;
public $rum;
public $date_rum;
public $frstrecur;
public $type;
public $last_four;
public $card_type;
public $cvn;
public $exp_date_month;
public $exp_date_year;
public $country_code;
public $approved;
public $email;
public $max_total_amount_of_all_payments;
public $preapproval_key;
public $total_amount_of_all_payments;
public $stripe_card_ref;
public $status;
public $starting_date;
public $ending_date;
public $datec;
public $tms;
public $fk_user_creat;
public $fk_user_modif;
public $import_key;
public $status;
// END MODULEBUILDER PROPERTIES


Expand Down

1 comment on commit 268b07b

@ptibogxiv
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eldy /societe/paymentmodes.php?socid=1&action=createcard
this form isn't compliant with strict security rules of stripe & bank. Sources should always be create customer/client side with JS not API. CARD/SOURCE complete number must never be saved in standard data/base without AES6256 encryption https://stripe.com/docs/security (this isn't the basic dolibarr's integration for small company or foundation on basic web server) this option should be only for developper on strict secure installation. And it's no RGPD compliant too....
->use stripe.js form with element and just save not unsecure data as complete number card in dolibar database

Please sign in to comment.