diff --git a/htdocs/societe/class/companypaymentmode.class.php b/htdocs/societe/class/companypaymentmode.class.php index 6af7f359ec1..2397e00899e 100644 --- a/htdocs/societe/class/companypaymentmode.class.php +++ b/htdocs/societe/class/companypaymentmode.class.php @@ -114,8 +114,9 @@ class CompanyPaymentMode extends CommonObject 'max_total_amount_of_all_payments' =>array('type'=>'double(24,8)', 'label'=>'Max total amount of all payments', 'enabled'=>1, 'visible'=>-2, 'position'=>155), 'preapproval_key' =>array('type'=>'varchar(255)', 'label'=>'Preapproval key', 'enabled'=>1, 'visible'=>-2, 'position'=>160), 'total_amount_of_all_payments' =>array('type'=>'double(24,8)', 'label'=>'Total amount of all payments', 'enabled'=>1, 'visible'=>-2, 'position'=>165), - 'stripe_card_ref' =>array('type'=>'varchar(128)', 'label'=>'Stripe card ref', 'enabled'=>1, 'visible'=>-2, 'position'=>170), - 'stripe_account' =>array('type'=>'varchar(128)', 'label'=>'Stripe account', 'enabled'=>1, 'visible'=>-2, 'position'=>171), + 'stripe_card_ref' =>array('type'=>'varchar(128)', 'label'=>'ExternalSystemID', 'enabled'=>1, 'visible'=>-2, 'position'=>170, 'help'=>'IDOfPaymentInAnExternalSystem'), + 'stripe_account' =>array('type'=>'varchar(128)', 'label'=>'ExternalSystemCustomerAccount', 'enabled'=>1, 'visible'=>-2, 'position'=>171, 'help'=>'IDOfCustomerInAnExternalSystem'), + 'ext_payment_site' =>array('type'=>'varchar(128)', 'label'=>'ExternalSystem', 'enabled'=>1, 'visible'=>-2, 'position'=>172, 'help'=>'NameOfExternalSystem'), '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), @@ -178,8 +179,9 @@ class CompanyPaymentMode extends CommonObject public $max_total_amount_of_all_payments; public $preapproval_key; public $total_amount_of_all_payments; - public $stripe_card_ref; - public $stripe_account; + public $stripe_card_ref; // External system payment mode ID + public $stripe_account; // External system customer ID + public $ext_payment_site; // External system 'StripeLive', 'StripeTest', 'StancerLive', 'StancerTest', ... /** * @var int Status diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 3abb9523d4f..9adf6ffdfb3 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -1227,18 +1227,22 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''; print dol_escape_htmltag($companypaymentmodetemp->label); print ''; - // External card ID - print ''; - if (!empty($companypaymentmodetemp->stripe_card_ref)) { - $connect = ''; - if (!empty($stripeacc)) { - $connect = $stripeacc.'/'; + // External system card ID + print ''; + if (!empty($companypaymentmodetemp->stripe_card_ref) && !empty($companypaymentmodetemp->ext_payment_site)) { + if (isModEnabled('stripe') && in_array($companypaymentmodetemp->ext_payment_site, array('StripeTest', 'StripeLive'))) { + $connect = ''; + if (!empty($stripeacc)) { + $connect = $stripeacc.'/'; + } + if ($rib->ext_payment_site == 'StripeLive') { + $url = 'https://dashboard.stripe.com/'.$connect.'search?query='.$companypaymentmodetemp->stripe_card_ref; + } else { + $url = 'https://dashboard.stripe.com/'.$connect.'test/search?query='.$companypaymentmodetemp->stripe_card_ref; + } + print "".img_picto($langs->trans('ShowInStripe').' - '.$companypaymentmodetemp->stripe_account, 'globe')." "; } - $url = 'https://dashboard.stripe.com/'.$connect.'test/search?query='.$companypaymentmodetemp->stripe_card_ref; - if ($servicestatus) { - $url = 'https://dashboard.stripe.com/'.$connect.'search?query='.$companypaymentmodetemp->stripe_card_ref; - } - print ''.img_picto($langs->trans('ShowInStripe').' - Customer and Publishable key = '.$companypaymentmodetemp->stripe_account, 'globe').' '; + // TODO Add hook here for other payment services } print dol_escape_htmltag($companypaymentmodetemp->stripe_card_ref); print ''; @@ -1559,22 +1563,24 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''; // Label print ''.dol_escape_htmltag($rib->label).''; - // Stripe ID - print ''; - if ($rib->stripe_card_ref) { - $connect = ''; - if (!empty($stripeacc)) { - $connect = $stripeacc.'/'; + // External system ID + print ''; + if (!empty($rib->stripe_card_ref) && !empty($rib->ext_payment_site)) { + if (isModEnabled('stripe') && in_array($rib->ext_payment_site, array('StripeTest', 'StripeLive'))) { + $connect = ''; + if (!empty($stripeacc)) { + $connect = $stripeacc.'/'; + } + if ($rib->ext_payment_site == 'StripeLive') { + $url = 'https://dashboard.stripe.com/'.$connect.'search?query='.$rib->stripe_card_ref; + } else { + $url = 'https://dashboard.stripe.com/'.$connect.'test/search?query='.$rib->stripe_card_ref; + } + print "".img_picto($langs->trans('ShowInStripe'), 'globe')." "; } - //$url='https://dashboard.stripe.com/'.$connect.'test/sources/'.$src->id; - $url = 'https://dashboard.stripe.com/'.$connect.'test/search?query='.$rib->stripe_card_ref; - if ($servicestatus) { - //$url='https://dashboard.stripe.com/'.$connect.'sources/'.$src->id; - $url = 'https://dashboard.stripe.com/'.$connect.'search?query='.$rib->stripe_card_ref; - } - print "".img_picto($langs->trans('ShowInStripe'), 'globe')." "; + // TODO Add hook here for other payment services } - print $rib->stripe_card_ref; + print dol_escape_htmltag($rib->stripe_card_ref); print ''; // Bank name print ''.dol_escape_htmltag($rib->bank).'';