From afa8b372392720d56a10a305a8fdb713d8f9b79e Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 5 Mar 2018 19:45:55 +0100 Subject: [PATCH 01/22] NEW: add link to stripe's info in bank menu --- htdocs/core/modules/modStripe.class.php | 42 +++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/htdocs/core/modules/modStripe.class.php b/htdocs/core/modules/modStripe.class.php index fa9abbec0e5..90a712fdbd8 100644 --- a/htdocs/core/modules/modStripe.class.php +++ b/htdocs/core/modules/modStripe.class.php @@ -106,6 +106,48 @@ class modStripe extends DolibarrModules 'user'=>2 ); // 0=Menu for internal users, 1=external users, 2=both $r++; + + $this->menu[$r] = array('fk_menu'=>'fk_mainmenu=bank', + 'type'=>'left', + 'titre'=>'StripeAccount', + 'mainmenu'=>'bank', + 'leftmenu'=>'stripe', + 'url' => '/stripe/charge.php', + 'langs' => 'stripe', + 'position' => 100, + 'enabled' => '1', + 'perms' => '$user->rights->banque->configurer', + 'target' => '', + 'user' => 0 + ); + + $r ++; + $this->menu[$r] = array( + 'fk_menu' => 'fk_mainmenu=bank,fk_leftmenu=stripe', + 'type' => 'left', + 'titre' => 'StripeChargeList', + 'url' => '/stripe/charge.php', + 'langs' => 'stripe', + 'position' => 102, + 'enabled' => '$conf->stripe->enabled && $conf->banque->enabled', + 'perms' => '$user->rights->banque->configurer', + 'target' => '', + 'user' => 0 + ); + + $r ++; + $this->menu[$r] = array( + 'fk_menu' => 'fk_mainmenu=bank,fk_leftmenu=stripe', + 'type' => 'left', + 'titre' => 'StripeTransactionList', + 'url' => '/stripe/transaction.php', + 'langs' => 'stripe', + 'position' => 102, + 'enabled' => '$conf->stripe->enabled && $conf->banque->enabled', + 'perms' => '$user->rights->banque->configurer', + 'target' => '', + 'user' => 0 + ); // Exports $r=1; From 62a339e58256a1f4f8b8fc3fd82db5b1b7e1024e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Mar 2018 14:13:46 +0100 Subject: [PATCH 02/22] Minor fix in multicurrency for supplier prices --- .../core/modules/modMultiCurrency.class.php | 2 +- htdocs/product/fournisseurs.php | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/htdocs/core/modules/modMultiCurrency.class.php b/htdocs/core/modules/modMultiCurrency.class.php index 0dbfe3380cf..7908f203c69 100644 --- a/htdocs/core/modules/modMultiCurrency.class.php +++ b/htdocs/core/modules/modMultiCurrency.class.php @@ -59,7 +59,7 @@ class modMultiCurrency extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i', '', get_class($this)); // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) - $this->description = "Module to enter elements with a foreign currency"; + $this->description = "Module to manage several foreign currencies in prices and documents"; // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version $this->version = 'dolibarr'; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 462be52b082..a2f79e4c402 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -552,19 +552,22 @@ if ($id > 0 || $ref) // Currency print ''.$langs->trans("Currency").''; print ''; - print $form->selectMultiCurrency(GETPOST('multicurrency_code')?GETPOST('multicurrency_code'):(isset($object->fourn_multicurrency_code)?$object->fourn_multicurrency_code:''), "multicurrency_code", 1); + $currencycodetouse = GETPOST('multicurrency_code')?GETPOST('multicurrency_code'):(isset($object->fourn_multicurrency_code)?$object->fourn_multicurrency_code:''); + if (empty($currencycodetouse) && $object->fourn_multicurrency_tx == 1) $currencycodetouse=$conf->currency; + print $form->selectMultiCurrency($currencycodetouse, "multicurrency_code", 1); print ''; print ''; // Currency tx print ''.$langs->trans("CurrencyRate").''; - print ''; + print ''; print ''; print ''; // Currency price qty min print ''.$langs->trans("PriceQtyMinCurrency").''; - print ''; + $pricesupplierincurrencytouse=(GETPOST('multicurrency_price')?GETPOST('multicurrency_price'):(isset($object->fourn_multicurrency_price)?$object->fourn_multicurrency_price:'')); + print ''; print ' '; print $form->selectPriceBaseType((GETPOST('multicurrency_price_base_type')?GETPOST('multicurrency_price_base_type'):'HT'), "multicurrency_price_base_type"); // We keep 'HT' here, multicurrency_price_base_type is not yet supported for supplier prices print ''; @@ -602,7 +605,7 @@ if ($id > 0 || $ref) $('input[name="disabled_price"]').prop('disabled', true); $('select[name="disabled_price_base_type"]').prop('disabled', true); update_price_from_multicurrency(); - + $('input[name="multicurrency_price"]').keyup(function () { update_price_from_multicurrency(); }).change(function () { @@ -610,7 +613,7 @@ if ($id > 0 || $ref) }).on('paste', function () { update_price_from_multicurrency(); }); - + $('input[name="multicurrency_tx"]').keyup(function () { update_price_from_multicurrency(); }).change(function () { @@ -618,12 +621,12 @@ if ($id > 0 || $ref) }).on('paste', function () { update_price_from_multicurrency(); }); - + $('select[name="multicurrency_price_base_type"]').change(function () { $('input[name="price_base_type"]').val($(this).val()); $('select[name="disabled_price_base_type"]').val($(this).val()); }); - + var currencies_array = $currencies; $('select[name="multicurrency_code"]').change(function () { $('input[name="multicurrency_tx"]').val(currencies_array[$(this).val()]); @@ -844,7 +847,7 @@ SCRIPT; } // Modify-Remove - print ''; + print ''; if ($user->rights->produit->creer || $user->rights->service->creer) { print ''.img_edit().""; From c1497b065cc79fe067aa3d62edd212e9f60fce14 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Mar 2018 14:13:55 +0100 Subject: [PATCH 03/22] CSS --- htdocs/compta/facture/list.php | 12 ++++++------ htdocs/projet/list.php | 16 ++++++++-------- htdocs/theme/eldy/style.css.php | 9 ++++----- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 625336a0fe4..c09621db71c 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -702,18 +702,18 @@ if ($resql) if (! empty($arrayfields['f.date']['checked'])) { print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($year?$year:-1,'year',1, 20, 5, 0, 0, '', 'width75'); + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; + $formother->select_year($year?$year:-1,'year',1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); print ''; } // Date due if (! empty($arrayfields['f.date_lim_reglement']['checked'])) { print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($year_lim?$year_lim:-1,'year_lim',1, 20, 5, 0, 0, '', 'width75'); + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; + $formother->select_year($year_lim?$year_lim:-1,'year_lim',1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); print '
'.$langs->trans("Late"); print ''; } diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 6b3613a7b0a..e148caeb328 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -508,19 +508,19 @@ if (! empty($arrayfields['commercial']['checked'])) // Start date if (! empty($arrayfields['p.dateo']['checked'])) { - print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($search_syear?$search_syear:-1,'search_syear',1, 20, 5); + print ''; + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; + $formother->select_year($search_syear?$search_syear:-1,'search_syear',1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); print ''; } // End date if (! empty($arrayfields['p.datee']['checked'])) { - print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($search_eyear?$search_eyear:-1,'search_eyear',1, 20, 5); + print ''; + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; + $formother->select_year($search_eyear?$search_eyear:-1,'search_eyear',1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); print ''; } if (! empty($arrayfields['p.public']['checked'])) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 4843ef11013..c7b00629b3b 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -295,12 +295,12 @@ input, input.flat, textarea, textarea.flat, form.flat select, select, select.fla } input { - line-height: 17px; - padding: 6px; + line-height: 1.3em; + padding: 5px; padding-left: 5px; } select { - padding: 4px; + padding: 5px; padding-left: 2px; } input, select { @@ -419,7 +419,6 @@ td.actionbuttons a { select.flat, form.flat select { font-weight: normal; font-size: unset; - height: 2em; } .optionblue { color: rgb(); @@ -992,7 +991,7 @@ select.selectarrowonleft option { input, input[type=text], input[type=password], select, textarea { min-width: 20px; min-height: 1.4em; - line-height: 1.4em; + /* line-height: 1.4em; */ /* padding: .4em .1em; */ /* border-bottom: 1px solid #BBB; */ /* max-width: inherit; why this ? */ From 64b0d1d3904031f6568a319a557cf525a25857e7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Mar 2018 14:33:29 +0100 Subject: [PATCH 04/22] Fix by adding a redirect to avoid the order2billing being done twice. --- htdocs/commande/list.php | 2 +- htdocs/core/actions_massactions.inc.php | 29 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 793fb2cf708..784f44aad4c 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -670,7 +670,7 @@ if ($resql) // Status billed if (! empty($arrayfields['c.facture']['checked'])) { - print ''; + print ''; print $form->selectyesno('billed', $billed, 1, 0, 1); print ''; } diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index fae976dec80..5a713168c48 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -686,6 +686,35 @@ if ($massaction == 'confirm_createbills') { $db->commit(); setEventMessage($langs->trans('BillCreated', $nb_bills_created)); + + // Make a redirect to avoid to bill twice if we make a refresh or back + $param=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); + if ($sall) $param.='&sall='.urlencode($sall); + if ($socid > 0) $param.='&socid='.urlencode($socid); + if ($viewstatut != '') $param.='&viewstatut='.urlencode($viewstatut); + if ($search_orderday) $param.='&search_orderday='.urlencode($search_orderday); + if ($search_ordermonth) $param.='&search_ordermonth='.urlencode($search_ordermonth); + if ($search_orderyear) $param.='&search_orderyear='.urlencode($search_orderyear); + if ($search_deliveryday) $param.='&search_deliveryday='.urlencode($search_deliveryday); + if ($search_deliverymonth) $param.='&search_deliverymonth='.urlencode($search_deliverymonth); + if ($search_deliveryyear) $param.='&search_deliveryyear='.urlencode($search_deliveryyear); + if ($search_ref) $param.='&search_ref='.urlencode($search_ref); + if ($search_company) $param.='&search_company='.urlencode($search_company); + if ($search_ref_customer) $param.='&search_ref_customer='.urlencode($search_ref_customer); + if ($search_user > 0) $param.='&search_user='.urlencode($search_user); + if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale); + if ($search_total_ht != '') $param.='&search_total_ht='.urlencode($search_total_ht); + if ($search_total_vat != '') $param.='&search_total_vat='.urlencode($search_total_vat); + if ($search_total_ttc != '') $param.='&search_total_ttc='.urlencode($search_total_ttc); + if ($search_project_ref >= 0) $param.="&search_project_ref=".urlencode($search_project_ref); + if ($show_files) $param.='&show_files=' .urlencode($show_files); + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + if ($billed != '') $param.='&billed='.urlencode($billed); + + header("Location: ".$_SERVER['PHP_SELF'].'?'.$param); + exit; } else { From e242dbad88a2100d3582d07705b00a7cbcdabbf2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Mar 2018 14:44:32 +0100 Subject: [PATCH 05/22] Debug stripe --- htdocs/langs/en_US/stripe.lang | 3 ++ htdocs/stripe/admin/stripe.php | 52 ++++++++++++++++------------------ 2 files changed, 28 insertions(+), 27 deletions(-) diff --git a/htdocs/langs/en_US/stripe.lang b/htdocs/langs/en_US/stripe.lang index 2b5823c28fb..23473304bdf 100644 --- a/htdocs/langs/en_US/stripe.lang +++ b/htdocs/langs/en_US/stripe.lang @@ -35,8 +35,11 @@ NewStripePaymentReceived=New Stripe payment received NewStripePaymentFailed=New Stripe payment tried but failed STRIPE_TEST_SECRET_KEY=Secret test key STRIPE_TEST_PUBLISHABLE_KEY=Publishable test key +STRIPE_TEST_WEBHOOK_KEY=Webhook test key STRIPE_LIVE_SECRET_KEY=Secret live key STRIPE_LIVE_PUBLISHABLE_KEY=Publishable live key +STRIPE_LIVE_WEBHOOK_KEY=Webhook live key +ONLINE_PAYMENT_WAREHOUSE=Stock to use for stock decrease when payment online payment is done (TODO When option to decrease stock is done on an action on invoice and the online payment generate itself the invoice ?) StripeLiveEnabled=Stripe live enabled (otherwise test/sandbox mode) StripeImportPayment=Import Stripe payments ExampleOfTestCreditCard=Example of credit card for test: %s (valid), %s (error CVC), %s (expired), %s (charge fails) \ No newline at end of file diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 544764b4c11..bc098fb15ac 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -49,26 +49,26 @@ if ($action == 'setvalue' && $user->admin) $result=dolibarr_set_const($db, "STRIPE_LIVE",GETPOST('STRIPE_LIVE','alpha'),'chaine',0,'',$conf->entity); if (! $result > 0) $error++; -if (empty($conf->stripeconnect->enabled)) { +if (empty($conf->stripeconnect->enabled)) { $result=dolibarr_set_const($db, "STRIPE_TEST_PUBLISHABLE_KEY",GETPOST('STRIPE_TEST_PUBLISHABLE_KEY','alpha'),'chaine',0,'',$conf->entity); if (! $result > 0) $error++; $result=dolibarr_set_const($db, "STRIPE_TEST_SECRET_KEY",GETPOST('STRIPE_TEST_SECRET_KEY','alpha'),'chaine',0,'',$conf->entity); if (! $result > 0) $error++; $result=dolibarr_set_const($db, "STRIPE_TEST_WEBHOOK_KEY",GETPOST('STRIPE_TEST_WEBHOOK_KEY','alpha'),'chaine',0,'',$conf->entity); - if (! $result > 0) $error++; + if (! $result > 0) $error++; $result=dolibarr_set_const($db, "STRIPE_LIVE_PUBLISHABLE_KEY",GETPOST('STRIPE_LIVE_PUBLISHABLE_KEY','alpha'),'chaine',0,'',$conf->entity); if (! $result > 0) $error++; $result=dolibarr_set_const($db, "STRIPE_LIVE_SECRET_KEY",GETPOST('STRIPE_LIVE_SECRET_KEY','alpha'),'chaine',0,'',$conf->entity); if (! $result > 0) $error++; $result=dolibarr_set_const($db, "STRIPE_LIVE_WEBHOOK_KEY",GETPOST('STRIPE_LIVE_WEBHOOK_KEY','alpha'),'chaine',0,'',$conf->entity); - if (! $result > 0) $error++; -} + if (! $result > 0) $error++; +} $result=dolibarr_set_const($db, "ONLINE_PAYMENT_CREDITOR",GETPOST('ONLINE_PAYMENT_CREDITOR','alpha'),'chaine',0,'',$conf->entity); if (! $result > 0) $error++; $result=dolibarr_set_const($db, "STRIPE_BANK_ACCOUNT_FOR_PAYMENTS",GETPOST('STRIPE_BANK_ACCOUNT_FOR_PAYMENTS','int'),'chaine',0,'',$conf->entity); if (! $result > 0) $error++; $result=dolibarr_set_const($db, "STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS",GETPOST('STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS','int'),'chaine',0,'',$conf->entity); - if (! $result > 0) $error++; + if (! $result > 0) $error++; $result=dolibarr_set_const($db, "ONLINE_PAYMENT_CSS_URL",GETPOST('ONLINE_PAYMENT_CSS_URL','alpha'),'chaine',0,'',$conf->entity); if (! $result > 0) $error++; $result=dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_FORM",GETPOST('ONLINE_PAYMENT_MESSAGE_FORM','alpha'),'chaine',0,'',$conf->entity); @@ -180,10 +180,10 @@ print ''; print ''.$langs->trans("STRIPE_TEST_SECRET_KEY").''; print ''; print '   '.$langs->trans("Example").': sk_test_xxxxxxxxxxxxxxxxxxxxxxxx'; -print ''; +print ''; print ''; -print ''.$langs->trans("STRIPE_TEST_WEBHOOK_KEY").''; +print ''.$langs->trans("STRIPE_TEST_WEBHOOK_KEY").''; print ''; print '   '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; print ''; @@ -201,7 +201,7 @@ print '   '.$langs->trans("Example").': sk_live_xxxxxxxxxxxxxxxxxxxxxxxx'; print ''; print ''; -print ''.$langs->trans("STRIPE_LIVE_WEBHOOK_KEY").''; +print ''.$langs->trans("STRIPE_LIVE_WEBHOOK_KEY").''; print ''; print '   '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; print ''; @@ -210,19 +210,6 @@ print ''.$langs->trans("STRIPECONNECT").''; print 'Ce module est configuré en mode marketplace'; } -if (! empty($conf->banque->enabled)) -{ -print ''; -print $langs->trans("BankAccount").''; -print $form->select_comptes($conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS, 'STRIPE_BANK_ACCOUNT_FOR_PAYMENTS', 0, '', 1); -print ''; - -print ''; -print $langs->trans("BankAccount").''; -print $form->select_comptes($conf->global->STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS, 'STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS', 0, '', 1); -print ''; -} - print ''; print '
'; @@ -245,6 +232,23 @@ if (! empty($conf->banque->enabled)) print $langs->trans("BankAccount").''; print $form->select_comptes($conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS, 'STRIPE_BANK_ACCOUNT_FOR_PAYMENTS', 0, '', 1); print ''; + + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // What is this for ? + { + print ''; + print $langs->trans("BankAccountForBankTransfer").''; + print $form->select_comptes($conf->global->STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS, 'STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS', 0, '', 1); + print ''; + } +} + +if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // What is this for ? +{ + // Stock for automatic decrement + print ''; + print $langs->trans("ONLINE_PAYMENT_WAREHOUSE").''; + print $formproduct->selectWarehouses($conf->global->ONLINE_PAYMENT_WAREHOUSE,'ONLINE_PAYMENT_WAREHOUSE','',1,$disabled); + print ''; } print ''; @@ -277,12 +281,6 @@ print ''; -// stock for automatic decrement -print ''; -print $langs->trans("ONLINE_PAYMENT_WAREHOUSE").''; -print $formproduct->selectWarehouses($conf->global->ONLINE_PAYMENT_WAREHOUSE,'ONLINE_PAYMENT_WAREHOUSE','',1,$disabled); -print ''; - // Payment token for URL print ''; print $langs->trans("SecurityToken").''; From 1419eaf15fedb4eda22dafba382cb100d6608c75 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Mar 2018 15:05:49 +0100 Subject: [PATCH 06/22] Debug last stripe PR --- htdocs/core/lib/company.lib.php | 15 +- htdocs/langs/en_US/banks.lang | 1 + htdocs/langs/en_US/stripe.lang | 3 +- .../societe/{gateway.php => paymentmodes.php} | 266 ++++++++++-------- 4 files changed, 157 insertions(+), 128 deletions(-) rename htdocs/societe/{gateway.php => paymentmodes.php} (83%) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 38b59876494..023729e680d 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -175,14 +175,21 @@ function societe_prepare_head(Societe $object) $h++; } - // Bank accounrs + // Bank accounts if (empty($conf->global->SOCIETE_DISABLE_BANKACCOUNT)) { - $langs->load("banks"); + $langs->load("banks"); + + $title = $langs->trans("BankAccounts"); + if (! empty($conf->stripe->enabled)) + { + $langs->load("stripe"); + $title = $langs->trans("BankAccountsAndGateways"); + } $nbBankAccount=0; - $head[$h][0] = DOL_URL_ROOT .'/societe/gateway.php?socid='.$object->id; - $head[$h][1] = $langs->trans("Gateways"); + $head[$h][0] = DOL_URL_ROOT .'/societe/paymentmodes.php?socid='.$object->id; + $head[$h][1] = $title; $sql = "SELECT COUNT(n.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."societe_rib as n"; $sql.= " WHERE fk_soc = ".$object->id; diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 78ac859e706..93fea797c81 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -7,6 +7,7 @@ BankName=Bank name FinancialAccount=Account BankAccount=Bank account BankAccounts=Bank accounts +BankAccountsAndGateways=Bank accounts | Gateways ShowAccount=Show Account AccountRef=Financial account ref AccountLabel=Financial account label diff --git a/htdocs/langs/en_US/stripe.lang b/htdocs/langs/en_US/stripe.lang index 23473304bdf..9bc202685dd 100644 --- a/htdocs/langs/en_US/stripe.lang +++ b/htdocs/langs/en_US/stripe.lang @@ -42,4 +42,5 @@ STRIPE_LIVE_WEBHOOK_KEY=Webhook live key ONLINE_PAYMENT_WAREHOUSE=Stock to use for stock decrease when payment online payment is done (TODO When option to decrease stock is done on an action on invoice and the online payment generate itself the invoice ?) StripeLiveEnabled=Stripe live enabled (otherwise test/sandbox mode) StripeImportPayment=Import Stripe payments -ExampleOfTestCreditCard=Example of credit card for test: %s (valid), %s (error CVC), %s (expired), %s (charge fails) \ No newline at end of file +ExampleOfTestCreditCard=Example of credit card for test: %s (valid), %s (error CVC), %s (expired), %s (charge fails) +StripeGateways=Stripe gateways \ No newline at end of file diff --git a/htdocs/societe/gateway.php b/htdocs/societe/paymentmodes.php similarity index 83% rename from htdocs/societe/gateway.php rename to htdocs/societe/paymentmodes.php index 79a9a60bb96..33db57b2ac4 100644 --- a/htdocs/societe/gateway.php +++ b/htdocs/societe/paymentmodes.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; +//require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; $langs->load("companies"); $langs->load("commercial"); @@ -331,25 +331,28 @@ if (empty($reshook)) $id = $savid; } -$stripeconnect=new StripeConnexion($db); -$customer=$stripeconnect->CustomerStripe($socid,$stripeconnect->GetStripeAccount($conf->entity)); -if ($customer->id) { -$cu = \Stripe\Customer::retrieve("".$customer->id."",array("stripe_account" => $stripeconnect->GetStripeAccount($conf->entity)));} -$url=DOL_URL_ROOT.'/societe/gateway.php?socid='.$object->id; -if ($action == 'setasdefault') +if (class_exists('StripeConnexion')) { -$cu->default_source = "$source"; // obtained with Stripe.js -$cu->save(); + $stripeconnect=new StripeConnexion($db); + $customerstripe=$stripeconnect->CustomerStripe($socid,$stripeconnect->GetStripeAccount($conf->entity)); + if ($customerstripe->id) { + $cu = \Stripe\Customer::retrieve("".$customerstripe->id."",array("stripe_account" => $stripeconnect->GetStripeAccount($conf->entity)));} + $url=DOL_URL_ROOT.'/societe/gateway.php?socid='.$object->id; + if ($action == 'setasdefault') + { + $cu->default_source = "$source"; // obtained with Stripe.js + $cu->save(); -header('Location: '.$url); -exit; -} -elseif ($action == 'delete') -{ -$cu->sources->retrieve("$source")->delete(); + header('Location: '.$url); + exit; + } + elseif ($action == 'delete') + { + $cu->sources->retrieve("$source")->delete(); -header('Location: '.$url); -exit; + header('Location: '.$url); + exit; + } } @@ -403,115 +406,132 @@ if ($socid && $action != 'edit' && $action != "create") dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); -if (! (empty($conf->stripe->enabled))){ -print ''; -print $langs->trans('StripeGateways').''; -if ($stripeconnect->GetStripeAccount($conf->entity)) { -$customer=$stripeconnect->CustomerStripe($object->id,$stripeconnect->GetStripeAccount($conf->entity)); -} -if ($customer->id) { -$input=$customer->sources->data; -} -print ''."\n"; -print ''; -print ''; -print ''; -print ''; -print ''; -print "\n"; - -foreach ($input as $src) { -print ''; -print ''; - // Default - print ''; -print ''; -} -if (empty($input)) -{ -print ''; -} -print "
'.$langs->trans('Type').''.$langs->trans('Informations').''.$langs->trans('Default').'
'; -if ($src->object=='card'){ -if ($src->brand == 'Visa') {$brand='cc-visa';} -elseif ($src->brand == 'MasterCard') {$brand='cc-mastercard';} -elseif ($src->brand == 'American Express') {$brand='cc-amex';} -elseif ($src->brand == 'Discover') {$brand='cc-discover';} -elseif ($src->brand == 'JCB') {$brand='cc-jcb';} -elseif ($src->brand == 'Diners Club') {$brand='cc-diners-club';} -else {$brand='credit-card';} -print ''; -} -elseif ($src->object=='source' && $src->type=='card'){ -if ($src->card->brand == 'Visa') {$brand='cc-visa';} -elseif ($src->card->brand == 'MasterCard') {$brand='cc-mastercard';} -elseif ($src->card->brand == 'American Express') {$brand='cc-amex';} -elseif ($src->card->brand == 'Discover') {$brand='cc-discover';} -elseif ($src->card->brand == 'JCB') {$brand='cc-jcb';} -elseif ($src->card->brand == 'Diners Club') {$brand='cc-diners-club';} -else {$brand='credit-card';} + if (! (empty($conf->stripe->enabled))) + { + print load_fiche_titre($langs->trans('StripeGateways'), '', ''); -print ''; -} -elseif ($src->object=='source' && $src->type=='sepa_debit'){ -print ''; -} -print''; -if ($src->object=='card'){ -print '**** '.$src->last4.' - '.$src->exp_month.'/'.$src->exp_year.''; -print ''; - if ($src->country) - { - $img=picto_from_langcode($src->country); - print $img?$img.' ':''; - print getCountry($src->country,1); + if (is_object($stripeconnect) && $stripeconnect->GetStripeAccount($conf->entity)) + { + $customerstripe=$stripeconnect->CustomerStripe($object->id,$stripeconnect->GetStripeAccount($conf->entity)); + } + + if ($customerstripe->id) { + $input=$customerstripe->sources->data; + } + + print ''."\n"; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + + if (is_array($input)) + { + foreach ($input as $src) + { + print ''; + print ''; + // Default + print ''; + print ''; + } + } + if (empty($input)) + { + print ''; + } + print "
'.$langs->trans('Type').''.$langs->trans('Informations').''.$langs->trans('Default').'
'; + if ($src->object=='card') + { + if ($src->brand == 'Visa') {$brand='cc-visa';} + elseif ($src->brand == 'MasterCard') {$brand='cc-mastercard';} + elseif ($src->brand == 'American Express') {$brand='cc-amex';} + elseif ($src->brand == 'Discover') {$brand='cc-discover';} + elseif ($src->brand == 'JCB') {$brand='cc-jcb';} + elseif ($src->brand == 'Diners Club') {$brand='cc-diners-club';} + else {$brand='credit-card';} + print ''; + } + elseif ($src->object=='source' && $src->type=='card') + { + if ($src->card->brand == 'Visa') {$brand='cc-visa';} + elseif ($src->card->brand == 'MasterCard') {$brand='cc-mastercard';} + elseif ($src->card->brand == 'American Express') {$brand='cc-amex';} + elseif ($src->card->brand == 'Discover') {$brand='cc-discover';} + elseif ($src->card->brand == 'JCB') {$brand='cc-jcb';} + elseif ($src->card->brand == 'Diners Club') {$brand='cc-diners-club';} + else {$brand='credit-card';} + print ''; + } + elseif ($src->object=='source' && $src->type=='sepa_debit') + { + print ''; + } + + print''; + if ($src->object=='card') + { + print '**** '.$src->last4.' - '.$src->exp_month.'/'.$src->exp_year.''; + print ''; + if ($src->country) + { + $img=picto_from_langcode($src->country); + print $img?$img.' ':''; + print getCountry($src->country,1); + } + else print img_warning().' '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).''; + } + elseif ($src->object=='source' && $src->type=='card') + { + print $src->owner->name.'
**** '.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; + print '
'; + + if ($src->card->country) + { + $img=picto_from_langcode($src->card->country); + print $img?$img.' ':''; + print getCountry($src->card->country,1); + } + else print img_warning().' '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).''; + } + elseif ($src->object=='source' && $src->type=='sepa_debit') + { + print 'info sepa'; + print ''; + if ($src->sepa_debit->country) + { + $img=picto_from_langcode($src->sepa_debit->country); + print $img?$img.' ':''; + print getCountry($src->sepa_debit->country,1); + } + else print img_warning().' '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).''; + } + print ''; + if (($cu->default_source!=$src->id)) + { + print ''; + print ""; + print ''; + } else { + print ""; + } + print ''; + if ($user->rights->societe->creer) + { + // print ''; + // print img_picto($langs->trans("Modify"),'edit'); + // print ''; + // print ' '; + print ''; + print ""; + print ''; + } + print '
'.$langs->trans("NoSource").'
"; } - else print img_warning().' '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).''; -} -elseif ($src->object=='source' && $src->type=='card'){ -print $src->owner->name.'
**** '.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; -print '
'; - if ($src->card->country) - { - $img=picto_from_langcode($src->card->country); - print $img?$img.' ':''; - print getCountry($src->card->country,1); - } - else print img_warning().' '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).''; -} -elseif ($src->object=='source' && $src->type=='sepa_debit'){ -print 'info sepa'; -print ''; - if ($src->sepa_debit->country) - { - $img=picto_from_langcode($src->sepa_debit->country); - print $img?$img.' ':''; - print getCountry($src->sepa_debit->country,1); - } - else print img_warning().' '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).''; -} -print ''; - if (($cu->default_source!=$src->id)) { - print ''; - print ""; - print ''; - } else { - print ""; - } - print ''; - if ($user->rights->societe->creer) - { -// print ''; -// print img_picto($langs->trans("Modify"),'edit'); -// print ''; -// print ' '; - print ''; - print ""; - print ''; - } -print '
'.$langs->trans("NoSource").'
"; -} + // List of bank accounts From 05c1150477a6c6084a64d30436d6bb013b62659f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Mar 2018 15:13:22 +0100 Subject: [PATCH 07/22] Fix bad links --- htdocs/core/modules/modStripe.class.php | 79 +++++++++++++------------ 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/htdocs/core/modules/modStripe.class.php b/htdocs/core/modules/modStripe.class.php index 90a712fdbd8..8a11d6884db 100644 --- a/htdocs/core/modules/modStripe.class.php +++ b/htdocs/core/modules/modStripe.class.php @@ -106,47 +106,48 @@ class modStripe extends DolibarrModules 'user'=>2 ); // 0=Menu for internal users, 1=external users, 2=both $r++; - - $this->menu[$r] = array('fk_menu'=>'fk_mainmenu=bank', - 'type'=>'left', - 'titre'=>'StripeAccount', - 'mainmenu'=>'bank', - 'leftmenu'=>'stripe', - 'url' => '/stripe/charge.php', - 'langs' => 'stripe', - 'position' => 100, - 'enabled' => '1', - 'perms' => '$user->rights->banque->configurer', - 'target' => '', - 'user' => 0 + + $this->menu[$r] = array( + 'fk_menu'=>'fk_mainmenu=bank', + 'type'=>'left', + 'titre'=>'StripeAccount', + 'mainmenu'=>'bank', + 'leftmenu'=>'stripe', + 'url' => '/stripe/charge.php', + 'langs' => 'stripe', + 'position' => 100, + 'enabled' => '$conf->global->MAIN_FEATURES_LEVEL >= 2', + 'perms' => '$user->rights->banque->configurer', + 'target' => '', + 'user' => 0 ); - - $r ++; - $this->menu[$r] = array( - 'fk_menu' => 'fk_mainmenu=bank,fk_leftmenu=stripe', - 'type' => 'left', - 'titre' => 'StripeChargeList', - 'url' => '/stripe/charge.php', - 'langs' => 'stripe', - 'position' => 102, - 'enabled' => '$conf->stripe->enabled && $conf->banque->enabled', - 'perms' => '$user->rights->banque->configurer', - 'target' => '', - 'user' => 0 - ); - - $r ++; + + $r++; $this->menu[$r] = array( - 'fk_menu' => 'fk_mainmenu=bank,fk_leftmenu=stripe', - 'type' => 'left', - 'titre' => 'StripeTransactionList', - 'url' => '/stripe/transaction.php', - 'langs' => 'stripe', - 'position' => 102, - 'enabled' => '$conf->stripe->enabled && $conf->banque->enabled', - 'perms' => '$user->rights->banque->configurer', - 'target' => '', - 'user' => 0 + 'fk_menu' => 'fk_mainmenu=bank,fk_leftmenu=stripe', + 'type' => 'left', + 'titre' => 'StripeChargeList', + 'url' => '/stripe/charge.php', + 'langs' => 'stripe', + 'position' => 102, + 'enabled' => '$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 2', + 'perms' => '$user->rights->banque->configurer', + 'target' => '', + 'user' => 0 + ); + + $r++; + $this->menu[$r] = array( + 'fk_menu' => 'fk_mainmenu=bank,fk_leftmenu=stripe', + 'type' => 'left', + 'titre' => 'StripeTransactionList', + 'url' => '/stripe/transaction.php', + 'langs' => 'stripe', + 'position' => 102, + 'enabled' => '$conf->stripe->enabled && $conf->banque->enabled && $conf->global->MAIN_FEATURES_LEVEL >= 2', + 'perms' => '$user->rights->banque->configurer', + 'target' => '', + 'user' => 0 ); // Exports From 94140b04ca2b51dd16d2ef9c8eaa06e343b16a70 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Mar 2018 15:28:50 +0100 Subject: [PATCH 08/22] FIX Missing primary key on payment modes --- htdocs/install/mysql/migration/7.0.0-8.0.0.sql | 4 ++++ htdocs/install/mysql/tables/llx_c_paiement.key.sql | 2 ++ htdocs/install/mysql/tables/llx_c_paiement.sql | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql index 73e1ec4cab9..76695e9edfe 100644 --- a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql +++ b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql @@ -70,3 +70,7 @@ ALTER TABLE llx_expensereport_det ADD COLUMN docnumber varchar(128) after fk_exp ALTER TABLE llx_website_page ADD COLUMN aliasalt varchar(255) after pageurl; +-- Add missing primary key +ALTER TABLE llx_c_paiement CHANGE COLUMN id id INTEGER AUTO_INCREMENT PRIMARY KEY; + + diff --git a/htdocs/install/mysql/tables/llx_c_paiement.key.sql b/htdocs/install/mysql/tables/llx_c_paiement.key.sql index ad1930fba2e..1e22789d7bf 100644 --- a/htdocs/install/mysql/tables/llx_c_paiement.key.sql +++ b/htdocs/install/mysql/tables/llx_c_paiement.key.sql @@ -18,3 +18,5 @@ -- ======================================================================== ALTER TABLE llx_c_paiement ADD UNIQUE INDEX uk_c_paiement(id, entity, code); + +ALTER TABLE llx_c_paiement ADD UNIQUE INDEX uk_c_paiement_code(entity, code); diff --git a/htdocs/install/mysql/tables/llx_c_paiement.sql b/htdocs/install/mysql/tables/llx_c_paiement.sql index 55cb44fb257..1c26cb7aaeb 100644 --- a/htdocs/install/mysql/tables/llx_c_paiement.sql +++ b/htdocs/install/mysql/tables/llx_c_paiement.sql @@ -21,7 +21,7 @@ create table llx_c_paiement ( - id integer, + id integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, -- multi company id code varchar(6) NOT NULL, libelle varchar(62), From 6761a59acdc1fa040f2d17335df9156128bff5ac Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Mar 2018 17:22:38 +0100 Subject: [PATCH 09/22] Intorduce dolDecodeBlockedData --- htdocs/blockedlog/admin/blockedlog_list.php | 2 +- htdocs/blockedlog/ajax/block-info.php | 6 +++ htdocs/blockedlog/class/blockedlog.class.php | 41 +++++++++++++++++++- 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 9410ef9be5e..e8b2dc8b73b 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -196,7 +196,7 @@ else if (GETPOST('downloadcsv','alpha')) $block_static->user_fullname = $obj->user_fullname; $block_static->fk_user = $obj->fk_user; $block_static->signature = $obj->signature; - $block_static->object_data = unserialize($obj->object_data); + $block_static->object_data = $block_static->dolDecodeBlockedData($obj->object_data); $checksignature = $block_static->checkSignature($previoushash); // If $previoushash is not defined, checkSignature will search it diff --git a/htdocs/blockedlog/ajax/block-info.php b/htdocs/blockedlog/ajax/block-info.php index a092b13ca99..d4d4eef4e07 100644 --- a/htdocs/blockedlog/ajax/block-info.php +++ b/htdocs/blockedlog/ajax/block-info.php @@ -85,10 +85,16 @@ function formatObject($objtoshow, $prefix) { if (! is_object($val) && ! is_array($val)) { + // TODO $val can be '__PHP_Incomplete_Class', the is_object return false $s.=''.($prefix?$prefix.' > ':'').$key.''; $s.=''; if (in_array($key, array('date','datef','dateh','datec','datem','datep'))) { + /*var_dump(is_object($val)); + var_dump(is_array($val)); + var_dump(is_array($val)); + var_dump(@get_class($val)); + var_dump($val);*/ $s.=dol_print_date($val, 'dayhour'); } else diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 1bddb23de1d..8b7a3c150cc 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -18,10 +18,23 @@ * See https://medium.com/@lhartikk/a-blockchain-in-200-lines-of-code-963cc1cc0e54 */ + + + +/*ini_set('unserialize_callback_func', 'mycallback'); + +function mycallback($classname) +{ + //var_dump($classname); + include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + +}*/ + + + /** * Class to manage Blocked Log */ - class BlockedLog { /** @@ -636,7 +649,7 @@ class BlockedLog $this->fk_user = $obj->fk_user; $this->user_fullname = $obj->user_fullname; - $this->object_data = unserialize($obj->object_data); + $this->object_data = $this->dolDecodeBlockedData($obj->object_data); $this->signature = $obj->signature; $this->signature_line = $obj->signature_line; @@ -658,6 +671,30 @@ class BlockedLog } + + /** + * Decode data + * + * @param string $mode 0=unserialize, 1=json_decode + * @return string Value unserialized + */ + public function dolDecodeBlockedData($data, $mode=0) + { + try + { + //include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + //include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + $aaa = unserialize($data); + //$aaa = unserialize($data); + } + catch(Exception $e) + { + //print $e->getErrs); + } + return $aaa; + } + + /** * Set block certified by authority * From 78cbd92e988b632b9609002e1eb38eea3a0d4309 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Mar 2018 18:30:39 +0100 Subject: [PATCH 10/22] Fix init data on table of payment mode --- htdocs/install/mysql/data/llx_c_paiement.sql | 18 ++++++++---------- htdocs/install/mysql/migration/7.0.0-8.0.0.sql | 4 +++- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_paiement.sql b/htdocs/install/mysql/data/llx_c_paiement.sql index b192dd3c8b0..49da0b37952 100644 --- a/htdocs/install/mysql/data/llx_c_paiement.sql +++ b/htdocs/install/mysql/data/llx_c_paiement.sql @@ -30,16 +30,14 @@ -- Types paiement -- -delete from llx_c_paiement; -insert into llx_c_paiement (id,code,libelle,type,active) values ( 0, '', '-', 3,1); -insert into llx_c_paiement (id,code,libelle,type,active) values ( 1, 'TIP', 'TIP', 2,0); -insert into llx_c_paiement (id,code,libelle,type,active) values ( 2, 'VIR', 'Virement', 2,1); -insert into llx_c_paiement (id,code,libelle,type,active) values ( 3, 'PRE', 'Prélèvement', 2,1); -insert into llx_c_paiement (id,code,libelle,type,active) values ( 4, 'LIQ', 'Espèces', 2,1); -insert into llx_c_paiement (id,code,libelle,type,active) values ( 6, 'CB', 'Carte Bancaire', 2,1); -insert into llx_c_paiement (id,code,libelle,type,active) values ( 7, 'CHQ', 'Chèque', 2,1); -insert into llx_c_paiement (id,code,libelle,type,active) values (50, 'VAD', 'Paiement en ligne', 2,0); +insert into llx_c_paiement (id,code,libelle,type,active) values ( 1, '', '-', 2,1); +insert into llx_c_paiement (id,code,libelle,type,active) values ( 2, 'VIR', 'Transfer', 2,1); +insert into llx_c_paiement (id,code,libelle,type,active) values ( 3, 'PRE', 'Debit order', 2,1); +insert into llx_c_paiement (id,code,libelle,type,active) values ( 4, 'LIQ', 'Cash', 2,1); +insert into llx_c_paiement (id,code,libelle,type,active) values ( 6, 'CB', 'Credit card', 2,1); +insert into llx_c_paiement (id,code,libelle,type,active) values ( 7, 'CHQ', 'Cheque', 2,1); +insert into llx_c_paiement (id,code,libelle,type,active) values ( 8, 'TIP', 'TIP', 2,0); +insert into llx_c_paiement (id,code,libelle,type,active) values (50, 'VAD', 'Online payment', 2,0); insert into llx_c_paiement (id,code,libelle,type,active) values (51, 'TRA', 'Traite', 2,0); insert into llx_c_paiement (id,code,libelle,type,active) values (52, 'LCR', 'LCR', 2,0); insert into llx_c_paiement (id,code,libelle,type,active) values (53, 'FAC', 'Factor', 2,0); ---insert into llx_c_paiement (id,code,libelle,type,active) values (54, 'PRO', 'Proforma', 2,0); diff --git a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql index 76695e9edfe..4b224477940 100644 --- a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql +++ b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql @@ -70,7 +70,9 @@ ALTER TABLE llx_expensereport_det ADD COLUMN docnumber varchar(128) after fk_exp ALTER TABLE llx_website_page ADD COLUMN aliasalt varchar(255) after pageurl; --- Add missing primary key +-- Add missing keys and primary key +ALTER TABLE llx_c_paiement DROP INDEX uk_c_paiement; +ALTER TABLE llx_c_paiement ADD UNIQUE INDEX uk_c_paiement_code(entity, code); ALTER TABLE llx_c_paiement CHANGE COLUMN id id INTEGER AUTO_INCREMENT PRIMARY KEY; From 3287c03e67987e1479c03115fe46e4bafb839822 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Mar 2018 18:32:25 +0100 Subject: [PATCH 11/22] Fix data on thirdparty tooltip --- htdocs/compta/paiement/card.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index 6179fb9ac22..3a6727b4299 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -338,15 +338,18 @@ if ($resql) { $objp = $db->fetch_object($resql); - print ''; + $thirdpartystatic->fetch($objp->socid); - $invoice=new Facture($db); - $invoice->fetch($objp->facid); - $paiement = $invoice->getSommePaiement(); - $creditnotes=$invoice->getSumCreditNotesUsed(); - $deposits=$invoice->getSumDepositsUsed(); - $alreadypayed=price2num($paiement + $creditnotes + $deposits,'MT'); - $remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT'); + $invoice=new Facture($db); + $invoice->fetch($objp->facid); + + $paiement = $invoice->getSommePaiement(); + $creditnotes=$invoice->getSumCreditNotesUsed(); + $deposits=$invoice->getSumDepositsUsed(); + $alreadypayed=price2num($paiement + $creditnotes + $deposits,'MT'); + $remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT'); + + print ''; // Invoice print ''; @@ -355,8 +358,6 @@ if ($resql) // Third party print ''; - $thirdpartystatic->id=$objp->socid; - $thirdpartystatic->name=$objp->name; print $thirdpartystatic->getNomUrl(1); print ''; From 65c689cc812ec53926047a53465a7f8c1ee346ee Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Mar 2018 18:32:47 +0100 Subject: [PATCH 12/22] Clean code --- htdocs/compta/paiement/card.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index 3a6727b4299..2a8267aefb5 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -332,8 +332,6 @@ if ($resql) if ($num > 0) { - $var=True; - while ($i < $num) { $objp = $db->fetch_object($resql); From fe45e82e999d1f26a39579660d7d90ee363dcf92 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Mar 2018 19:00:38 +0100 Subject: [PATCH 13/22] Fix use of table llx_c_paiement (param showempty was not used/set) --- htdocs/compta/bank/bankentries_list.php | 4 ++-- htdocs/compta/bank/various_payment/index.php | 2 +- htdocs/compta/facture/invoicetemplate_list.php | 16 ++++++++-------- htdocs/compta/facture/list.php | 6 +++--- htdocs/compta/salaries/index.php | 2 +- htdocs/compta/tva/reglement.php | 2 +- htdocs/core/class/html.form.class.php | 2 +- htdocs/fourn/facture/list.php | 2 +- htdocs/install/mysql/data/llx_c_paiement.sql | 3 +-- htdocs/install/mysql/migration/7.0.0-8.0.0.sql | 1 + 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 91e496d998c..56eb8beeca7 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -673,7 +673,7 @@ if ($resql) print ''; print ' '; print ''; - $form->select_types_paiements((GETPOST('operation')?GETPOST('operation'):($object->courant == Account::TYPE_CASH ? 'LIQ' : '')),'operation','1,2',2,1); + $form->select_types_paiements((GETPOST('operation')?GETPOST('operation'):($object->courant == Account::TYPE_CASH ? 'LIQ' : '')), 'operation', '1,2', 2, 1); print ''; print ''; print ''; @@ -852,7 +852,7 @@ if ($resql) if (! empty($arrayfields['type']['checked'])) { print ''; - $form->select_types_paiements(empty($search_type)?'':$search_type, 'search_type', '', 2, 0, 1, 0, 1, 'maxwidth100'); + $form->select_types_paiements(empty($search_type)?'':$search_type, 'search_type', '', 2, 1, 1, 0, 1, 'maxwidth100'); print ''; } if (! empty($arrayfields['b.num_chq']['checked'])) diff --git a/htdocs/compta/bank/various_payment/index.php b/htdocs/compta/bank/various_payment/index.php index d52cbeb7595..41c0baa61d5 100644 --- a/htdocs/compta/bank/various_payment/index.php +++ b/htdocs/compta/bank/various_payment/index.php @@ -187,7 +187,7 @@ if ($result) // Type print ''; - $form->select_types_paiements($typeid,'typeid','',0,0,1,16); + $form->select_types_paiements($typeid,'typeid','',0,1,1,16); print ''; // Account diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 6cd80d8dff6..0a2b9f72d60 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -419,19 +419,19 @@ if ($resql) // Date invoice if (! empty($arrayfields['f.date_last_gen']['checked'])) { - print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($search_year?$search_year:-1,'search_year',1, 20, 5); + print ''; + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; + $formother->select_year($search_year?$search_year:-1,'search_year',1, 20, 5, 0, 0, '', 'witdhauto valignmiddle'); print ''; } // Date next generation if (! empty($arrayfields['f.date_when']['checked'])) { - print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($search_year_date_when?$search_year_date_when:-1,'search_year_date_when',1, 20, 5); + print ''; + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; + $formother->select_year($search_year_date_when?$search_year_date_when:-1,'search_year_date_when',1, 20, 5, 0, 0, '', 'witdhauto valignmiddle'); print ''; } // Extra fields diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index c09621db71c..8319f42bd97 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -756,7 +756,7 @@ if ($resql) if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) { print ''; - $form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 0, 1, 10); + $form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 1, 1, 10); print ''; } if (! empty($arrayfields['f.total_ht']['checked'])) @@ -775,14 +775,14 @@ if ($resql) } if (! empty($arrayfields['f.total_localtax1']['checked'])) { - // Amount + // Localtax1 print ''; print ''; print ''; } if (! empty($arrayfields['f.total_localtax2']['checked'])) { - // Amount + // Localtax2 print ''; print ''; print ''; diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index 47cafad0f0a..f911636a7ef 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -179,7 +179,7 @@ if ($result) print ' '; // Type print ''; - $form->select_types_paiements($typeid,'typeid','',0,0,1,16); + $form->select_types_paiements($typeid,'typeid','',0,1,1,16); print ''; // Account if (! empty($conf->banque->enabled)) diff --git a/htdocs/compta/tva/reglement.php b/htdocs/compta/tva/reglement.php index 66099cd63db..27e314762f8 100644 --- a/htdocs/compta/tva/reglement.php +++ b/htdocs/compta/tva/reglement.php @@ -173,7 +173,7 @@ if ($result) print ''; // Type print ''; - $form->select_types_paiements($typeid,'typeid','',0,0,1,16); + $form->select_types_paiements($typeid,'typeid','',0,1,1,16); print ''; // Account if (! empty($conf->banque->enabled)) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 7b74fc05850..61d21cec7e8 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3100,7 +3100,7 @@ class Form * @param string $morecss Add more CSS on select tag * @return void */ - function select_types_paiements($selected='', $htmlname='paiementtype', $filtertype='', $format=0, $empty=0, $noadmininfo=0, $maxlength=0, $active=1, $morecss='') + function select_types_paiements($selected='', $htmlname='paiementtype', $filtertype='', $format=0, $empty=1, $noadmininfo=0, $maxlength=0, $active=1, $morecss='') { global $langs,$user; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 083967935fa..f48f3d2c01d 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -655,7 +655,7 @@ if ($resql) if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) { print ''; - $form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 0, 1, 10); + $form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 1, 1, 10); print ''; } if (! empty($arrayfields['f.total_ht']['checked'])) diff --git a/htdocs/install/mysql/data/llx_c_paiement.sql b/htdocs/install/mysql/data/llx_c_paiement.sql index 49da0b37952..2e459cd12a7 100644 --- a/htdocs/install/mysql/data/llx_c_paiement.sql +++ b/htdocs/install/mysql/data/llx_c_paiement.sql @@ -30,13 +30,12 @@ -- Types paiement -- -insert into llx_c_paiement (id,code,libelle,type,active) values ( 1, '', '-', 2,1); +insert into llx_c_paiement (id,code,libelle,type,active) values ( 1, 'TIP', 'TIP', 2,0); insert into llx_c_paiement (id,code,libelle,type,active) values ( 2, 'VIR', 'Transfer', 2,1); insert into llx_c_paiement (id,code,libelle,type,active) values ( 3, 'PRE', 'Debit order', 2,1); insert into llx_c_paiement (id,code,libelle,type,active) values ( 4, 'LIQ', 'Cash', 2,1); insert into llx_c_paiement (id,code,libelle,type,active) values ( 6, 'CB', 'Credit card', 2,1); insert into llx_c_paiement (id,code,libelle,type,active) values ( 7, 'CHQ', 'Cheque', 2,1); -insert into llx_c_paiement (id,code,libelle,type,active) values ( 8, 'TIP', 'TIP', 2,0); insert into llx_c_paiement (id,code,libelle,type,active) values (50, 'VAD', 'Online payment', 2,0); insert into llx_c_paiement (id,code,libelle,type,active) values (51, 'TRA', 'Traite', 2,0); insert into llx_c_paiement (id,code,libelle,type,active) values (52, 'LCR', 'LCR', 2,0); diff --git a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql index 4b224477940..2b2bb6949d5 100644 --- a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql +++ b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql @@ -71,6 +71,7 @@ ALTER TABLE llx_expensereport_det ADD COLUMN docnumber varchar(128) after fk_exp ALTER TABLE llx_website_page ADD COLUMN aliasalt varchar(255) after pageurl; -- Add missing keys and primary key +DELETE FROM llx_c_paiement WHERE code = '' or code = '-' or id = 0; ALTER TABLE llx_c_paiement DROP INDEX uk_c_paiement; ALTER TABLE llx_c_paiement ADD UNIQUE INDEX uk_c_paiement_code(entity, code); ALTER TABLE llx_c_paiement CHANGE COLUMN id id INTEGER AUTO_INCREMENT PRIMARY KEY; From b9f1695b34875e0c2f4c26fa9b79dd47010a89d5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Mar 2018 19:25:05 +0100 Subject: [PATCH 14/22] NEW Upgrade of Stripe lib to 6.4.1 --- htdocs/includes/stripe/.travis.yml | 1 - htdocs/includes/stripe/build.php | 0 .../includes/stripe/data/ca-certificates.crt | 1113 +++++++---------- htdocs/includes/stripe/data/test.png | Bin 95 -> 0 bytes htdocs/includes/stripe/lib/AttachedObject.php | 43 - htdocs/includes/stripe/lib/Error/Base.php | 9 + htdocs/includes/stripe/lib/Error/Card.php | 13 +- .../includes/stripe/lib/ExternalAccount.php | 92 -- .../stripe/lib/HttpClient/ClientInterface.php | 4 +- .../stripe/lib/HttpClient/CurlClient.php | 208 +-- .../includes/stripe/lib/JsonSerializable.php | 18 - .../stripe/lib/Util/AutoPagingIterator.php | 6 +- .../stripe/lib/Util/RequestOptions.php | 28 +- htdocs/includes/stripe/lib/Util/Set.php | 4 +- htdocs/includes/stripe/lib/Util/Util.php | 134 +- htdocs/includes/stripe/tests/AccountTest.php | 300 ----- .../stripe/tests/ApiRequestorTest.php | 68 - .../stripe/tests/ApplePayDomainTest.php | 72 -- .../stripe/tests/ApplicationFeeRefundTest.php | 18 - .../stripe/tests/ApplicationFeeTest.php | 22 - .../stripe/tests/AuthenticationErrorTest.php | 16 - htdocs/includes/stripe/tests/BalanceTest.php | 15 - .../stripe/tests/BalanceTransactionTest.php | 13 - .../includes/stripe/tests/BankAccountTest.php | 32 - .../stripe/tests/BitcoinReceiverTest.php | 120 -- .../includes/stripe/tests/CardErrorTest.php | 41 - htdocs/includes/stripe/tests/ChargeTest.php | 204 --- .../includes/stripe/tests/CollectionTest.php | 105 -- .../includes/stripe/tests/CountrySpecTest.php | 31 - htdocs/includes/stripe/tests/CouponTest.php | 29 - .../includes/stripe/tests/CurlClientTest.php | 100 -- htdocs/includes/stripe/tests/CustomerTest.php | 278 ---- htdocs/includes/stripe/tests/DiscountTest.php | 31 - htdocs/includes/stripe/tests/DisputeTest.php | 96 -- htdocs/includes/stripe/tests/ErrorTest.php | 61 - .../stripe/tests/ExternalAccountTest.php | 30 - .../includes/stripe/tests/FileUploadTest.php | 44 - .../stripe/tests/InvalidRequestErrorTest.php | 26 - htdocs/includes/stripe/tests/InvoiceTest.php | 56 - htdocs/includes/stripe/tests/PayoutTest.php | 94 -- .../stripe/tests/PermissionsErrorTest.php | 22 - htdocs/includes/stripe/tests/PlanTest.php | 51 - htdocs/includes/stripe/tests/ProductTest.php | 158 --- .../stripe/tests/RateLimitErrorTest.php | 22 - .../includes/stripe/tests/RecipientTest.php | 112 -- htdocs/includes/stripe/tests/RefundTest.php | 131 -- .../stripe/tests/RequestOptionsTest.php | 69 - htdocs/includes/stripe/tests/SourceTest.php | 218 ---- .../stripe/tests/StripeObjectTest.php | 108 -- .../stripe/tests/SubscriptionItemTest.php | 38 - .../stripe/tests/SubscriptionTest.php | 132 -- htdocs/includes/stripe/tests/TestCase.php | 398 +++--- .../stripe/tests/ThreeDSecureTest.php | 46 - htdocs/includes/stripe/tests/TokenTest.php | 13 - .../stripe/tests/TransferReversalTest.php | 19 - htdocs/includes/stripe/tests/TransferTest.php | 46 - htdocs/includes/stripe/tests/UtilTest.php | 45 - .../stripe/tests/bootstrap.no_autoload.php | 3 +- htdocs/includes/stripe/tests/bootstrap.php | 40 + 59 files changed, 903 insertions(+), 4343 deletions(-) mode change 100755 => 100644 htdocs/includes/stripe/build.php delete mode 100644 htdocs/includes/stripe/data/test.png delete mode 100644 htdocs/includes/stripe/lib/AttachedObject.php delete mode 100644 htdocs/includes/stripe/lib/ExternalAccount.php delete mode 100644 htdocs/includes/stripe/lib/JsonSerializable.php delete mode 100644 htdocs/includes/stripe/tests/AccountTest.php delete mode 100644 htdocs/includes/stripe/tests/ApiRequestorTest.php delete mode 100644 htdocs/includes/stripe/tests/ApplePayDomainTest.php delete mode 100644 htdocs/includes/stripe/tests/ApplicationFeeRefundTest.php delete mode 100644 htdocs/includes/stripe/tests/ApplicationFeeTest.php delete mode 100644 htdocs/includes/stripe/tests/AuthenticationErrorTest.php delete mode 100644 htdocs/includes/stripe/tests/BalanceTest.php delete mode 100644 htdocs/includes/stripe/tests/BalanceTransactionTest.php delete mode 100644 htdocs/includes/stripe/tests/BankAccountTest.php delete mode 100644 htdocs/includes/stripe/tests/BitcoinReceiverTest.php delete mode 100644 htdocs/includes/stripe/tests/CardErrorTest.php delete mode 100644 htdocs/includes/stripe/tests/ChargeTest.php delete mode 100644 htdocs/includes/stripe/tests/CollectionTest.php delete mode 100644 htdocs/includes/stripe/tests/CountrySpecTest.php delete mode 100644 htdocs/includes/stripe/tests/CouponTest.php delete mode 100644 htdocs/includes/stripe/tests/CurlClientTest.php delete mode 100644 htdocs/includes/stripe/tests/CustomerTest.php delete mode 100644 htdocs/includes/stripe/tests/DiscountTest.php delete mode 100644 htdocs/includes/stripe/tests/DisputeTest.php delete mode 100644 htdocs/includes/stripe/tests/ErrorTest.php delete mode 100644 htdocs/includes/stripe/tests/ExternalAccountTest.php delete mode 100644 htdocs/includes/stripe/tests/FileUploadTest.php delete mode 100644 htdocs/includes/stripe/tests/InvalidRequestErrorTest.php delete mode 100644 htdocs/includes/stripe/tests/InvoiceTest.php delete mode 100644 htdocs/includes/stripe/tests/PayoutTest.php delete mode 100644 htdocs/includes/stripe/tests/PermissionsErrorTest.php delete mode 100644 htdocs/includes/stripe/tests/PlanTest.php delete mode 100644 htdocs/includes/stripe/tests/ProductTest.php delete mode 100644 htdocs/includes/stripe/tests/RateLimitErrorTest.php delete mode 100644 htdocs/includes/stripe/tests/RecipientTest.php delete mode 100644 htdocs/includes/stripe/tests/RefundTest.php delete mode 100644 htdocs/includes/stripe/tests/RequestOptionsTest.php delete mode 100644 htdocs/includes/stripe/tests/SourceTest.php delete mode 100644 htdocs/includes/stripe/tests/StripeObjectTest.php delete mode 100644 htdocs/includes/stripe/tests/SubscriptionItemTest.php delete mode 100644 htdocs/includes/stripe/tests/SubscriptionTest.php delete mode 100644 htdocs/includes/stripe/tests/ThreeDSecureTest.php delete mode 100644 htdocs/includes/stripe/tests/TokenTest.php delete mode 100644 htdocs/includes/stripe/tests/TransferReversalTest.php delete mode 100644 htdocs/includes/stripe/tests/TransferTest.php delete mode 100644 htdocs/includes/stripe/tests/UtilTest.php diff --git a/htdocs/includes/stripe/.travis.yml b/htdocs/includes/stripe/.travis.yml index 16526d9f853..d575ed51a7d 100644 --- a/htdocs/includes/stripe/.travis.yml +++ b/htdocs/includes/stripe/.travis.yml @@ -3,7 +3,6 @@ sudo: false language: php php: - - 5.3 - 5.4 - 5.5 - 5.6 diff --git a/htdocs/includes/stripe/build.php b/htdocs/includes/stripe/build.php old mode 100755 new mode 100644 diff --git a/htdocs/includes/stripe/data/ca-certificates.crt b/htdocs/includes/stripe/data/ca-certificates.crt index 1c4e5b22673..39ba33683c5 100644 --- a/htdocs/includes/stripe/data/ca-certificates.crt +++ b/htdocs/includes/stripe/data/ca-certificates.crt @@ -1,20 +1,20 @@ ## ## Bundle of CA Root Certificates ## -## Certificate data from Mozilla as of: Fri Jan 22 20:39:57 2016 +## Certificate data from Mozilla as of: Wed Sep 20 03:12:05 2017 GMT ## ## This is a bundle of X.509 certificates of public Certificate Authorities ## (CA). These were automatically extracted from Mozilla's root certificates ## file (certdata.txt). This file can be found in the mozilla source tree: -## http://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt +## https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt ## ## It contains the certificates in PEM format and therefore ## can be directly used with curl / libcurl / php_curl, or with ## an Apache+mod_ssl webserver for SSL client authentication. ## Just configure this file as the SSLCACertificateFile. ## -## Conversion done with mk-ca-bundle.pl version 1.25. -## SHA1: 0ab47e2f41518f8d223eab517cb799e5b071231e +## Conversion done with mk-ca-bundle.pl version 1.27. +## SHA256: 2b2dbe5244e0047e088c597998883a913f6c5fffd1cb5c0fe5a368c8466cb2ec ## @@ -130,30 +130,6 @@ Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp -----END CERTIFICATE----- -AddTrust Low-Value Services Root -================================ ------BEGIN CERTIFICATE----- -MIIEGDCCAwCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQGEwJTRTEUMBIGA1UEChML -QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSEwHwYDVQQDExhBZGRU -cnVzdCBDbGFzcyAxIENBIFJvb3QwHhcNMDAwNTMwMTAzODMxWhcNMjAwNTMwMTAzODMxWjBlMQsw -CQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBO -ZXR3b3JrMSEwHwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3QwggEiMA0GCSqGSIb3DQEB -AQUAA4IBDwAwggEKAoIBAQCWltQhSWDia+hBBwzexODcEyPNwTXH+9ZOEQpnXvUGW2ulCDtbKRY6 -54eyNAbFvAWlA3yCyykQruGIgb3WntP+LVbBFc7jJp0VLhD7Bo8wBN6ntGO0/7Gcrjyvd7ZWxbWr -oulpOj0OM3kyP3CCkplhbY0wCI9xP6ZIVxn4JdxLZlyldI+Yrsj5wAYi56xz36Uu+1LcsRVlIPo1 -Zmne3yzxbrww2ywkEtvrNTVokMsAsJchPXQhI2U0K7t4WaPW4XY5mqRJjox0r26kmqPZm9I4XJui -GMx1I4S+6+JNM3GOGvDC+Mcdoq0Dlyz4zyXG9rgkMbFjXZJ/Y/AlyVMuH79NAgMBAAGjgdIwgc8w -HQYDVR0OBBYEFJWxtPCUtr3H2tERCSG+wa9J/RB7MAsGA1UdDwQEAwIBBjAPBgNVHRMBAf8EBTAD -AQH/MIGPBgNVHSMEgYcwgYSAFJWxtPCUtr3H2tERCSG+wa9J/RB7oWmkZzBlMQswCQYDVQQGEwJT -RTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSEw -HwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBACxt -ZBsfzQ3duQH6lmM0MkhHma6X7f1yFqZzR1r0693p9db7RcwpiURdv0Y5PejuvE1Uhh4dbOMXJ0Ph -iVYrqW9yTkkz43J8KiOavD7/KCrto/8cI7pDVwlnTUtiBi34/2ydYB7YHEt9tTEv2dB8Xfjea4MY -eDdXL+gzB2ffHsdrKpV2ro9Xo/D0UrSpUwjP4E/TelOL/bscVjby/rK25Xa71SJlpz/+0WatC7xr -mYbvP33zGDLKe8bjq2RGlfgmadlVg3sslgf/WSxEo8bl6ancoWOAWiFeIc9TVPC6b4nbqKqVz4vj -ccweGyBECMB6tkD9xOQ14R0WHNC8K47Wcdk= ------END CERTIFICATE----- - AddTrust External Root ====================== -----BEGIN CERTIFICATE----- @@ -178,54 +154,6 @@ e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEXc4g/VhsxOBi0cQ+azcgOno4u G+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ= -----END CERTIFICATE----- -AddTrust Public Services Root -============================= ------BEGIN CERTIFICATE----- -MIIEFTCCAv2gAwIBAgIBATANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQGEwJTRTEUMBIGA1UEChML -QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSAwHgYDVQQDExdBZGRU -cnVzdCBQdWJsaWMgQ0EgUm9vdDAeFw0wMDA1MzAxMDQxNTBaFw0yMDA1MzAxMDQxNTBaMGQxCzAJ -BgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQIE5l -dHdvcmsxIDAeBgNVBAMTF0FkZFRydXN0IFB1YmxpYyBDQ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------END CERTIFICATE----- - -AddTrust Qualified Certificates Root -==================================== ------BEGIN CERTIFICATE----- -MIIEHjCCAwagAwIBAgIBATANBgkqhkiG9w0BAQUFADBnMQswCQYDVQQGEwJTRTEUMBIGA1UEChML -QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSMwIQYDVQQDExpBZGRU -cnVzdCBRdWFsaWZpZWQgQ0EgUm9vdDAeFw0wMDA1MzAxMDQ0NTBaFw0yMDA1MzAxMDQ0NTBaMGcx -CzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQ -IE5ldHdvcmsxIzAhBgNVBAMTGkFkZFRydXN0IFF1YWxpZmllZCBDQSBSb290MIIBIjANBgkqhkiG -9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5B6a/twJWoekn0e+EV+vhDTbYjx5eLfpMLXsDBwqxBb/4Oxx -64r1EW7tTw2R0hIYLUkVAcKkIhPHEWT/IhKauY5cLwjPcWqzZwFZ8V1G87B4pfYOQnrjfxvM0PC3 -KP0q6p6zsLkEqv32x7SxuCqg+1jxGaBvcCV+PmlKfw8i2O+tCBGaKZnhqkRFmhJePp1tUvznoD1o -L/BLcHwTOK28FSXx1s6rosAx1i+f4P8UWfyEk9mHfExUE+uf0S0R+Bg6Ot4l2ffTQO2kBhLEO+GR -wVY18BTcZTYJbqukB8c10cIDMzZbdSZtQvESa0NvS3GU+jQd7RNuyoB/mC9suWXY6QIDAQABo4HU -MIHRMB0GA1UdDgQWBBQ5lYtii1zJ1IC6WA+XPxUIQ8yYpzALBgNVHQ8EBAMCAQYwDwYDVR0TAQH/ -BAUwAwEB/zCBkQYDVR0jBIGJMIGGgBQ5lYtii1zJ1IC6WA+XPxUIQ8yYp6FrpGkwZzELMAkGA1UE -BhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMR0wGwYDVQQLExRBZGRUcnVzdCBUVFAgTmV0d29y -azEjMCEGA1UEAxMaQWRkVHJ1c3QgUXVhbGlmaWVkIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQAD -ggEBABmrder4i2VhlRO6aQTvhsoToMeqT2QbPxj2qC0sVY8FtzDqQmodwCVRLae/DLPt7wh/bDxG -GuoYQ992zPlmhpwsaPXpF/gxsxjE1kh9I0xowX67ARRvxdlu3rsEQmr49lx95dr6h+sNNVJn0J6X -dgWTP5XHAeZpVTh/EGGZyeNfpso+gmNIquIISD6q8rKFYqa0p9m9N5xotS1WfbC3P6CxB9bpT9ze -RXEwMn8bLgn5v1Kh7sKAPgZcLlVAwRv1cEWw3F369nJad9Jjzc9YiQBCYz95OdBEsIJuQRno3eDB -iFrRHnGTHyQwdOUeqN48Jzd/g66ed8/wMLH/S5noxqE= ------END CERTIFICATE----- - Entrust Root Certification Authority ==================================== -----BEGIN CERTIFICATE----- @@ -252,27 +180,6 @@ W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0 tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8 -----END CERTIFICATE----- -RSA Security 2048 v3 -==================== ------BEGIN CERTIFICATE----- -MIIDYTCCAkmgAwIBAgIQCgEBAQAAAnwAAAAKAAAAAjANBgkqhkiG9w0BAQUFADA6MRkwFwYDVQQK -ExBSU0EgU2VjdXJpdHkgSW5jMR0wGwYDVQQLExRSU0EgU2VjdXJpdHkgMjA0OCBWMzAeFw0wMTAy -MjIyMDM5MjNaFw0yNjAyMjIyMDM5MjNaMDoxGTAXBgNVBAoTEFJTQSBTZWN1cml0eSBJbmMxHTAb -BgNVBAsTFFJTQSBTZWN1cml0eSAyMDQ4IFYzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC -AQEAt49VcdKA3XtpeafwGFAyPGJn9gqVB93mG/Oe2dJBVGutn3y+Gc37RqtBaB4Y6lXIL5F4iSj7 -Jylg/9+PjDvJSZu1pJTOAeo+tWN7fyb9Gd3AIb2E0S1PRsNO3Ng3OTsor8udGuorryGlwSMiuLgb -WhOHV4PR8CDn6E8jQrAApX2J6elhc5SYcSa8LWrg903w8bYqODGBDSnhAMFRD0xS+ARaqn1y07iH -KrtjEAMqs6FPDVpeRrc9DvV07Jmf+T0kgYim3WBU6JU2PcYJk5qjEoAAVZkZR73QpXzDuvsf9/UP -+Ky5tfQ3mBMY3oVbtwyCO4dvlTlYMNpuAWgXIszACwIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/ -MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQHw1EwpKrpRa41JPr/JCwz0LGdjDAdBgNVHQ4E -FgQUB8NRMKSq6UWuNST6/yQsM9CxnYwwDQYJKoZIhvcNAQEFBQADggEBAF8+hnZuuDU8TjYcHnmY -v/3VEhF5Ug7uMYm83X/50cYVIeiKAVQNOvtUudZj1LGqlk2iQk3UUx+LEN5/Zb5gEydxiKRz44Rj -0aRV4VCT5hsOedBnvEbIvz8XDZXmxpBp3ue0L96VfdASPz0+f00/FGj1EVDVwfSQpQgdMWD/YIwj -VAqv/qFuxdF6Kmh4zx6CCiC0H63lhbJqaHVOrSU3lIW+vaHU6rcMSzyd6BIA8F+sDeGscGNz9395 -nzIlQnQFgCi/vcEkllgVsRch6YlL2weIZ/QVrXA+L02FO8K32/6YaCOJ4XQP3vTFhGMpG8zLB8kA -pKnXwiJPZ9d37CAFYd4= ------END CERTIFICATE----- - GeoTrust Global CA ================== -----BEGIN CERTIFICATE----- @@ -294,27 +201,6 @@ XE0zX5IJL4hmXXeXxx12E6nV5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvm Mw== -----END CERTIFICATE----- -GeoTrust Global CA 2 -==================== ------BEGIN CERTIFICATE----- -MIIDZjCCAk6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBEMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN -R2VvV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fNWpHSlaY0VqF -H4z1Ir+rzoPz4iIprn2DQKi6bA== ------END CERTIFICATE----- - GeoTrust Universal CA ===================== -----BEGIN CERTIFICATE----- @@ -440,56 +326,6 @@ Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z 12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg== -----END CERTIFICATE----- -Comodo Secure Services root -=========================== ------BEGIN CERTIFICATE----- -MIIEPzCCAyegAwIBAgIBATANBgkqhkiG9w0BAQUFADB+MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS -R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg -TGltaXRlZDEkMCIGA1UEAwwbU2VjdXJlIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAw -MDAwMFoXDTI4MTIzMTIzNTk1OVowfjELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFu -Y2hlc3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxJDAi -BgNVBAMMG1NlY3VyZSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEP -ADCCAQoCggEBAMBxM4KK0HDrc4eCQNUd5MvJDkKQ+d40uaG6EfQlhfPMcm3ye5drswfxdySRXyWP -9nQ95IDC+DwN879A6vfIUtFyb+/Iq0G4bi4XKpVpDM3SHpR7LZQdqnXXs5jLrLxkU0C8j6ysNstc -rbvd4JQX7NFc0L/vpZXJkMWwrPsbQ996CF23uPJAGysnnlDOXmWCiIxe004MeuoIkbY2qitC++rC -oznl2yY4rYsK7hljxxwk3wN42ubqwUcaCwtGCd0C/N7Lh1/XMGNooa7cMqG6vv5Eq2i2pRcV/b3V -p6ea5EQz6YiO/O1R65NxTq0B50SOqy3LqP4BSUjwwN3HaNiS/j0CAwEAAaOBxzCBxDAdBgNVHQ4E -FgQUPNiTiMLAggnMAZkGkyDpnnAJY08wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w -gYEGA1UdHwR6MHgwO6A5oDeGNWh0dHA6Ly9jcmwuY29tb2RvY2EuY29tL1NlY3VyZUNlcnRpZmlj -YXRlU2VydmljZXMuY3JsMDmgN6A1hjNodHRwOi8vY3JsLmNvbW9kby5uZXQvU2VjdXJlQ2VydGlm -aWNhdGVTZXJ2aWNlcy5jcmwwDQYJKoZIhvcNAQEFBQADggEBAIcBbSMdflsXfcFhMs+P5/OKlFlm -4J4oqF7Tt/Q05qo5spcWxYJvMqTpjOev/e/C6LlLqqP05tqNZSH7uoDrJiiFGv45jN5bBAS0VPmj -Z55B+glSzAVIqMk/IQQezkhr/IXownuvf7fM+F86/TXGDe+X3EyrEeFryzHRbPtIgKvcnDe4IRRL -DXE97IMzbtFuMhbsmMcWi1mmNKsFVy2T96oTy9IT4rcuO81rUBcJaD61JlfutuC23bkpgHl9j6Pw -pCikFcSF9CfUa7/lXORlAnZUtOM3ZiTTGWHIUhDlizeauan5Hb/qmZJhlv8BzaFfDbxxvA6sCx1H -RR3B7Hzs/Sk= ------END CERTIFICATE----- - -Comodo Trusted Services root -============================ ------BEGIN CERTIFICATE----- -MIIEQzCCAyugAwIBAgIBATANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS -R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg -TGltaXRlZDElMCMGA1UEAwwcVHJ1c3RlZCBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczAeFw0wNDAxMDEw -MDAwMDBaFw0yODEyMzEyMzU5NTlaMH8xCzAJBgNVBAYTAkdCMRswGQYDVQQIDB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5QoNE+xqFx7D+gIIxmOom0jtTYsU0l -R+4viMi14QVFwL4Ucd56/Y57fU0IlqUSc/AtyjcndBInTMu2l+nZrghtWjlA3QVHdWpaIbOjGM9O -9y5Xt5hwXsjEeLBi ------END CERTIFICATE----- - QuoVadis Root CA ================ -----BEGIN CERTIFICATE----- @@ -629,54 +465,6 @@ EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH llpwrN9M -----END CERTIFICATE----- -Staat der Nederlanden Root CA -============================= ------BEGIN CERTIFICATE----- -MIIDujCCAqKgAwIBAgIEAJiWijANBgkqhkiG9w0BAQUFADBVMQswCQYDVQQGEwJOTDEeMBwGA1UE -ChMVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSYwJAYDVQQDEx1TdGFhdCBkZXIgTmVkZXJsYW5kZW4g -Um9vdCBDQTAeFw0wMjEyMTcwOTIzNDlaFw0xNTEyMTYwOTE1MzhaMFUxCzAJBgNVBAYTAk5MMR4w -HAYDVQQKExVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xJjAkBgNVBAMTHVN0YWF0IGRlciBOZWRlcmxh -bmRlbiBSb290IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmNK1URF6gaYUmHFt -vsznExvWJw56s2oYHLZhWtVhCb/ekBPHZ+7d89rFDBKeNVU+LCeIQGv33N0iYfXCxw719tV2U02P -jLwYdjeFnejKScfST5gTCaI+Ioicf9byEGW07l8Y1Rfj+MX94p2i71MOhXeiD+EwR+4A5zN9RGca -C1Hoi6CeUJhoNFIfLm0B8mBF8jHrqTFoKbt6QZ7GGX+UtFE5A3+y3qcym7RHjm+0Sq7lr7HcsBth -vJly3uSJt3omXdozSVtSnA71iq3DuD3oBmrC1SoLbHuEvVYFy4ZlkuxEK7COudxwC0barbxjiDn6 -22r+I/q85Ej0ZytqERAhSQIDAQABo4GRMIGOMAwGA1UdEwQFMAMBAf8wTwYDVR0gBEgwRjBEBgRV -HSAAMDwwOgYIKwYBBQUHAgEWLmh0dHA6Ly93d3cucGtpb3ZlcmhlaWQubmwvcG9saWNpZXMvcm9v -dC1wb2xpY3kwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSofeu8Y6R0E3QA7Jbg0zTBLL9s+DAN -BgkqhkiG9w0BAQUFAAOCAQEABYSHVXQ2YcG70dTGFagTtJ+k/rvuFbQvBgwp8qiSpGEN/KtcCFtR -EytNwiphyPgJWPwtArI5fZlmgb9uXJVFIGzmeafR2Bwp/MIgJ1HI8XxdNGdphREwxgDS1/PTfLbw -MVcoEoJz6TMvplW0C5GUR5z6u3pCMuiufi3IvKwUv9kP2Vv8wfl6leF9fpb8cbDCTMjfRTTJzg3y -nGQI0DvDKcWy7ZAEwbEpkcUwb8GpcjPM/l0WFywRaed+/sWDCN+83CI6LiBpIzlWYGeQiy52OfsR -iJf2fL1LuCAWZwWN4jvBcj+UlTfHXbme2JOhF4//DGYVwSR8MnwDHTuhWEUykw== ------END CERTIFICATE----- - -UTN USERFirst Hardware Root CA -============================== ------BEGIN CERTIFICATE----- -MIIEdDCCA1ygAwIBAgIQRL4Mi1AAJLQR0zYq/mUK/TANBgkqhkiG9w0BAQUFADCBlzELMAkGA1UE -BhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0eTEeMBwGA1UEChMVVGhl -IFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xHzAd -BgNVBAMTFlVUTi1VU0VSRmlyc3QtSGFyZHdhcmUwHhcNOTkwNzA5MTgxMDQyWhcNMTkwNzA5MTgx -OTIyWjCBlzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0 -eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHR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0qUZ6B+dQ7XnASfxAynB67 -nfhmqA== ------END CERTIFICATE----- - Camerfirma Chambers of Commerce Root ==================================== -----BEGIN CERTIFICATE----- @@ -731,41 +519,6 @@ IBHNfTIzSJRUTN3cecQwn+uOuFW114hcxWokPbLTBQNRxgfvzBRydD1ucs4YKIxKoHflCStFREes t2d/AYoFWpO+ocH/+OcOZ6RHSXZddZAa9SaP8A== -----END CERTIFICATE----- -NetLock Notary (Class A) Root -============================= ------BEGIN CERTIFICATE----- -MIIGfTCCBWWgAwIBAgICAQMwDQYJKoZIhvcNAQEEBQAwga8xCzAJBgNVBAYTAkhVMRAwDgYDVQQI -EwdIdW5nYXJ5MREwDwYDVQQHEwhCdWRhcGVzdDEnMCUGA1UEChMeTmV0TG9jayBIYWxvemF0Yml6 -dG9uc2FnaSBLZnQuMRowGAYDVQQLExFUYW51c2l0dmFueWtpYWRvazE2MDQGA1UEAxMtTmV0TG9j -ayBLb3pqZWd5em9pIChDbGFzcyBBKSBUYW51c2l0dmFueWtpYWRvMB4XDTk5MDIyNDIzMTQ0N1oX -DTE5MDIxOTIzMTQ0N1owga8xCzAJBgNVBAYTAkhVMRAwDgYDVQQIEwdIdW5nYXJ5MREwDwYDVQQH -EwhCdWRhcGVzdDEnMCUGA1UEChMeTmV0TG9jayBIYWxvemF0Yml6dG9uc2FnaSBLZnQuMRowGAYD -VQQLExFUYW51c2l0dmFueWtpYWRvazE2MDQGA1UEAxMtTmV0TG9jayBLb3pqZWd5em9pIChDbGFz -cyBBKSBUYW51c2l0dmFueWtpYWRvMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvHSM -D7tM9DceqQWC2ObhbHDqeLVu0ThEDaiDzl3S1tWBxdRL51uUcCbbO51qTGL3cfNk1mE7PetzozfZ -z+qMkjvN9wfcZnSX9EUi3fRc4L9t875lM+QVOr/bmJBVOMTtplVjC7B4BPTjbsE/jvxReB+SnoPC -/tmwqcm8WgD/qaiYdPv2LD4VOQ22BFWoD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hdCBjcHNAbmV0bG9jay5uZXQuMA0GCSqGSIb3DQEBBAUAA4IBAQBIJEb3ulZv+sgoA0BO5TE5 -ayZrU3/b39/zcT0mwBQOxmd7I6gMc90Bu8bKbjc5VdXHjFYgDigKDtIqpLBJUsY4B/6+CgmM0ZjP -ytoUMaFP0jn8DxEsQ8Pdq5PHVT5HfBgaANzze9jyf1JsIPQLX2lS9O74silg6+NJMSEN1rUQQeJB -CWziGppWS3cC9qCbmieH6FUpccKQn0V4GuEVZD3QDtigdp+uxdAu6tYPVuxkf1qbFFgBJ34TUMdr -KuZoPL9coAob4Q566eKAw+np9v1sEZ7Q5SgnK1QyQhSCdeZK8CtmdWOMovsEPoMOmzbwGOQmIMOM -8CgHrTwXZoi1/baI ------END CERTIFICATE----- - XRamp Global CA Root ==================== -----BEGIN CERTIFICATE----- @@ -909,38 +662,6 @@ CZBUkQM8R+XVyWXgt0t97EfTsws+rZ7QdAAO671RrcDeLMDDav7v3Aun+kbfYNucpllQdSNpc5Oy +fwC00fmcc4QAu4njIT/rEUNE1yDMuAlpYYsfPQS -----END CERTIFICATE----- -Swisscom Root CA 1 -================== ------BEGIN CERTIFICATE----- -MIIF2TCCA8GgAwIBAgIQXAuFXAvnWUHfV8w/f52oNjANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQG -EwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsTHERpZ2l0YWwgQ2VydGlmaWNhdGUgU2Vy -dmljZXMxGzAZBgNVBAMTElN3aXNzY29tIFJvb3QgQ0EgMTAeFw0wNTA4MTgxMjA2MjBaFw0yNTA4 -MTgyMjA2MjBaMGQxCzAJBgNVBAYTAmNoMREwDwYDVQQKEwhTd2lzc2NvbTElMCMGA1UECxMcRGln -aXRhbCBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczEbMBkGA1UEAxMSU3dpc3Njb20gUm9vdCBDQSAxMIIC -IjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0LmwqAzZu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xn9KVuj7QG9YVHaO+htXbD8BJZLsuUBlL0iT43R4H -VtA4oJVwIHaM190e3p9xxCPvgxNcoyQVTSlAPGrEqdi3pkSlDfTgnXceQHAm/NrZNuR55LU/vJtl -vrsRls/bxig5OgjOR1tTWsWZ/l2p3e9M1MalrQLmjAcSHm8D0W+go/MpvRLHUKKwf4ipmXeascCl -OS5cfGniLLDqN2qk4Vrh9VDlg++luyqI54zb/W1elxmofmZ1a3Hqv7HHb6D0jqTsNFFbjCYDcKF3 -1QESVwA12yPeDooomf2xEG9L/zgtYE4snOtnta1J7ksfrK/7DZBaZmBwXarNeNQk7shBoJMBkpxq -nvy5JMWzFYJ+vq6VK+uxwNrjAWALXmmshFZhvnEX/h0TD/7Gh0Xp/jKgGg0TpJRVcaUWi7rKibCy -x/yP2FS1k2Kdzs9Z+z0YzirLNRWCXf9UIltxUvu3yf5gmwBBZPCqKuy2QkPOiWaByIufOVQDJdMW -NY6E0F/6MBr1mmz0DlP5OlvRHA== ------END CERTIFICATE----- - DigiCert Assured ID Root CA =========================== -----BEGIN CERTIFICATE----- @@ -1298,33 +1019,6 @@ wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHNpGxlaKFJdlxD ydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey -----END CERTIFICATE----- -WellsSecure Public Root Certificate Authority -============================================= ------BEGIN CERTIFICATE----- -MIIEvTCCA6WgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoM -F1dlbGxzIEZhcmdvIFdlbGxzU2VjdXJlMRwwGgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYw -NAYDVQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcN -MDcxMjEzMTcwNzU0WhcNMjIxMjE0MDAwNzU0WjCBhTELMAkGA1UEBhMCVV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Na5U3lHshPcZeG1eMd/ZDJPHV3V3p9+N701NX3leZ0 -bh08rnyd2wIDBSxxSyU+B+NemvVmFymIGjifz6pBA4SXa5M4esowRBskRDPQ5NHcKDj0E0M1NSlj -qHyita04pO2t/caaH/+Xc/77szWnk4bGdpEA5qxRFsQnMlzbc9qlk1eOPm01JghZ1edE13YgY+es -E2fDbbFwRnzVlhE9iW9dqKHrjQrawx0zbKPqZxmamX9LPYNRKh3KL4YMon4QLSvUFpULB6ouFJJJ -tylv2G0xffX8oRAHh84vWdw+WNs= ------END CERTIFICATE----- - COMODO ECC Certification Authority ================================== -----BEGIN CERTIFICATE----- @@ -1342,30 +1036,6 @@ FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY= -----END CERTIFICATE----- -IGC/A -===== ------BEGIN CERTIFICATE----- -MIIEAjCCAuqgAwIBAgIFORFFEJQwDQYJKoZIhvcNAQEFBQAwgYUxCzAJBgNVBAYTAkZSMQ8wDQYD -VQQIEwZGcmFuY2UxDjAMBgNVBAcTBVBhcmlzMRAwDgYDVQQKEwdQTS9TR0ROMQ4wDAYDVQQLEwVE -Q1NTSTEOMAwGA1UEAxMFSUdDL0ExIzAhBgkqhkiG9w0BCQEWFGlnY2FAc2dkbi5wbS5nb3V2LmZy -MB4XDTAyMTIxMzE0MjkyM1oXDTIwMTAxNzE0MjkyMlowgYUxCzAJBgNVBAYTAkZSMQ8wDQYDVQQI -EwZGcmFuY2UxDjAMBgNVBAcTBVBhcmlzMRAwDgYDVQQKEwdQTS9TR0ROMQ4wDAYDVQQLEwVEQ1NT -STEOMAwGA1UEAxMFSUdDL0ExIzAhBgkqhkiG9w0BCQEWFGlnY2FAc2dkbi5wbS5nb3V2LmZyMIIB -IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsh/R0GLFMzvABIaIs9z4iPf930Pfeo2aSVz2 -TqrMHLmh6yeJ8kbpO0px1R2OLc/mratjUMdUC24SyZA2xtgv2pGqaMVy/hcKshd+ebUyiHDKcMCW -So7kVc0dJ5S/znIq7Fz5cyD+vfcuiWe4u0dzEvfRNWk68gq5rv9GQkaiv6GFGvm/5P9JhfejcIYy -HF2fYPepraX/z9E0+X1bF8bc1g4oa8Ld8fUzaJ1O/Id8NhLWo4DoQw1VYZTqZDdH6nfK0LJYBcNd -frGoRpAxVs5wKpayMLh35nnAvSk7/ZR3TL0gzUEl4C7HG7vupARB0l2tEmqKm0f7yd1GQOGdPDPQ -tQIDAQABo3cwdTAPBgNVHRMBAf8EBTADAQH/MAsGA1UdDwQEAwIBRjAVBgNVHSAEDjAMMAoGCCqB -egF5AQEBMB0GA1UdDgQWBBSjBS8YYFDCiQrdKyFP/45OqDAxNjAfBgNVHSMEGDAWgBSjBS8YYFDC -iQrdKyFP/45OqDAxNjANBgkqhkiG9w0BAQUFAAOCAQEABdwm2Pp3FURo/C9mOnTgXeQp/wYHE4RK -q89toB9RlPhJy3Q2FLwV3duJL92PoF189RLrn544pEfMs5bZvpwlqwN+Mw+VgQ39FuCIvjfwbF3Q -MZsyK10XZZOYYLxuj7GoPB7ZHPOpJkL5ZB3C55L29B5aqhlSXa/oovdgoPaN8In1buAKBQGVyYsg -Crpa/JosPL3Dt8ldeCUFP1YUmwza+zpI/pdpXsoQhvdOlgQITeywvl3cO45Pwf2aNjSaTFR+FwNI -lQgRHAdvhQh+XU3Endv7rs6y0bO4g2wdsrN58dhwmX7wEwLOXt1R0982gaEbeC9xs/FZTEYYKKuF -0mBWWg== ------END CERTIFICATE----- - Security Communication EV RootCA1 ================================= -----BEGIN CERTIFICATE----- @@ -1410,46 +1080,6 @@ hNVQA7bihKOmNqoROgHhGEvWRGizPflTdISzRpFGlgC3gCy24eMQ4tui5yiPAZZiFj4A4xylNoEY okxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ/L7fCg0= -----END CERTIFICATE----- -Microsec e-Szigno Root CA -========================= ------BEGIN CERTIFICATE----- -MIIHqDCCBpCgAwIBAgIRAMy4579OKRr9otxmpRwsDxEwDQYJKoZIhvcNAQEFBQAwcjELMAkGA1UE -BhMCSFUxETAPBgNVBAcTCEJ1ZGFwZXN0MRYwFAYDVQQKEw1NaWNyb3NlYyBMdGQuMRQwEgYDVQQL -EwtlLVN6aWdubyBDQTEiMCAGA1UEAxMZTWljcm9zZWMgZS1Temlnbm8gUm9vdCBDQTAeFw0wNTA0 -MDYxMjI4NDRaFw0xNzA0MDYxMjI4NDRaMHIxCzAJBgNVBAYTAkhVMREwDwYDVQQHEwhCdWRhcGVz -dDEWMBQGA1UEChMNTWljcm9zZWMgTHRkLjEUMBIGA1UECxMLZS1Temlnbm8gQ0ExIjAgBgNVBAMT -GU1pY3Jvc2VjIGUtU3ppZ25vIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB -AQDtyADVgXvNOABHzNuEwSFpLHSQDCHZU4ftPkNEU6+r+ICbPHiN1I2uuO/TEdyB5s87lozWbxXG -d36hL+BfkrYn13aaHUM86tnsL+4582pnS4uCzyL4ZVX+LMsvfUh6PXX5qqAnu3jCBspRwn5mS6/N -oqdNAoI/gqyFxuEPkEeZlApxcpMqyabAvjxWTHOSJ/FrtfX9/DAFYJLG65Z+AZHCabEeHXtTRbjc -QR/Ji3HWVBTji1R4P770Yjtb9aPs1ZJ04nQw7wHb4dSrmZsqa/i9phyGI0Jf7Enemotb9HI6QMVJ -PqW+jqpx62z69Rrkav17fVVA71hu5tnVvCSrwe+3AgMBAAGjggQ3MIIEMzBnBggrBgEFBQcBAQRb -MFkwKAYIKwYBBQUHMAGGHGh0dHBzOi8vcmNhLmUtc3ppZ25vLmh1L29jc3AwLQYIKwYBBQUHMAKG -IWh0dHA6Ly93d3cuZS1zemlnbm8uaHUvUm9vdENBLmNydDAPBgNVHRMBAf8EBTADAQH/MIIBcwYD -VR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VQQGEwJIVTER -MA8GA1UEBxMIQnVkYXBlc3QxFjAUBgNVBAoTDU1pY3Jvc2VjIEx0ZC4xFDASBgNVBAsTC2UtU3pp -Z25vIENBMSIwIAYDVQQDExlNaWNyb3NlYyBlLVN6aWdubyBSb290IENBghEAzLjnv04pGv2i3Gal -HCwPETAdBgNVHQ4EFgQUx6BJdRZhhNsxS4TS8TdAkO9O3PcwDQYJKoZIhvcNAQEFBQADggEBANMT -nGZjWS7KXHAM/IO8VbH0jgdsZifOwTsgqRy7RlRw7lrMoHfqaEQn6/Ip3Xep1fvj1KcExJW4C+FE -aGAHQzAxQmHl7tnlJNUb3+FKG6qfx1/4ehHqE5MAyopYse7tDk2016g2JnzgOsHVV4Lxdbb9iV/a -86g4nzUGCM4ilb7N1fy+W955a9x6qWVmvrElWl/tftOsRm1M9DKHtCAE4Gx4sHfRhUZLphK3dehK -yVZs15KrnfVJONJPU+NVkBHbmJbGSfI+9J8b4PeI3CVimUTYc78/MPMMNz7UwiiAc7EBt51alhQB -S6kRnSlqLtBdgcDPsiBDxwPgN05dCtxZICU= ------END CERTIFICATE----- - Certigna ======== -----BEGIN CERTIFICATE----- @@ -1575,58 +1205,6 @@ LBOhgLJeDEoTniDYYkCrkOpkSi+sDQESeUWoL4cZaMjihccwsnX5OD+ywJO0a+IDRM5noN+J1q2M dqMTw5RhK2vZbMEHCiIHhWyFJEapvj+LeISCfiQMnf2BN+MlqO02TpUsyZyQ2uypQjyttgI= -----END CERTIFICATE----- -Buypass Class 2 CA 1 -==================== ------BEGIN CERTIFICATE----- -MIIDUzCCAjugAwIBAgIBATANBgkqhkiG9w0BAQUFADBLMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU -QnV5cGFzcyBBUy05ODMxNjMzMjcxHTAbBgNVBAMMFEJ1eXBhc3MgQ2xhc3MgMiBDQSAxMB4XDTA2 -MTAxMzEwMjUwOVoXDTE2MTAxMzEwMjUwOVowSzELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBh -c3MgQVMtOTgzMTYzMzI3MR0wGwYDVQQDDBRCdXlwYXNzIENsYXNzIDIgQ0EgMTCCASIwDQYJKoZI -hvcNAQEBBQADggEPADCCAQoCggEBAIs8B0XY9t/mx8q6jUPFR42wWsE425KEHK8T1A9vNkYgxC7M -cXA0ojTTNy7Y3Tp3L8DrKehc0rWpkTSHIln+zNvnma+WwajHQN2lFYxuyHyXA8vmIPLXl18xoS83 -0r7uvqmtqEyeIWZDO6i88wmjONVZJMHCR3axiFyCO7srpgTXjAePzdVBHfCuuCkslFJgNJQ72uA4 -0Z0zPhX0kzLFANq1KWYOOngPIVJfAuWSeyXTkh4vFZ2B5J2O6O+JzhRMVB0cgRJNcKi+EAUXfh/R -uFdV7c27UsKwHnjCTTZoy1YmwVLBvXb3WNVyfh9EdrsAiR0WnVE1703CVu9r4Iw7DekCAwEAAaNC -MEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUP42aWYv8e3uco684sDntkHGA1sgwDgYDVR0P -AQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQAVGn4TirnoB6NLJzKyQJHyIdFkhb5jatLPgcIV -1Xp+DCmsNx4cfHZSldq1fyOhKXdlyTKdqC5Wq2B2zha0jX94wNWZUYN/Xtm+DKhQ7SLHrQVMdvvt -7h5HZPb3J31cKA9FxVxiXqaakZG3Uxcu3K1gnZZkOb1naLKuBctN518fV4bVIJwo+28TOPX2EZL2 -fZleHwzoq0QkKXJAPTZSr4xYkHPB7GEseaHsh7U/2k3ZIQAw3pDaDtMaSKk+hQsUi4y8QZ5q9w5w -wDX3OaJdZtB7WZ+oRxKaJyOkLY4ng5IgodcVf/EuGO70SH8vf/GhGLWhC5SgYiAynB321O+/TIho ------END CERTIFICATE----- - -EBG Elektronik Sertifika Hizmet Sa\xC4\x9Flay\xc4\xb1\x63\xc4\xb1s\xc4\xb1 -========================================================================== ------BEGIN CERTIFICATE----- -MIIF5zCCA8+gAwIBAgIITK9zQhyOdA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XieqWfo1IhR5kX9tUoqzVegJ5a9KK8GfaZXINFHDk6Y54jzJ0fFfy1tb0 -Nokb+Clsi7n2l9GkLqq+CxnCRelwXQIDAJ3Zo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB -/wQEAwIBBjAdBgNVHQ4EFgQU587GT/wWZ5b6SqMHwQSny2re2kcwHwYDVR0jBBgwFoAU587GT/wW -Z5b6SqMHwQSny2re2kcwDQYJKoZIhvcNAQEFBQADggIBAJuYml2+8ygjdsZs93/mQJ7ANtyVDR2t -FcU22NU57/IeIl6zgrRdu0waypIN30ckHrMk2pGI6YNw3ZPX6bqz3xZaPt7gyPvT/Wwp+BVGoGgm -zJNSroIBk5DKd8pNSe/iWtkqvTDOTLKBtjDOWU/aWR1qeqRFsIImgYZ29fUQALjuswnoT4cCB64k -XPBfrAowzIpAoHMEwfuJJPaaHFy3PApnNgUIMbOv2AFoKuB4j3TeuFGkjGwgPaL7s9QJ/XvCgKqT -bCmYIai7FvOpEl90tYeY8pUm3zTvilORiF0alKM/fCL414i6poyWqD1SNGKfAB5UVUJnxk1Gj7sU -RT0KlhaOEKGXmdXTMIXM3rRyt7yKPBgpaP3ccQfuJDlq+u2lrDgv+R4QDgZxGhBM/nV+/x5XOULK -1+EVoVZVWRvRo68R2E7DpSvvkL/A7IITW43WciyTTo9qKd+FPNMN4KIYEsxVL0e3p5sC/kH2iExt -2qkBR4NkJ2IQgtYSe14DHzSpyZH+r11thie3I6p1GMog57AP14kOpmciY/SDQSsGS7tY1dHXt7kQ -Y9iJSrSq3RZj9W6+YKH47ejWkE8axsWgKdOnIaj1Wjz3x0miIZpKlVIglnKaZsv30oZDfCK+lvm9 -AahH3eU7QPl1K5srRmSGjR70j/sHd9DqSaIcjVIUpgqT ------END CERTIFICATE----- - certSIGN ROOT CA ================ -----BEGIN CERTIFICATE----- @@ -1647,49 +1225,6 @@ vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pw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viyJA/qIYM/PmLXoXLT1tLYhFHxUV8 -BS9BsZ4QaRuZluBVeftOhpm4lNqGOGqTo+fLbuXf6iFViZx9fX+Y9QCJ7uOEwFyWtcVG6kbghVW2 -G8kS1sHNzYDzAgE8yGnLRUhj2JTQ7IUOO04RZfSCjKY9ri4ilAnIXOo8gV0WKgOXFlUJ24pBgp5m -mxE= ------END CERTIFICATE----- - -ApplicationCA - Japanese Government -=================================== ------BEGIN CERTIFICATE----- -MIIDoDCCAoigAwIBAgIBMTANBgkqhkiG9w0BAQUFADBDMQswCQYDVQQGEwJKUDEcMBoGA1UEChMT -SmFwYW5lc2UgR292ZXJubWVudDEWMBQGA1UECxMNQXBwbGljYXRpb25DQTAeFw0wNzEyMTIxNTAw -MDBaFw0xNzEyMTIxNTAwMDBaMEMxCzAJBgNVBAYTAkpQMRwwGgYDVQQKExNKYXBhbmVzZSBHb3Zl -cm5tZW50MRYwFAYDVQQLEw1BcHBsaWNhdGlvbkNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB -CgKCAQEAp23gdE6Hj6UG3mii24aZS2QNcfAKBZuOquHMLtJqO8F6tJdhjYq+xpqcBrSGUeQ3DnR4 -fl+Kf5Sk10cI/VBaVuRorChzoHvpfxiSQE8tnfWuREhzNgaeZCw7NCPbXCbkcXmP1G55IrmTwcrN -wVbtiGrXoDkhBFcsovW8R0FPXjQilbUfKW1eSvNNcr5BViCH/OlQR9cwFO5cjFW6WY2H/CPek9AE -jP3vbb3QesmlOmpyM8ZKDQUXKi17safY1vC+9D/qDihtQWEjdnjDuGWk81quzMKq2edY3rZ+nYVu -nyoKb58DKTCXKB28t89UKU5RMfkntigm/qJj5kEW8DOYRwIDAQABo4GeMIGbMB0GA1UdDgQWBBRU -WssmP3HMlEYNllPqa0jQk/5CdTAOBgNVHQ8BAf8EBAMCAQYwWQYDVR0RBFIwUKROMEwxCzAJBgNV -BAYTAkpQMRgwFgYDVQQKDA/ml6XmnKzlm73mlL/lupwxIzAhBgNVBAsMGuOCouODl+ODquOCseOD -vOOCt+ODp+ODs0NBMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADlqRHZ3ODrs -o2dGD/mLBqj7apAxzn7s2tGJfHrrLgy9mTLnsCTWw//1sogJhyzjVOGjprIIC8CFqMjSnHH2HZ9g -/DgzE+Ge3Atf2hZQKXsvcJEPmbo0NI2VdMV+eKlmXb3KIXdCEKxmJj3ekav9FfBv7WxfEPjzFvYD -io+nEhEMy/0/ecGc/WLuo89UDNErXxc+4z6/wCs+CZv+iKZ+tJIX/COUgb1up8WMwusRRdv4QcmW -dupwX3kSa+SjB1oF7ydJzyGfikwJcGapJsErEU4z0g781mzSDjJkaP+tBXhfAx2o45CsJOAPQKdL -rosot4LKGAfmt1t06SAZf7IbiVQ= ------END CERTIFICATE----- - GeoTrust Primary Certification Authority - G3 ============================================= -----BEGIN CERTIFICATE----- @@ -1821,7 +1356,7 @@ AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA== -----END CERTIFICATE----- NetLock Arany (Class Gold) Főtanúsítvány -============================================ +======================================== -----BEGIN CERTIFICATE----- MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610 @@ -1876,58 +1411,6 @@ IPVVYpbtbZNQvOSqeK3Zywplh6ZmwcSBo3c6WB4L7oOLnR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm 66+KAQ== -----END CERTIFICATE----- -CA Disig -======== ------BEGIN CERTIFICATE----- -MIIEDzCCAvegAwIBAgIBATANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQGEwJTSzETMBEGA1UEBxMK -QnJhdGlzbGF2YTETMBEGA1UEChMKRGlzaWcgYS5zLjERMA8GA1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h8BAQEwgfYwgdAGCCsGAQUFBwICMIHD -HoHAAFMAZQBlACAAcwBlAHIAdABpAGYAaQBrAGEAYQB0ACAAbwBuACAAdgDkAGwAagBhAHMAdABh -AHQAdQBkACAAQQBTAC0AaQBzACAAUwBlAHIAdABpAGYAaQB0AHMAZQBlAHIAaQBtAGkAcwBrAGUA -cwBrAHUAcwAgAGEAbABhAG0ALQBTAEsAIABzAGUAcgB0AGkAZgBpAGsAYQBhAHQAaQBkAGUAIABr -AGkAbgBuAGkAdABhAG0AaQBzAGUAawBzMCEGCCsGAQUFBwIBFhVodHRwOi8vd3d3LnNrLmVlL2Nw -cy8wKwYDVR0fBCQwIjAgoB6gHIYaaHR0cDovL3d3dy5zay5lZS9qdXVyL2NybC8wHQYDVR0OBBYE -FASqekej5ImvGs8KQKcYP2/v6X2+MB8GA1UdIwQYMBaAFASqekej5ImvGs8KQKcYP2/v6X2+MA4G -A1UdDwEB/wQEAwIB5jANBgkqhkiG9w0BAQUFAAOCAQEAe8EYlFOiCfP+JmeaUOTDBS8rNXiRTHyo -ERF5TElZrMj3hWVcRrs7EKACr81Ptcw2Kuxd/u+gkcm2k298gFTsxwhwDY77guwqYHhpNjbRxZyL -abVAyJRld/JXIWY7zoVAtjNjGr95HvxcHdMdkxuLDF2FvZkwMhgJkVLpfKG6/2SSmuz+Ne6ML678 -IIbsSt4beDI3poHSna9aEhbKmVv8b20OxaAehsmR0FyYgl9jDIpaq9iVpszLita/ZEuOyoqysOkh -Mp6qqIWYNIE5ITuoOlIyPfZrN4YGWhWY3PARZv40ILcD9EEQfTmEeZZyY7aWAuVrua0ZTbvGRNs2 -yyqcjg== ------END CERTIFICATE----- - Hongkong Post Root CA 1 ======================= -----BEGIN CERTIFICATE----- @@ -2361,7 +1844,7 @@ Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI -----END CERTIFICATE----- Certinomis - Autorité Racine -============================= +============================ -----BEGIN CERTIFICATE----- MIIFnDCCA4SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJGUjETMBEGA1UEChMK Q2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxJjAkBgNVBAMMHUNlcnRpbm9taXMg @@ -2391,41 +1874,6 @@ wk01+dIL8hf2rGbVJLJP0RyZwG71fet0BLj5TXcJ17TPBzAJ8bgAVtkXFhYKK4bfjwEZGuW7gmP/ vgt2Fl43N+bYdJeimUV5 -----END CERTIFICATE----- -Root CA Generalitat Valenciana -============================== ------BEGIN CERTIFICATE----- -MIIGizCCBXOgAwIBAgIEO0XlaDANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJFUzEfMB0GA1UE -ChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UECxMGUEtJR1ZBMScwJQYDVQQDEx5Sb290 -IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmEwHhcNMDEwNzA2MTYyMjQ3WhcNMjEwNzAxMTUyMjQ3 -WjBoMQswCQYDVQQGEwJFUzEfMB0GA1UEChMWR2VuZXJhbGl0YXQgVmFsZW5jaWFuYTEPMA0GA1UE -CxMGUEtJR1ZBMScwJQYDVQQDEx5Sb290IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmEwggEiMA0G -CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDGKqtXETcvIorKA3Qdyu0togu8M1JAJke+WmmmO3I2 -F0zo37i7L3bhQEZ0ZQKQUgi0/6iMweDHiVYQOTPvaLRfX9ptI6GJXiKjSgbwJ/BXufjpTjJ3Cj9B -ZPPrZe52/lSqfR0grvPXdMIKX/UIKFIIzFVd0g/bmoGlu6GzwZTNVOAydTGRGmKy3nXiz0+J2ZGQ -D0EbtFpKd71ng+CT516nDOeB0/RSrFOyA8dEJvt55cs0YFAQexvba9dHq198aMpunUEDEO5rmXte -JajCq+TA81yc477OMUxkHl6AovWDfgzWyoxV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jaWFuYTEPMA0GA1UECxMGUEtJR1ZBMScwJQYDVQQDEx5S -b290IENBIEdlbmVyYWxpdGF0IFZhbGVuY2lhbmGCBDtF5WgwDQYJKoZIhvcNAQEFBQADggEBACRh -TvW1yEICKrNcda3FbcrnlD+laJWIwVTAEGmiEi8YPyVQqHxK6sYJ2fR1xkDar1CdPaUWu20xxsdz -Ckj+IHLtb8zog2EWRpABlUt9jppSCS/2bxzkoXHPjCpaF3ODR00PNvsETUlR4hTJZGH71BTg9J63 -NI8KJr2XXPR5OkowGcytT6CYirQxlyric21+eLj4iIlPsSKRZEv1UN4D2+XFducTZnV+ZfsBn5OH -iJ35Rld8TWCvmHMTI6QgkYH60GFmuH3Rr9ZvHmw96RH9qfmCIoaZM3Fa6hlXPZHNqcCjbgcTpsnt -+GijnsNacgmHKNHEc8RzGF9QdRYxn7fofMM= ------END CERTIFICATE----- - TWCA Root Certification Authority ================================= -----BEGIN CERTIFICATE----- @@ -2871,93 +2319,6 @@ poLWccret9W6aAjtmcz9opLLabid+Qqkpj5PkygqYWwHJgD/ll9ohri4zspV4KuxPX+Y1zMOWj3Y eMLEYC/HYvBhkdI4sPaeVdtAgAUSM84dkpvRabP/v/GSCmE1P93+hvS84Bpxs2Km -----END CERTIFICATE----- -China Internet Network Information Center EV Certificates Root -============================================================== ------BEGIN CERTIFICATE----- -MIID9zCCAt+gAwIBAgIESJ8AATANBgkqhkiG9w0BAQUFADCBijELMAkGA1UEBhMCQ04xMjAwBgNV -BAoMKUNoaW5hIEludGVybmV0IE5ldHdvcmsgSW5mb3JtYXRpb24gQ2VudGVyMUcwRQYDVQQDDD5D -aGluYSBJbnRlcm5ldCBOZXR3b3JrIEluZm9ybWF0aW9uIENlbnRlciBFViBDZXJ0aWZpY2F0ZXMg -Um9vdDAeFw0xMDA4MzEwNzExMjVaFw0zMDA4MzEwNzExMjVaMIGKMQswCQYDVQQGEwJDTjEyMDAG -A1UECgwpQ2hpbmEgSW50ZXJuZXQgTmV0d29yayBJbmZvcm1hdGlvbiBDZW50ZXIxRzBFBgNVBAMM -PkNoaW5hIEludGVybmV0IE5ldHdvcmsgSW5mb3JtYXRpb24gQ2VudGVyIEVWIENlcnRpZmljYXRl -cyBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm35z7r07eKpkQ0H1UN+U8i6y -jUqORlTSIRLIOTJCBumD1Z9S7eVnAztUwYyZmczpwA//DdmEEbK40ctb3B75aDFk4Zv6dOtouSCV -98YPjUesWgbdYavi7NifFy2cyjw1l1VxzUOFsUcW9SxTgHbP0wBkvUCZ3czY28Sf1hNfQYOL+Q2H -klY0bBoQCxfVWhyXWIQ8hBouXJE0bhlffxdpxWXvayHG1VA6v2G5BY3vbzQ6sm8UY78WO5upKv23 -KzhmBsUs4qpnHkWnjQRmQvaPK++IIGmPMowUc9orhpFjIpryp9vOiYurXccUwVswah+xt54ugQEC -7c+WXmPbqOY4twIDAQABo2MwYTAfBgNVHSMEGDAWgBR8cks5x8DbYqVPm6oYNJKiyoOCWTAPBgNV -HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUfHJLOcfA22KlT5uqGDSSosqD -glkwDQYJKoZIhvcNAQEFBQADggEBACrDx0M3j92tpLIM7twUbY8opJhJywyA6vPtI2Z1fcXTIWd5 -0XPFtQO3WKwMVC/GVhMPMdoG52U7HW8228gd+f2ABsqjPWYWqJ1MFn3AlUa1UeTiH9fqBk1jjZaM -7+czV0I664zBechNdn3e9rG3geCg+aF4RhcaVpjwTj2rHO3sOdwHSPdj/gauwqRcalsyiMXHM4Ws -ZkJHwlgkmeHlPuV1LI5D1l08eB6olYIpUNHRFrrvwb562bTYzB5MRuF3sTGrvSrIzo9uoV1/A3U0 -5K2JRVRevq4opbs/eHnrc7MKDf2+yfdWrPa37S+bISnHOLaVxATywy39FCqQmbkHzJ8= ------END CERTIFICATE----- - -Swisscom Root CA 2 -================== ------BEGIN CERTIFICATE----- -MIIF2TC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YMwDgYDVR0PAQH/ -BAQDAgGGMB0GA1UdIQQWMBQwEgYHYIV0AVMCAgYHYIV0AVMCAjASBgNVHRMBAf8ECDAGAQH/AgED -MB0GA1UdDgQWBBRF2aWBbj2ITY1x0kbBbkUe88SAnTAfBgNVHSMEGDAWgBRF2aWBbj2ITY1x0kbB -bkUe88SAnTANBgkqhkiG9w0BAQsFAAOCAgEAlDpzBp9SSzBc1P6xXCX5145v9Ydkn+0UjrgEjihL -j6p7jjm02Vj2e6E1CqGdivdj5eu9OYLU43otb98TPLr+flaYC/NUn81ETm484T4VvwYmneTwkLbU -wp4wLh/vx3rEUMfqe9pQy3omywC0Wqu1kx+AiYQElY2NfwmTv9SoqORjbdlk5LgpWgi/UOGED1V7 -XwgiG/W9mR4U9s70WBCCswo9GcG/W6uqmdjyMb3lOGbcWAXH7WMaLgqXfIeTK7KK4/HsGOV1timH -59yLGn602MnTihdsfSlEvoqq9X46Lmgxk7lq2prg2+kupYTNHAq4Sgj5nPFhJpiTt3tm7JFe3VE/ -23MPrQRYCd0EApUKPtN236YQHoA96M2kZNEzx5LH4k5E4wnJTsJdhw4Snr8PyQUQ3nqjsTzyP6Wq -J3mtMX0f/fwZacXduT98zca0wjAefm6S139hdlqP65VNvBFuIXxZN5nQBrz5Bm0yFqXZaajh3DyA -HmBR3NdUIR7KYndP+tiPsys6DXhyyWhBWkdKwqPrGtcKqzwyVcgKEZzfdNbwQBUdyLmPtTbFr/gi -uMod89a2GQ+fYWVq6nTIfI/DT11lgh/ZDYnadXL77/FHZxOzyNEZiCcmmpl5fx7kLD977vHeTYuW -l8PVP3wbI+2ksx0WckNLIOFZfsLorSa/ovc= ------END CERTIFICATE----- - CA Disig Root R1 ================ -----BEGIN CERTIFICATE----- @@ -3756,7 +3117,7 @@ ekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su -----END CERTIFICATE----- TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H5 -========================================================= +==================================================== -----BEGIN CERTIFICATE----- MIIEJzCCAw+gAwIBAgIHAI4X/iQggTANBgkqhkiG9w0BAQsFADCBsTELMAkGA1UEBhMCVFIxDzAN BgNVBAcMBkFua2FyYTFNMEsGA1UECgxEVMOcUktUUlVTVCBCaWxnaSDEsGxldGnFn2ltIHZlIEJp @@ -3779,30 +3140,6 @@ lpKQd/Ct9JDpEXjXk4nAPQu6KfTomZ1yju2dL+6SfaHx/126M2CFYv4HAqGEVka+lgqaE9chTLd8 B59OTj+RdPsnnRHM3eaxynFNExc5JsUpISuTKWqW+qtB4Uu2NQvAmxU= -----END CERTIFICATE----- -TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H6 -========================================================= ------BEGIN CERTIFICATE----- -MIIEJjCCAw6gAwIBAgIGfaHyZeyKMA0GCSqGSIb3DQEBCwUAMIGxMQswCQYDVQQGEwJUUjEPMA0G -A1UEBwwGQW5rYXJhMU0wSwYDVQQKDERUw5xSS1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUgQmls -acWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWeLjFCMEAGA1UEAww5VMOcUktUUlVTVCBF -bGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxIEg2MB4XDTEzMTIxODA5 -MDQxMFoXDTIzMTIxNjA5MDQxMFowgbExCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmExTTBL -BgNVBAoMRFTDnFJLVFJVU1QgQmlsZ2kgxLBsZXRpxZ9pbSB2ZSBCaWxpxZ9pbSBHw7x2ZW5sacSf -aSBIaXptZXRsZXJpIEEuxZ4uMUIwQAYDVQQDDDlUw5xSS1RSVVNUIEVsZWt0cm9uaWsgU2VydGlm -aWthIEhpem1ldCBTYcSfbGF5xLFjxLFzxLEgSDYwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK -AoIBAQCdsGjW6L0UlqMACprx9MfMkU1xeHe59yEmFXNRFpQJRwXiM/VomjX/3EsvMsew7eKC5W/a -2uqsxgbPJQ1BgfbBOCK9+bGlprMBvD9QFyv26WZV1DOzXPhDIHiTVRZwGTLmiddk671IUP320EED -wnS3/faAz1vFq6TWlRKb55cTMgPp1KtDWxbtMyJkKbbSk60vbNg9tvYdDjTu0n2pVQ8g9P0pu5Fb -HH3GQjhtQiht1AH7zYiXSX6484P4tZgvsycLSF5W506jM7NE1qXyGJTtHB6plVxiSvgNZ1GpryHV -+DKdeboaX+UEVU0TRv/yz3THGmNtwx8XEsMeED5gCLMxAgMBAAGjQjBAMB0GA1UdDgQWBBTdVRcT -9qzoSCHK77Wv0QAy7Z6MtTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG -9w0BAQsFAAOCAQEAb1gNl0OqFlQ+v6nfkkU/hQu7VtMMUszIv3ZnXuaqs6fvuay0EBQNdH49ba3R -fdCaqaXKGDsCQC4qnFAUi/5XfldcEQlLNkVS9z2sFP1E34uXI9TDwe7UU5X+LEr+DXCqu4svLcsy -o4LyVN/Y8t3XSHLuSqMplsNEzm61kod2pLv0kmzOLBQJZo6NrRa1xxsJYTvjIKIDgI6tflEATseW -hvtDmHd9KMeP2Cpu54Rvl0EpABZeTeIT6lnAY2c6RPuY/ATTMHKm9ocJV612ph1jmv3XZch4gyt1 -O6VbuA1df74jrlZVlFjvH4GMKrLN5ptjnhi85WsGtAuYSyher4hYyw== ------END CERTIFICATE----- - Certinomis - Root CA ==================== -----BEGIN CERTIFICATE----- @@ -3892,28 +3229,418 @@ Daupn75OcsqF1NnstTJFGG+rrQIwfcf3aWMvoeGY7xMQ0Xk/0f7qO3/eVvSQsRUR2LIiFdAvwyYu a/GRspBl9JrmkO5K -----END CERTIFICATE----- -================================================================ -C: US -O: GTE Corporation -OU: GTE CyberTrust Solutions, Inc. -CN: GTE CyberTrust Global Root --- -Not Before: 1998-08-13 -Not After: 2018-08-13 -Signature: md5WithRSAEncryption -Key: RSA:1024 +SZAFIR ROOT CA2 +=============== -----BEGIN CERTIFICATE----- -MIICWjCCAcMCAgGlMA0GCSqGSIb3DQEBBAUAMHUxCzAJBgNVBAYTAlVTMRgwFgYD -VQQKEw9HVEUgQ29ycG9yYXRpb24xJzAlBgNVBAsTHkdURSBDeWJlclRydXN0IFNv -bHV0aW9ucywgSW5jLjEjMCEGA1UEAxMaR1RFIEN5YmVyVHJ1c3QgR2xvYmFsIFJv -b3QwHhcNOTgwODEzMDAyOTAwWhcNMTgwODEzMjM1OTAwWjB1MQswCQYDVQQGEwJV -UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQLEx5HVEUgQ3liZXJU -cnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0IEds -b2JhbCBSb290MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCVD6C28FCc6HrH -iM3dFw4usJTQGz0O9pTAipTHBsiQl8i4ZBp6fmw8U+E3KHNgf7KXUwefU/ltWJTS -r41tiGeA5u2ylc9yMcqlHHK6XALnZELn+aks1joNrI1CqiQBOeacPwGFVw1Yh0X4 -04Wqk2kmhXBIgD8SFcd5tB8FLztimQIDAQABMA0GCSqGSIb3DQEBBAUAA4GBAG3r -GwnpXtlR22ciYaQqPEh346B8pt5zohQDhT37qw4wxYMWM4ETCJ57NE7fQMh017l9 -3PR2VX2bY1QY6fDq81yx2YtCHrnAlU66+tXifPVoYb+O7AWXX1uw16OFNMQkpw0P -lZPvy5TYnh+dXIVtx6quTx8itc2VrbqnzPmrC3p/ +MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQELBQAwUTELMAkG +A1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6ZW5pb3dhIFMuQS4xGDAWBgNV +BAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkwNzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJ +BgNVBAYTAlBMMSgwJgYDVQQKDB9LcmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYD +VQQDDA9TWkFGSVIgUk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5Q +qEvNQLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT3PSQ1hNK +DJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw3gAeqDRHu5rr/gsUvTaE +2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr63fE9biCloBK0TXC5ztdyO4mTp4CEHCdJ +ckm1/zuVnsHMyAHs6A6KCpbns6aH5db5BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwi +ieDhZNRnvDF5YTy7ykHNXGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0P +AQH/BAQDAgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsFAAOC +AQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw8PRBEew/R40/cof5 +O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOGnXkZ7/e7DDWQw4rtTw/1zBLZpD67 +oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCPoky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul +4+vJhaAlIDf7js4MNIThPIGyd05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6 ++/NNIxuZMzSgLvWpCz/UXeHPhJ/iGcJfitYgHuNztw== +-----END CERTIFICATE----- + +Certum Trusted Network CA 2 +=========================== +-----BEGI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6VuZt27VXS9zlLCUVyJ4ueE742pye +hizKV/Ma5ciSixqClnrDvFASadgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vM +BhBgu4M1t15n3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD +AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZI +hvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQF/xlhMcQSZDe28cmk4gmb3DW +Al45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTfCVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuA +L55MYIR4PSFk1vtBHxgP58l1cb29XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMo +clm2q8KMZiYcdywmdjWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tM +pkT/WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jbAoJnwTnb +w3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksqP/ujmv5zMnHCnsZy4Ypo +J/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Kob7a6bINDd82Kkhehnlt4Fj1F4jNy3eFm +ypnTycUm/Q1oBEauttmbjL4ZvrHG8hnjXALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLX +is7VmFxWlgPF7ncGNf/P5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7 +zAYspsbiDrW5viSP +-----END CERTIFICATE----- + +Hellenic Academic and Research Institutions RootCA 2015 +======================================================= +-----BEGIN CERTIFICATE----- +MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjEL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hEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9mu +iNX6hME6wGkoLfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc +Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD +AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVdctA4GGqd83EkVAswDQYJKoZI +hvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0IXtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+ +D1hYc2Ryx+hFjtyp8iY/xnmMsVMIM4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrM +d/K4kPFox/la/vot9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+y +d+2VZ5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/eaj8GsGsVn +82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnhX9izjFk0WaSrT2y7Hxjb +davYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQl033DlZdwJVqwjbDG2jJ9SrcR5q+ss7F +Jej6A7na+RZukYT1HCjI/CbM1xyQVqdfbzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVt +J94Cj8rDtSvK6evIIVM4pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGa +JI7ZjnHKe7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0vm9q +p/UsQu0yrbYhnr68 +-----END CERTIFICATE----- + +Hellenic Academic and Research Institutions ECC RootCA 2015 +=========================================================== +-----BEGIN CERTIFICATE-----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x1czEcMBoGA1UEAwwTQ2VydHBsdXMgUm9vdCBDQSBHMjB2MBAGByqGSM49AgEGBSuBBAAiA2IA +BM0PW1aC3/BFGtat93nwHcmsltaeTpwftEIRyoa/bfuFo8XlGVzX7qY/aWfYeOKmycTbLXku54uN +Am8xIk0G42ByRZ0OQneezs/lf4WbGOT8zC5y0xaTTsqZY1yhBSpsBqNjMGEwDgYDVR0PAQH/BAQD +AgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNqDYwJ5jtpMxjwjFNiPwyCrKGBZMB8GA1Ud +IwQYMBaAFNqDYwJ5jtpMxjwjFNiPwyCrKGBZMAoGCCqGSM49BAMDA2gAMGUCMHD+sAvZ94OX7PNV +HdTcswYO/jOYnYs5kGuUIe22113WTNchp+e/IQ8rzfcq3IUHnQIxAIYUFuXcsGXCwI4Un78kFmjl +vPl5adytRSv3tjFzzAalU5ORGpOucGpnutee5WEaXw== +-----END CERTIFICATE----- + +OpenTrust Root CA G1 +==================== +-----BEGIN CERTIFICATE----- +MIIFbzCCA1egAwIBAgISESCzkFU5fX82bWTCp59rY45nMA0GCSqGSIb3DQEBCwUAMEAxCzAJBgNV +BAYTAkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEcx +MB4XDTE0MDUyNjA4NDU1MFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoM +CU9wZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzEwggIiMA0GCSqGSIb3DQEB +AQUAA4ICDwAwggIKAoICAQD4eUbalsUwXopxAy1wpLuwxQjczeY1wICkES3d5oeuXT2R0odsN7fa +Yp6bwiTXj/HbpqbfRm9RpnHLPhsxZ2L3EVs0J9V5ToybWL0iEA1cJwzdMOWo010hOHQX/uMftk87 +ay3bfWAfjH1MBcLrARYVmBSO0ZB3Ij/swjm4eTrwSSTilZHcYTSS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ZuZ2mKtVzazHbYNeS2WuOvyDEsMpZTGMKcm +GS3tTAZQMPH9WD25SxdfGbRqhFS0OE85og2WaMMolP3tLR9Ka0OWLpABEPs4poEL0L9109S5zvE/ +bw4cHjdx5RiHdRk/ULlepEU0rbDK5uUTdg8xFKmOLZTW1YVNcxVPS/KyPu1svf0OnWZzsD2097+o +4BGkxK51CUpjAEggpsadCwmKtODmzj7HPiY46SvepghJAwSQiumPv+i2tCqjI40cHLI5kqiPAlxA +OXXUc0ECd97N4EOH1uS6SsNsEn/+KuYj1oxx +-----END CERTIFICATE----- + +OpenTrust Root CA G2 +==================== +-----BEGIN CERTIFICATE----- +MIIFbzCCA1egAwIBAgISESChaRu/vbm9UpaPI+hIvyYRMA0GCSqGSIb3DQEBDQUAMEAxCzAJBgNV +BAYTAkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEcy +MB4XDTE0MDUyNjAwMDAwMFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoM +CU9wZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzIwggIiMA0GCSqGSIb3DQEB +AQUAA4ICDwAwggIKAoICAQDMtlelM5QQgTJT32F+D3Y5z1zCU3UdSXqWON2ic2rxb95eolq5cSG+ +Ntmh/LzubKh8NBpxGuga2F8ORAbtp+Dz0mEL4DKiltE48MLaARf85KxP6O6JHnSrT78eCbY2albz +4e6WiWYkBuTNQjpK3eCasMSCRbP+yatcfD7J6xcvDH1urqWPyKwlCm/61UWY0jUJ9gNDlP7ZvyCV +eYCYitmJNbtRG6Q3ffyZO6v/v6wNj0OxmXsWEH4db0fEFY8ElggGQgT4hNYdvJGmQr5J1WqIP7wt +UdGejeBSzFfdNTVY27SPJIjki9/ca1TSgSuyzpJLHB9G+h3Ykst2Z7UJmQnlrBcUVXDGPKBWCgOz +3GIZ38i1MH/1PCZ1Eb3XG7O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iv7BO7M/Gg+kO14fWKGVyasvc0rQLW6aWQ9VGHgtPFGml4vm +u7JwqkwR3v98KzfUetF3NI/n+UL3PIEMS1IK +-----END CERTIFICATE----- + +OpenTrust Root CA G3 +==================== +-----BEGIN CERTIFICATE----- +MIICITCCAaagAwIBAgISESDm+Ez8JLC+BUCs2oMbNGA/MAoGCCqGSM49BAMDMEAxCzAJBgNVBAYT +AkZSMRIwEAYDVQQKDAlPcGVuVHJ1c3QxHTAbBgNVBAMMFE9wZW5UcnVzdCBSb290IENBIEczMB4X +DTE0MDUyNjAwMDAwMFoXDTM4MDExNTAwMDAwMFowQDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCU9w +ZW5UcnVzdDEdMBsGA1UEAwwUT3BlblRydXN0IFJvb3QgQ0EgRzMwdjAQBgcqhkjOPQIBBgUrgQQA +IgNiAARK7liuTcpm3gY6oxH84Bjwbhy6LTAMidnW7ptzg6kjFYwvWYpa3RTqnVkrQ7cG7DK2uu5B +ta1doYXM6h0UZqNnfkbilPPntlahFVmhTzeXuSIevRHr9LIfXsMUmuXZl5mjYzBhMA4GA1UdDwEB +/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRHd8MUi2I5DMlv4VBN0BBY3JWIbTAf +BgNVHSMEGDAWgBRHd8MUi2I5DMlv4VBN0BBY3JWIbTAKBggqhkjOPQQDAwNpADBmAjEAj6jcnboM +BBf6Fek9LykBl7+BFjNAk2z8+e2AcG+qj9uEwov1NcoG3GRvaBbhj5G5AjEA2Euly8LQCGzpGPta +3U1fJAuwACEl74+nBCZx4nxp5V2a+EEfOzmTk51V6s2N8fvB +-----END CERTIFICATE----- + +ISRG Root X1 +============ +-----BEGIN CERTIFICATE----- +MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAwTzELMAkGA1UE +BhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNoIEdyb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ZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrT +Qfv6MooqtyuGC2mDOL7Nii4LcK2NJpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW ++YJF1DngoABd15jmfZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7 +Ixjp6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp1txyM/1d +8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B9kiABdcPUXmsEKvU7ANm +5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wokRqEIr9baRRmW1FMdW4R58MD3R++Lj8UG +rp1MYp3/RgT408m2ECVAdf4WqslKYIYvuu8wd+RU4riEmViAqhOLUTpPSPaLtrM= +-----END CERTIFICATE----- + +Amazon Root CA 1 +================ +-----BEGIN CERTIFICATE----- +MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsFADA5MQswCQYD +VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAxMB4XDTE1 +MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv +bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC +ggEBALJ4gHHKeNXjca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgH +FzZM9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qwIFAGbHrQ +gLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6VOujw5H5SNz/0egwLX0t +dHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L93FcXmn/6pUCyziKrlA4b9v7LWIbxcce +VOF34GfID5yHI9Y/QCB/IIDEgEw+OyQmjgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB +/zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3 +DQEBCwUAA4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDIU5PM +CCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUsN+gDS63pYaACbvXy +8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vvo/ufQJVtMVT8QtPHRh8jrdkPSHCa +2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2 +xJNDd2ZhwLnoQdeXeGADbkpyrqXRfboQnoZsG4q5WTP468SQvvG5 +-----END CERTIFICATE----- + +Amazon Root CA 2 +================ +-----BEGIN CERTIFICATE----- +MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwFADA5MQswCQYD +VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAyMB4XDTE1 +MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv +bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC +ggIBAK2Wny2cSkxKgXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4 +kHbZW0/jTOgGNk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 +gj9sAq+uEjonljYE1x2igGOpm/HlurR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbW +aQbLU8uz/mtBzUF+fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoV +Yh63n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE76KlXIx3 +KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H9jVlpNMKVv/1F2Rs76gi +JUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT4PsJYGw= +-----END CERTIFICATE----- + +Amazon Root CA 3 +================ +-----BEGIN CERTIFICATE----- +MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5MQswCQYDVQQG +EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAzMB4XDTE1MDUy +NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ +MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZB +f8ANm+gBG1bG8lKlui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjr +Zt6jQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSrttvXBp43 +rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkrBqWTrBqYaGFy+uGh0Psc +eGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteMYyRIHN8wfdVoOw== +-----END CERTIFICATE----- + +Amazon Root CA 4 +================ +-----BEGIN CERTIFICATE----- +MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5MQswCQYDVQQG +EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSA0MB4XDTE1MDUy +NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ +MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN +/sGKe0uoe0ZLY7Bi9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri +83BkM6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV +HQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WBMAoGCCqGSM49BAMDA2gA +MGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlwCkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1 +AE47xDqUEpHJWEadIRNyp4iciuRMStuW1KyLa2tJElMzrdfkviT8tQp21KW8EA== +-----END CERTIFICATE----- + +LuxTrust Global Root 2 +====================== +-----BEGIN CERTIFICATE----- +MIIFwzCCA6ugAwIBAgIUCn6m30tEntpqJIWe5rgV0xZ/u7EwDQYJKoZIhvcNAQELBQAwRjELMAkG +A1UEBhMCTFUxFjAUBgNVBAoMDUx1eFRydXN0IFMuQS4xHzAdBgNVBAMMFkx1eFRydXN0IEdsb2Jh +bCBSb290IDIwHhcNMTUwMzA1MTMyMTU3WhcNMzUwMzA1MTMyMTU3WjBGMQswCQYDVQQGEwJMVTEW +MBQGA1UECgwNTHV4VHJ1c3QgUy5BLjEfMB0GA1UEAwwWTHV4VHJ1c3QgR2xvYmFsIFJvb3QgMjCC +AiIwDQYJKoZIhvcNAQEBBQADggIPADC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WjfrRcmF9dTHF5kH5ptV5AzoqbTOjFu1EVzPig4N1qx3gf4ynCSecs5U89BvolbW +7MM3LGVYvlcAGvI1+ut7MV3CwRI9loGIlonBWVx65n9wNOeD4rHh4bhY79SV5GCc8JaXcozrhAIu +ZY+kt9J/Z93I055cqqmkoCUUBpvsT34tC38ddfEz2O3OuHVtPlu5mB0xDVbYQw8wkbIEa91WvpWA +VWe+2M2D2RjuLg+GLZKecBPs3lHJQ3gCpU3I+V/EkVhGFndadKpAvAefMLmx9xIX3eP/JEAdemrR +TxgKqpAd60Ae36EeRJIQmvKN4dFLRp7oRUKX6kWZ8+xm1QL68qZKJKrezrnK+T+Tb/mjuuqlPpmt +/f97mfVl7vBZKGfXkJWkE4SphMHozs51k2MavDzq1WQfLSoSOcbDWjLtR5EWDrw4wVDej8oqkDQc +7kGUnF4ZLvhFSZl0kbAEb+MEWrGrKqv+x9CWttrhSmQGbmBNvUJO/3jaJMobtNeWOWyu8Q6qp31I +iyBMz2TWuJdGsE7RKlY6oJO9r4Ak4Ap+58rVyuiFVdw2KuGUaJPHZnJED4AhMmwlxyOAgwrr +-----END CERTIFICATE----- + +TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1 +============================================= +-----BEGIN CERTIFICATE----- +MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIxGDAWBgNVBAcT +D0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxpbXNlbCB2ZSBUZWtub2xvamlr +IEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0wKwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24g +TWVya2V6aSAtIEthbXUgU00xNjA0BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRp +ZmlrYXNpIC0gU3VydW0gMTAeFw0xMzExMjUwODI1NTVaFw00MzEwMjUwODI1NTVaMIHSMQswCQYD +VQQGEwJUUjEY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+K37DwhuJi1/FwcJsoz7UMCflo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM= -----END CERTIFICATE----- diff --git a/htdocs/includes/stripe/data/test.png b/htdocs/includes/stripe/data/test.png deleted file mode 100644 index 1914264c08781d1f30ee0b8482bccf44586f2dc1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 95 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)ga%mF?ju0VQumF+E%TuG2$FoVOh l8)-lem#2$k2*>s01R$Gz9%CSj!PC{xWt~$(697H@6ZHT9 diff --git a/htdocs/includes/stripe/lib/AttachedObject.php b/htdocs/includes/stripe/lib/AttachedObject.php deleted file mode 100644 index 6a8951788ed..00000000000 --- a/htdocs/includes/stripe/lib/AttachedObject.php +++ /dev/null @@ -1,43 +0,0 @@ -_values), array_keys($properties)); - // Don't unset, but rather set to null so we send up '' for deletion. - foreach ($removed as $k) { - $this->$k = null; - } - - foreach ($properties as $k => $v) { - $this->$k = $v; - } - } - - /** - * Counts the number of elements in the AttachedObject instance. - * - * @return int the number of elements - */ - public function count() - { - return count($this->_values); - } -} diff --git a/htdocs/includes/stripe/lib/Error/Base.php b/htdocs/includes/stripe/lib/Error/Base.php index 44106ecca50..c0051e6a416 100644 --- a/htdocs/includes/stripe/lib/Error/Base.php +++ b/htdocs/includes/stripe/lib/Error/Base.php @@ -20,11 +20,20 @@ abstract class Base extends Exception $this->httpHeaders = $httpHeaders; $this->requestId = null; + // TODO: make this a proper constructor argument in the next major + // release. + $this->stripeCode = isset($jsonBody["error"]["code"]) ? $jsonBody["error"]["code"] : null; + if ($httpHeaders && isset($httpHeaders['Request-Id'])) { $this->requestId = $httpHeaders['Request-Id']; } } + public function getStripeCode() + { + return $this->stripeCode; + } + public function getHttpStatus() { return $this->httpStatus; diff --git a/htdocs/includes/stripe/lib/Error/Card.php b/htdocs/includes/stripe/lib/Error/Card.php index 9004db271e3..f3ff343d899 100644 --- a/htdocs/includes/stripe/lib/Error/Card.php +++ b/htdocs/includes/stripe/lib/Error/Card.php @@ -15,12 +15,16 @@ class Card extends Base ) { parent::__construct($message, $httpStatus, $httpBody, $jsonBody, $httpHeaders); $this->stripeParam = $stripeParam; + + // TODO: once Error\Base accepts the error code as an argument, pass it + // in the call to parent::__construct() and stop setting it here. $this->stripeCode = $stripeCode; // This one is not like the others because it was added later and we're // trying to do our best not to change the public interface of this class' - // constructor. We should consider changing its implementation on the - // next major version bump of this library. + // constructor. + // TODO: make this a proper constructor argument in the next major + // release. $this->declineCode = isset($jsonBody["error"]["decline_code"]) ? $jsonBody["error"]["decline_code"] : null; } @@ -29,11 +33,6 @@ class Card extends Base return $this->declineCode; } - public function getStripeCode() - { - return $this->stripeCode; - } - public function getStripeParam() { return $this->stripeParam; diff --git a/htdocs/includes/stripe/lib/ExternalAccount.php b/htdocs/includes/stripe/lib/ExternalAccount.php deleted file mode 100644 index fba03075d86..00000000000 --- a/htdocs/includes/stripe/lib/ExternalAccount.php +++ /dev/null @@ -1,92 +0,0 @@ -_delete($params, $opts); - } - - /** - * @param array|string|null $opts - * - * @return ExternalAccount The saved external account. - */ - public function save($opts = null) - { - return $this->_save($opts); - } - - /** - * @param array|null $params - * @param array|string|null $opts - * - * @return ExternalAccount The verified (or not) external account. - */ - public function verify($params = null, $opts = null) - { - if ($this['customer']) { - $url = $this->instanceUrl() . '/verify'; - list($response, $options) = $this->_request('post', $url, $params, $opts); - $this->refreshFrom($response, $options); - return $this; - } else { - $message = 'Only customer external accounts can be verified in this manner.'; - throw new Error\Api($message); - } - } -} diff --git a/htdocs/includes/stripe/lib/HttpClient/ClientInterface.php b/htdocs/includes/stripe/lib/HttpClient/ClientInterface.php index dc4af5d1dc2..606ddb1a597 100644 --- a/htdocs/includes/stripe/lib/HttpClient/ClientInterface.php +++ b/htdocs/includes/stripe/lib/HttpClient/ClientInterface.php @@ -11,8 +11,8 @@ interface ClientInterface * @param array $params KV pairs for parameters. Can be nested for arrays and hashes * @param boolean $hasFile Whether or not $params references a file (via an @ prefix or * CurlFile) - * @throws Error\Api & Error\ApiConnection - * @return array($rawBody, $httpStatusCode, $httpHeader) + * @throws \Stripe\Error\Api & \Stripe\Error\ApiConnection + * @return [$rawBody, $httpStatusCode, $httpHeader] */ public function request($method, $absUrl, $headers, $params, $hasFile); } diff --git a/htdocs/includes/stripe/lib/HttpClient/CurlClient.php b/htdocs/includes/stripe/lib/HttpClient/CurlClient.php index e070d324d72..6bc86e32b3a 100644 --- a/htdocs/includes/stripe/lib/HttpClient/CurlClient.php +++ b/htdocs/includes/stripe/lib/HttpClient/CurlClient.php @@ -36,6 +36,8 @@ class CurlClient implements ClientInterface protected $defaultOptions; + protected $userAgentInfo; + /** * CurlClient constructor. * @@ -49,9 +51,20 @@ class CurlClient implements ClientInterface * * @param array|callable|null $defaultOptions */ - public function __construct($defaultOptions = null) + public function __construct($defaultOptions = null, $randomGenerator = null) { $this->defaultOptions = $defaultOptions; + $this->randomGenerator = $randomGenerator ?: new Util\RandomGenerator(); + $this->initUserAgentInfo(); + } + + public function initUserAgentInfo() + { + $curlVersion = curl_version(); + $this->userAgentInfo = [ + 'httplib' => 'curl ' . $curlVersion['version'], + 'ssllib' => $curlVersion['ssl_version'], + ]; } public function getDefaultOptions() @@ -59,6 +72,11 @@ class CurlClient implements ClientInterface return $this->defaultOptions; } + public function getUserAgentInfo() + { + return $this->userAgentInfo; + } + // USER DEFINED TIMEOUTS const DEFAULT_TIMEOUT = 80; @@ -93,10 +111,9 @@ class CurlClient implements ClientInterface public function request($method, $absUrl, $headers, $params, $hasFile) { - $curl = curl_init(); $method = strtolower($method); - $opts = array(); + $opts = []; if (is_callable($this->defaultOptions)) { // call defaultOptions callback, set options to return value $opts = call_user_func_array($this->defaultOptions, func_get_args()); if (!is_array($opts)) { @@ -114,24 +131,32 @@ class CurlClient implements ClientInterface } $opts[CURLOPT_HTTPGET] = 1; if (count($params) > 0) { - $encoded = self::encode($params); + $encoded = Util\Util::urlEncode($params); $absUrl = "$absUrl?$encoded"; } } elseif ($method == 'post') { $opts[CURLOPT_POST] = 1; - $opts[CURLOPT_POSTFIELDS] = $hasFile ? $params : self::encode($params); + $opts[CURLOPT_POSTFIELDS] = $hasFile ? $params : Util\Util::urlEncode($params); } elseif ($method == 'delete') { $opts[CURLOPT_CUSTOMREQUEST] = 'DELETE'; if (count($params) > 0) { - $encoded = self::encode($params); + $encoded = Util\Util::urlEncode($params); $absUrl = "$absUrl?$encoded"; } } else { throw new Error\Api("Unrecognized method $method"); } + // It is only safe to retry network failures on POST requests if we + // add an Idempotency-Key header + if (($method == 'post') && (Stripe::$maxNetworkRetries > 0)) { + if (!isset($headers['Idempotency-Key'])) { + array_push($headers, 'Idempotency-Key: ' . $this->randomGenerator->uuid()); + } + } + // Create a callback to capture HTTP headers for the response - $rheaders = array(); + $rheaders = []; $headerCallback = function ($curl, $header_line) use (&$rheaders) { // Ignore the HTTP request line (HTTP/1.1 200 OK) if (strpos($header_line, ":") === false) { @@ -163,50 +188,63 @@ class CurlClient implements ClientInterface $opts[CURLOPT_TIMEOUT] = $this->timeout; $opts[CURLOPT_HEADERFUNCTION] = $headerCallback; $opts[CURLOPT_HTTPHEADER] = $headers; - if (!Stripe::$verifySslCerts) { + $opts[CURLOPT_CAINFO] = Stripe::getCABundlePath(); + if (!Stripe::getVerifySslCerts()) { $opts[CURLOPT_SSL_VERIFYPEER] = false; } - curl_setopt_array($curl, $opts); - $rbody = curl_exec($curl); + list($rbody, $rcode) = $this->executeRequestWithRetries($opts, $absUrl); - if (!defined('CURLE_SSL_CACERT_BADFILE')) { - define('CURLE_SSL_CACERT_BADFILE', 77); // constant not defined in PHP - } - - $errno = curl_errno($curl); - if ($errno == CURLE_SSL_CACERT || - $errno == CURLE_SSL_PEER_CERTIFICATE || - $errno == CURLE_SSL_CACERT_BADFILE - ) { - array_push( - $headers, - 'X-Stripe-Client-Info: {"ca":"using Stripe-supplied CA bundle"}' - ); - $cert = self::caBundle(); - curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); - curl_setopt($curl, CURLOPT_CAINFO, $cert); - $rbody = curl_exec($curl); - } - - if ($rbody === false) { - $errno = curl_errno($curl); - $message = curl_error($curl); - curl_close($curl); - $this->handleCurlError($absUrl, $errno, $message); - } - - $rcode = curl_getinfo($curl, CURLINFO_HTTP_CODE); - curl_close($curl); - return array($rbody, $rcode, $rheaders); + return [$rbody, $rcode, $rheaders]; } /** - * @param number $errno + * @param array $opts cURL options + */ + private function executeRequestWithRetries($opts, $absUrl) + { + $numRetries = 0; + + while (true) { + $rcode = 0; + $errno = 0; + + $curl = curl_init(); + curl_setopt_array($curl, $opts); + $rbody = curl_exec($curl); + + if ($rbody === false) { + $errno = curl_errno($curl); + $message = curl_error($curl); + } else { + $rcode = curl_getinfo($curl, CURLINFO_HTTP_CODE); + } + curl_close($curl); + + if ($this->shouldRetry($errno, $rcode, $numRetries)) { + $numRetries += 1; + $sleepSeconds = $this->sleepTime($numRetries); + usleep(intval($sleepSeconds * 1000000)); + } else { + break; + } + } + + if ($rbody === false) { + $this->handleCurlError($absUrl, $errno, $message, $numRetries); + } + + return [$rbody, $rcode]; + } + + /** + * @param string $url + * @param int $errno * @param string $message + * @param int $numRetries * @throws Error\ApiConnection */ - private function handleCurlError($url, $errno, $message) + private function handleCurlError($url, $errno, $message, $numRetries) { switch ($errno) { case CURLE_COULDNT_CONNECT: @@ -231,52 +269,66 @@ class CurlClient implements ClientInterface $msg .= " let us know at support@stripe.com."; $msg .= "\n\n(Network error [errno $errno]: $message)"; + + if ($numRetries > 0) { + $msg .= "\n\nRequest was retried $numRetries times."; + } + throw new Error\ApiConnection($msg); } - private static function caBundle() + /** + * Checks if an error is a problem that we should retry on. This includes both + * socket errors that may represent an intermittent problem and some special + * HTTP statuses. + * @param int $errno + * @param int $rcode + * @param int $numRetries + * @return bool + */ + private function shouldRetry($errno, $rcode, $numRetries) { - return dirname(__FILE__) . '/../../data/ca-certificates.crt'; + if ($numRetries >= Stripe::getMaxNetworkRetries()) { + return false; + } + + // Retry on timeout-related problems (either on open or read). + if ($errno === CURLE_OPERATION_TIMEOUTED) { + return true; + } + + // Destination refused the connection, the connection was reset, or a + // variety of other connection failures. This could occur from a single + // saturated server, so retry in case it's intermittent. + if ($errno === CURLE_COULDNT_CONNECT) { + return true; + } + + // 409 conflict + if ($rcode === 409) { + return true; + } + + return false; } - /** - * @param array $arr An map of param keys to values. - * @param string|null $prefix - * - * Only public for testability, should not be called outside of CurlClient - * - * @return string A querystring, essentially. - */ - public static function encode($arr, $prefix = null) + private function sleepTime($numRetries) { - if (!is_array($arr)) { - return $arr; - } + // Apply exponential backoff with $initialNetworkRetryDelay on the + // number of $numRetries so far as inputs. Do not allow the number to exceed + // $maxNetworkRetryDelay. + $sleepSeconds = min( + Stripe::getInitialNetworkRetryDelay() * 1.0 * pow(2, $numRetries - 1), + Stripe::getMaxNetworkRetryDelay() + ); - $r = array(); - foreach ($arr as $k => $v) { - if (is_null($v)) { - continue; - } + // Apply some jitter by randomizing the value in the range of + // ($sleepSeconds / 2) to ($sleepSeconds). + $sleepSeconds *= 0.5 * (1 + $this->randomGenerator->randFloat()); - if ($prefix) { - if ($k !== null && (!is_int($k) || is_array($v))) { - $k = $prefix."[".$k."]"; - } else { - $k = $prefix."[]"; - } - } + // But never sleep less than the base sleep seconds. + $sleepSeconds = max(Stripe::getInitialNetworkRetryDelay(), $sleepSeconds); - if (is_array($v)) { - $enc = self::encode($v, $k); - if ($enc) { - $r[] = $enc; - } - } else { - $r[] = urlencode($k)."=".urlencode($v); - } - } - - return implode("&", $r); + return $sleepSeconds; } } diff --git a/htdocs/includes/stripe/lib/JsonSerializable.php b/htdocs/includes/stripe/lib/JsonSerializable.php deleted file mode 100644 index 2fdf8526703..00000000000 --- a/htdocs/includes/stripe/lib/JsonSerializable.php +++ /dev/null @@ -1,18 +0,0 @@ -pageOffset += count($this->page->data); if ($this->page['has_more']) { $this->params = array_merge( - $this->params ? $this->params : array(), - array('starting_after' => $this->lastId) + $this->params ?: [], + ['starting_after' => $this->lastId] ); $this->page = $this->page->all($this->params); } else { diff --git a/htdocs/includes/stripe/lib/Util/RequestOptions.php b/htdocs/includes/stripe/lib/Util/RequestOptions.php index 14af2b8a0e8..a31f4d322d9 100644 --- a/htdocs/includes/stripe/lib/Util/RequestOptions.php +++ b/htdocs/includes/stripe/lib/Util/RequestOptions.php @@ -6,10 +6,18 @@ use Stripe\Error; class RequestOptions { + /** + * @var array A list of headers that should be persisted across requests. + */ + public static $HEADERS_TO_PERSIST = [ + 'Stripe-Account', + 'Stripe-Version', + ]; + public $headers; public $apiKey; - public function __construct($key = null, $headers = array()) + public function __construct($key = null, $headers = []) { $this->apiKey = $key; $this->headers = $headers; @@ -32,6 +40,18 @@ class RequestOptions return $other_options; } + /** + * Discards all headers that we don't want to persist across requests. + */ + public function discardNonPersistentHeaders() + { + foreach ($this->headers as $k => $v) { + if (!in_array($k, self::$HEADERS_TO_PERSIST)) { + unset($this->headers[$k]); + } + } + } + /** * Unpacks an options array into an RequestOptions object * @param array|string|null $options a key => value array @@ -45,15 +65,15 @@ class RequestOptions } if (is_null($options)) { - return new RequestOptions(null, array()); + return new RequestOptions(null, []); } if (is_string($options)) { - return new RequestOptions($options, array()); + return new RequestOptions($options, []); } if (is_array($options)) { - $headers = array(); + $headers = []; $key = null; if (array_key_exists('api_key', $options)) { $key = $options['api_key']; diff --git a/htdocs/includes/stripe/lib/Util/Set.php b/htdocs/includes/stripe/lib/Util/Set.php index 2a500cd639b..d8beb8b1a39 100644 --- a/htdocs/includes/stripe/lib/Util/Set.php +++ b/htdocs/includes/stripe/lib/Util/Set.php @@ -9,9 +9,9 @@ class Set implements IteratorAggregate { private $_elts; - public function __construct($members = array()) + public function __construct($members = []) { - $this->_elts = array(); + $this->_elts = []; foreach ($members as $item) { $this->_elts[$item] = true; } diff --git a/htdocs/includes/stripe/lib/Util/Util.php b/htdocs/includes/stripe/lib/Util/Util.php index 1c8235df9bd..82fd337dd34 100644 --- a/htdocs/includes/stripe/lib/Util/Util.php +++ b/htdocs/includes/stripe/lib/Util/Util.php @@ -7,24 +7,26 @@ use Stripe\StripeObject; abstract class Util { private static $isMbstringAvailable = null; + private static $isHashEqualsAvailable = null; /** * Whether the provided array (or other) is a list rather than a dictionary. + * A list is defined as an array for which all the keys are consecutive + * integers starting at 0. Empty arrays are considered to be lists. * * @param array|mixed $array - * @return boolean True if the given object is a list. + * @return boolean true if the given object is a list. */ public static function isList($array) { if (!is_array($array)) { return false; } - - // TODO: generally incorrect, but it's correct given Stripe's response - foreach (array_keys($array) as $k) { - if (!is_numeric($k)) { - return false; - } + if ($array === []) { + return true; + } + if (array_keys($array) !== range(0, count($array) - 1)) { + return false; } return true; } @@ -37,7 +39,7 @@ abstract class Util */ public static function convertStripeObjectToArray($values) { - $results = array(); + $results = []; foreach ($values as $k => $v) { // FIXME: this is an encapsulation violation if ($k[0] == '_') { @@ -63,26 +65,34 @@ abstract class Util */ public static function convertToStripeObject($resp, $opts) { - $types = array( + $types = [ + // data structures + 'list' => 'Stripe\\Collection', + + // business objects 'account' => 'Stripe\\Account', 'alipay_account' => 'Stripe\\AlipayAccount', 'apple_pay_domain' => 'Stripe\\ApplePayDomain', - 'bank_account' => 'Stripe\\BankAccount', + 'application_fee' => 'Stripe\\ApplicationFee', + 'balance' => 'Stripe\\Balance', 'balance_transaction' => 'Stripe\\BalanceTransaction', + 'bank_account' => 'Stripe\\BankAccount', + 'bitcoin_receiver' => 'Stripe\\BitcoinReceiver', + 'bitcoin_transaction' => 'Stripe\\BitcoinTransaction', 'card' => 'Stripe\\Card', 'charge' => 'Stripe\\Charge', 'country_spec' => 'Stripe\\CountrySpec', 'coupon' => 'Stripe\\Coupon', 'customer' => 'Stripe\\Customer', 'dispute' => 'Stripe\\Dispute', - 'list' => 'Stripe\\Collection', + 'ephemeral_key' => 'Stripe\\EphemeralKey', + 'event' => 'Stripe\\Event', + 'exchange_rate' => 'Stripe\\ExchangeRate', + 'fee_refund' => 'Stripe\\ApplicationFeeRefund', + 'file_upload' => 'Stripe\\FileUpload', 'invoice' => 'Stripe\\Invoice', 'invoiceitem' => 'Stripe\\InvoiceItem', - 'event' => 'Stripe\\Event', - 'file' => 'Stripe\\FileUpload', - 'token' => 'Stripe\\Token', - 'transfer' => 'Stripe\\Transfer', - 'transfer_reversal' => 'Stripe\\TransferReversal', + 'login_link' => 'Stripe\\LoginLink', 'order' => 'Stripe\\Order', 'order_return' => 'Stripe\\OrderReturn', 'payout' => 'Stripe\\Payout', @@ -93,15 +103,17 @@ abstract class Util 'refund' => 'Stripe\\Refund', 'sku' => 'Stripe\\SKU', 'source' => 'Stripe\\Source', + 'source_transaction' => 'Stripe\\SourceTransaction', 'subscription' => 'Stripe\\Subscription', 'subscription_item' => 'Stripe\\SubscriptionItem', 'three_d_secure' => 'Stripe\\ThreeDSecure', - 'fee_refund' => 'Stripe\\ApplicationFeeRefund', - 'bitcoin_receiver' => 'Stripe\\BitcoinReceiver', - 'bitcoin_transaction' => 'Stripe\\BitcoinTransaction', - ); + 'token' => 'Stripe\\Token', + 'topup' => 'Stripe\\Topup', + 'transfer' => 'Stripe\\Transfer', + 'transfer_reversal' => 'Stripe\\TransferReversal', + ]; if (self::isList($resp)) { - $mapped = array(); + $mapped = []; foreach ($resp as $i) { array_push($mapped, self::convertToStripeObject($i, $opts)); } @@ -143,4 +155,84 @@ abstract class Util return $value; } } + + /** + * Compares two strings for equality. The time taken is independent of the + * number of characters that match. + * + * @param string $a one of the strings to compare. + * @param string $b the other string to compare. + * @return bool true if the strings are equal, false otherwise. + */ + public static function secureCompare($a, $b) + { + if (self::$isHashEqualsAvailable === null) { + self::$isHashEqualsAvailable = function_exists('hash_equals'); + } + + if (self::$isHashEqualsAvailable) { + return hash_equals($a, $b); + } else { + if (strlen($a) != strlen($b)) { + return false; + } + + $result = 0; + for ($i = 0; $i < strlen($a); $i++) { + $result |= ord($a[$i]) ^ ord($b[$i]); + } + return ($result == 0); + } + } + + /** + * @param array $arr A map of param keys to values. + * @param string|null $prefix + * + * @return string A querystring, essentially. + */ + public static function urlEncode($arr, $prefix = null) + { + if (!is_array($arr)) { + return $arr; + } + + $r = []; + foreach ($arr as $k => $v) { + if (is_null($v)) { + continue; + } + + if ($prefix) { + if ($k !== null && (!is_int($k) || is_array($v))) { + $k = $prefix."[".$k."]"; + } else { + $k = $prefix."[]"; + } + } + + if (is_array($v)) { + $enc = self::urlEncode($v, $k); + if ($enc) { + $r[] = $enc; + } + } else { + $r[] = urlencode($k)."=".urlencode($v); + } + } + + return implode("&", $r); + } + + public static function normalizeId($id) + { + if (is_array($id)) { + $params = $id; + $id = $params['id']; + unset($params['id']); + } else { + $params = []; + } + return [$id, $params]; + } } diff --git a/htdocs/includes/stripe/tests/AccountTest.php b/htdocs/includes/stripe/tests/AccountTest.php deleted file mode 100644 index 994ba6f6a8a..00000000000 --- a/htdocs/includes/stripe/tests/AccountTest.php +++ /dev/null @@ -1,300 +0,0 @@ - $id, - 'currencies_supported' => array('usd', 'aed', 'afn', '...'), - 'object' => 'account', - 'business_name' => 'Stripe.com', - 'bank_accounts' => array( - 'object' => 'list', - 'total_count' => 0, - 'has_more' => false, - 'url' => '/v1/accounts/' . $id . '/bank_accounts', - 'data' => array() - ), - 'verification' => array( - 'fields_needed' => array( - 'product_description', - 'business_url', - 'support_phone', - 'bank_account', - 'tos_acceptance.ip', - 'tos_acceptance.date' - ), - 'due_by' => null, - 'contacted' => false - ), - 'tos_acceptance' => array( - 'ip' => null, - 'date' => null, - 'user_agent' => null - ), - 'legal_entity' => array( - 'type' => null, - 'business_name' => null, - 'address' => array( - 'line1' => null, - 'line2' => null, - 'city' => null, - 'state' => null, - 'postal_code' => null, - 'country' => 'US' - ), - 'first_name' => null, - 'last_name' => null, - 'additional_owners' => null, - 'verification' => array( - 'status' => 'unverified', - 'document' => null, - 'details' => null - ) - ) - ); - } - - private function deletedAccountResponse($id) - { - return array( - 'id' => $id, - 'deleted' => true - ); - } - - public function testBasicRetrieve() - { - $this->mockRequest('GET', '/v1/account', array(), $this->managedAccountResponse('acct_ABC')); - $account = Account::retrieve(); - $this->assertSame($account->id, 'acct_ABC'); - } - - public function testIDRetrieve() - { - $this->mockRequest('GET', '/v1/accounts/acct_DEF', array(), $this->managedAccountResponse('acct_DEF')); - $account = Account::retrieve('acct_DEF'); - $this->assertSame($account->id, 'acct_DEF'); - } - - public function testCreate() - { - $this->mockRequest( - 'POST', - '/v1/accounts', - array('managed' => 'true'), - $this->managedAccountResponse('acct_ABC') - ); - $account = Account::create(array( - 'managed' => true - )); - $this->assertSame($account->id, 'acct_ABC'); - } - - public function testDelete() - { - $account = self::createTestAccount(); - - $this->mockRequest( - 'DELETE', - '/v1/accounts/' . $account->id, - array(), - $this->deletedAccountResponse('acct_ABC') - ); - $deleted = $account->delete(); - $this->assertSame($deleted->id, $account->id); - $this->assertTrue($deleted->deleted); - } - - public function testReject() - { - $account = self::createTestAccount(); - - $this->mockRequest( - 'POST', - '/v1/accounts/' . $account->id . '/reject', - array('reason' => 'fraud'), - $this->deletedAccountResponse('acct_ABC') - ); - $rejected = $account->reject(array('reason' => 'fraud')); - $this->assertSame($rejected->id, $account->id); - } - - public function testSaveLegalEntity() - { - $response = $this->managedAccountResponse('acct_ABC'); - $this->mockRequest('POST', '/v1/accounts', array('managed' => 'true'), $response); - - $response['legal_entity']['first_name'] = 'Bob'; - $this->mockRequest( - 'POST', - '/v1/accounts/acct_ABC', - array('legal_entity' => array('first_name' => 'Bob')), - $response - ); - - $account = Account::create(array('managed' => true)); - $account->legal_entity->first_name = 'Bob'; - $account->save(); - - $this->assertSame('Bob', $account->legal_entity->first_name); - } - - public function testUpdateLegalEntity() - { - $response = $this->managedAccountResponse('acct_ABC'); - $this->mockRequest('POST', '/v1/accounts', array('managed' => 'true'), $response); - - $response['legal_entity']['first_name'] = 'Bob'; - $this->mockRequest( - 'POST', - '/v1/accounts/acct_ABC', - array('legal_entity' => array('first_name' => 'Bob')), - $response - ); - - $account = Account::create(array('managed' => true)); - $account = Account::update($account['id'], array( - 'legal_entity' => array( - 'first_name' => 'Bob' - ) - )); - - $this->assertSame('Bob', $account->legal_entity->first_name); - } - - public function testCreateAdditionalOwners() - { - $request = array( - 'managed' => true, - 'country' => 'GB', - 'legal_entity' => array( - 'additional_owners' => array( - 0 => array( - 'dob' => array( - 'day' => 12, - 'month' => 5, - 'year' => 1970, - ), - 'first_name' => 'xgvukvfrde', - 'last_name' => 'rtcyvubhy', - ), - 1 => array( - 'dob' => array( - 'day' => 8, - 'month' => 4, - 'year' => 1979, - ), - 'first_name' => 'yutreuk', - 'last_name' => 'dfcgvhbjihmv', - ), - ), - ), - ); - - $acct = Account::create($request); - $response = $acct->__toArray(true); - - $req_ao = $request['legal_entity']['additional_owners']; - $resp_ao = $response['legal_entity']['additional_owners']; - - $this->assertSame($req_ao[0]['dob'], $resp_ao[0]['dob']); - $this->assertSame($req_ao[1]['dob'], $resp_ao[1]['dob']); - - $this->assertSame($req_ao[0]['first_name'], $resp_ao[0]['first_name']); - $this->assertSame($req_ao[1]['first_name'], $resp_ao[1]['first_name']); - } - - public function testUpdateAdditionalOwners() - { - $response = $this->managedAccountResponse('acct_ABC'); - $this->mockRequest('POST', '/v1/accounts', array('managed' => 'true'), $response); - - $response['legal_entity']['additional_owners'] = array(array( - 'first_name' => 'Bob', - 'last_name' => null, - 'address' => array( - 'line1' => null, - 'line2' => null, - 'city' => null, - 'state' => null, - 'postal_code' => null, - 'country' => null - ), - 'verification' => array( - 'status' => 'unverified', - 'document' => null, - 'details' => null - ) - )); - - $this->mockRequest( - 'POST', - '/v1/accounts/acct_ABC', - array('legal_entity' => array('additional_owners' => array(array('first_name' => 'Bob')))), - $response - ); - - $response['legal_entity']['additional_owners'][0]['last_name'] = 'Smith'; - $this->mockRequest( - 'POST', - '/v1/accounts/acct_ABC', - array('legal_entity' => array('additional_owners' => array(array('last_name' => 'Smith')))), - $response - ); - - $response['legal_entity']['additional_owners'][0]['last_name'] = 'Johnson'; - $this->mockRequest( - 'POST', - '/v1/accounts/acct_ABC', - array('legal_entity' => array('additional_owners' => array(array('last_name' => 'Johnson')))), - $response - ); - - $response['legal_entity']['additional_owners'][0]['verification']['document'] = 'file_123'; - $this->mockRequest( - 'POST', - '/v1/accounts/acct_ABC', - array('legal_entity' => array('additional_owners' => array(array('verification' => array('document' => 'file_123'))))), - $response - ); - - $response['legal_entity']['additional_owners'][1] = array( - 'first_name' => 'Jane', - 'last_name' => 'Doe' - ); - $this->mockRequest( - 'POST', - '/v1/accounts/acct_ABC', - array('legal_entity' => array('additional_owners' => array(1 => array('first_name' => 'Jane')))), - $response - ); - - $account = Account::create(array('managed' => true)); - $account->legal_entity->additional_owners = array(array('first_name' => 'Bob')); - $account->save(); - $this->assertSame(1, count($account->legal_entity->additional_owners)); - $this->assertSame('Bob', $account->legal_entity->additional_owners[0]->first_name); - - $account->legal_entity->additional_owners[0]->last_name = 'Smith'; - $account->save(); - $this->assertSame(1, count($account->legal_entity->additional_owners)); - $this->assertSame('Smith', $account->legal_entity->additional_owners[0]->last_name); - - $account['legal_entity']['additional_owners'][0]['last_name'] = 'Johnson'; - $account->save(); - $this->assertSame(1, count($account->legal_entity->additional_owners)); - $this->assertSame('Johnson', $account->legal_entity->additional_owners[0]->last_name); - - $account->legal_entity->additional_owners[0]->verification->document = 'file_123'; - $account->save(); - $this->assertSame('file_123', $account->legal_entity->additional_owners[0]->verification->document); - - $account->legal_entity->additional_owners[1] = array('first_name' => 'Jane'); - $account->save(); - $this->assertSame('Jane', $account->legal_entity->additional_owners[1]->first_name); - } -} diff --git a/htdocs/includes/stripe/tests/ApiRequestorTest.php b/htdocs/includes/stripe/tests/ApiRequestorTest.php deleted file mode 100644 index 859fb63a347..00000000000 --- a/htdocs/includes/stripe/tests/ApiRequestorTest.php +++ /dev/null @@ -1,68 +0,0 @@ -getMethod('_encodeObjects'); - $method->setAccessible(true); - - $a = array('customer' => new Customer('abcd')); - $enc = $method->invoke(null, $a); - $this->assertSame($enc, array('customer' => 'abcd')); - - // Preserves UTF-8 - $v = array('customer' => "☃"); - $enc = $method->invoke(null, $v); - $this->assertSame($enc, $v); - - // Encodes latin-1 -> UTF-8 - $v = array('customer' => "\xe9"); - $enc = $method->invoke(null, $v); - $this->assertSame($enc, array('customer' => "\xc3\xa9")); - } - - public function testHttpClientInjection() - { - $reflector = new \ReflectionClass('Stripe\\ApiRequestor'); - $method = $reflector->getMethod('httpClient'); - $method->setAccessible(true); - - $curl = new CurlClient(); - $curl->setTimeout(10); - ApiRequestor::setHttpClient($curl); - - $injectedCurl = $method->invoke(new ApiRequestor()); - $this->assertSame($injectedCurl, $curl); - } - - public function testDefaultHeaders() - { - $reflector = new \ReflectionClass('Stripe\\ApiRequestor'); - $method = $reflector->getMethod('_defaultHeaders'); - $method->setAccessible(true); - - // no way to stub static methods with PHPUnit 4.x :( - Stripe::setAppInfo('MyTestApp', '1.2.34', 'https://mytestapp.example'); - $apiKey = 'sk_test_notarealkey'; - - $headers = $method->invoke(null, $apiKey); - - $ua = json_decode($headers['X-Stripe-Client-User-Agent']); - $this->assertSame($ua->application->name, 'MyTestApp'); - $this->assertSame($ua->application->version, '1.2.34'); - $this->assertSame($ua->application->url, 'https://mytestapp.example'); - - $this->assertSame( - $headers['User-Agent'], - 'Stripe/v1 PhpBindings/' . Stripe::VERSION . ' MyTestApp/1.2.34 (https://mytestapp.example)' - ); - - $this->assertSame($headers['Authorization'], 'Bearer ' . $apiKey); - } -} diff --git a/htdocs/includes/stripe/tests/ApplePayDomainTest.php b/htdocs/includes/stripe/tests/ApplePayDomainTest.php deleted file mode 100644 index ebb3e7cfa9d..00000000000 --- a/htdocs/includes/stripe/tests/ApplePayDomainTest.php +++ /dev/null @@ -1,72 +0,0 @@ -mockRequest( - 'POST', - '/v1/apple_pay/domains', - array('domain_name' => 'test.com'), - array( - 'id' => 'apwc_create', - 'object' => 'apple_pay_domain' - ) - ); - $d = ApplePayDomain::create(array( - 'domain_name' => 'test.com' - )); - $this->assertSame('apwc_create', $d->id); - $this->assertInstanceOf('Stripe\\ApplePayDomain', $d); - } - - public function testRetrieve() - { - $this->mockRequest( - 'GET', - '/v1/apple_pay/domains/apwc_retrieve', - array(), - array( - 'id' => 'apwc_retrieve', - 'object' => 'apple_pay_domain' - ) - ); - $d = ApplePayDomain::retrieve('apwc_retrieve'); - $this->assertSame('apwc_retrieve', $d->id); - $this->assertInstanceOf('Stripe\\ApplePayDomain', $d); - } - - public function testDeletion() - { - self::authorizeFromEnv(); - $d = ApplePayDomain::create(array( - 'domain_name' => 'jackshack.website' - )); - $this->assertInstanceOf('Stripe\\ApplePayDomain', $d); - $this->mockRequest( - 'DELETE', - '/v1/apple_pay/domains/' . $d->id, - array(), - array('deleted' => true) - ); - $d->delete(); - $this->assertTrue($d->deleted); - } - - public function testList() - { - $this->mockRequest( - 'GET', - '/v1/apple_pay/domains', - array(), - array( - 'url' => '/v1/apple_pay/domains', - 'object' => 'list' - ) - ); - $all = ApplePayDomain::all(); - $this->assertSame($all->url, '/v1/apple_pay/domains'); - } -} diff --git a/htdocs/includes/stripe/tests/ApplicationFeeRefundTest.php b/htdocs/includes/stripe/tests/ApplicationFeeRefundTest.php deleted file mode 100644 index b8d266ad1eb..00000000000 --- a/htdocs/includes/stripe/tests/ApplicationFeeRefundTest.php +++ /dev/null @@ -1,18 +0,0 @@ -id = 'refund_id'; - $refund->fee = 'fee_id'; - - $this->assertSame( - $refund->instanceUrl(), - '/v1/application_fees/fee_id/refunds/refund_id' - ); - } -} diff --git a/htdocs/includes/stripe/tests/ApplicationFeeTest.php b/htdocs/includes/stripe/tests/ApplicationFeeTest.php deleted file mode 100644 index fe6df923084..00000000000 --- a/htdocs/includes/stripe/tests/ApplicationFeeTest.php +++ /dev/null @@ -1,22 +0,0 @@ -assertSame( - $applicationFee->instanceUrl(), - '/v1/application_fees/abcd%2Fefgh' - ); - } - - public function testList() - { - self::authorizeFromEnv(); - $d = ApplicationFee::all(); - $this->assertSame($d->url, '/v1/application_fees'); - } -} diff --git a/htdocs/includes/stripe/tests/AuthenticationErrorTest.php b/htdocs/includes/stripe/tests/AuthenticationErrorTest.php deleted file mode 100644 index 1003d6990c8..00000000000 --- a/htdocs/includes/stripe/tests/AuthenticationErrorTest.php +++ /dev/null @@ -1,16 +0,0 @@ -assertSame(401, $e->getHttpStatus()); - } - } -} diff --git a/htdocs/includes/stripe/tests/BalanceTest.php b/htdocs/includes/stripe/tests/BalanceTest.php deleted file mode 100644 index 3d6a2a668f0..00000000000 --- a/htdocs/includes/stripe/tests/BalanceTest.php +++ /dev/null @@ -1,15 +0,0 @@ -assertSame($d->object, "balance"); - $this->assertTrue(Util\Util::isList($d->available)); - $this->assertTrue(Util\Util::isList($d->pending)); - } -} diff --git a/htdocs/includes/stripe/tests/BalanceTransactionTest.php b/htdocs/includes/stripe/tests/BalanceTransactionTest.php deleted file mode 100644 index b196a288014..00000000000 --- a/htdocs/includes/stripe/tests/BalanceTransactionTest.php +++ /dev/null @@ -1,13 +0,0 @@ -assertSame($d->url, '/v1/balance/history'); - } -} diff --git a/htdocs/includes/stripe/tests/BankAccountTest.php b/htdocs/includes/stripe/tests/BankAccountTest.php deleted file mode 100644 index 285078f00ad..00000000000 --- a/htdocs/includes/stripe/tests/BankAccountTest.php +++ /dev/null @@ -1,32 +0,0 @@ -sources->create(array( - 'source' => array( - 'object' => 'bank_account', - 'account_holder_type' => 'individual', - 'account_number' => '000123456789', - 'account_holder_name' => 'John Doe', - 'routing_number' => '110000000', - 'country' => 'US' - ) - )); - - $this->assertSame($bankAccount->status, 'new'); - - $bankAccount = $bankAccount->verify(array( - 'amounts' => array(32, 45) - )); - - $this->assertSame($bankAccount->status, 'verified'); - } -} diff --git a/htdocs/includes/stripe/tests/BitcoinReceiverTest.php b/htdocs/includes/stripe/tests/BitcoinReceiverTest.php deleted file mode 100644 index fc71cf973a5..00000000000 --- a/htdocs/includes/stripe/tests/BitcoinReceiverTest.php +++ /dev/null @@ -1,120 +0,0 @@ -assertSame($classUrl, '/v1/bitcoin/receivers'); - $receiver = new BitcoinReceiver('abcd/efgh'); - $instanceUrl = $receiver->instanceUrl(); - $this->assertSame($instanceUrl, '/v1/bitcoin/receivers/abcd%2Fefgh'); - } - - public function testCreate() - { - self::authorizeFromEnv(); - - $receiver = $this->createTestBitcoinReceiver("do+fill_now@stripe.com"); - - $this->assertSame(100, $receiver->amount); - $this->assertNotNull($receiver->id); - } - - public function testRetrieve() - { - self::authorizeFromEnv(); - - $receiver = $this->createTestBitcoinReceiver("do+fill_now@stripe.com"); - - $r = BitcoinReceiver::retrieve($receiver->id); - $this->assertSame($receiver->id, $r->id); - - $this->assertInstanceOf('Stripe\\BitcoinTransaction', $r->transactions->data[0]); - } - - public function testList() - { - self::authorizeFromEnv(); - - $receiver = $this->createTestBitcoinReceiver("do+fill_now@stripe.com"); - - $receivers = BitcoinReceiver::all(); - $this->assertGreaterThan(0, count($receivers->data)); - } - - public function testListTransactions() - { - self::authorizeFromEnv(); - - $receiver = $this->createTestBitcoinReceiver("do+fill_now@stripe.com"); - $this->assertSame(0, count($receiver->transactions->data)); - - $transactions = $receiver->transactions->all(array("limit" => 1)); - $this->assertSame(1, count($transactions->data)); - } - - public function testDeleteWithCustomer() - { - self::authorizeFromEnv(); - $receiver = $this->createTestBitcoinReceiver("do+fill_now@stripe.com"); - $customer = Customer::create(array("source" => $receiver->id)); - $charge = Charge::create(array( - "customer" => $customer->id, - "amount" => $receiver->amount, - "currency" => $receiver->currency - )); - $receiver = BitcoinReceiver::retrieve($receiver->id); - $response = $receiver->delete(); - $this->assertTrue($response->deleted); - } - - public function testUpdateWithCustomer() - { - self::authorizeFromEnv(); - $receiver = $this->createTestBitcoinReceiver("do+fill_now@stripe.com"); - $customer = Customer::create(array("source" => $receiver->id)); - $receiver = BitcoinReceiver::retrieve($receiver->id); - - $receiver->description = "a new description"; - $receiver->save(); - - $base = Customer::classUrl(); - $parentExtn = $receiver['customer']; - $extn = $receiver['id']; - $this->assertEquals("$base/$parentExtn/sources/$extn", $receiver->instanceUrl()); - - $updatedReceiver = BitcoinReceiver::retrieve($receiver->id); - $this->assertEquals($receiver["description"], $updatedReceiver["description"]); - } - - public function testUpdateWithoutCustomer() - { - self::authorizeFromEnv(); - $receiver = $this->createTestBitcoinReceiver("do+fill_now@stripe.com"); - - $receiver->description = "a new description"; - $receiver->save(); - - $this->assertEquals(BitcoinReceiver::classUrl() . "/" . $receiver['id'], $receiver->instanceUrl()); - - $updatedReceiver = BitcoinReceiver::retrieve($receiver->id); - $this->assertEquals($receiver["description"], $updatedReceiver["description"]); - } - - public function testRefund() - { - self::authorizeFromEnv(); - $receiver = $this->createTestBitcoinReceiver("do+fill_now@stripe.com"); - - $receiver = BitcoinReceiver::retrieve($receiver->id); - $this->assertNull($receiver->refund_address); - - $refundAddress = "REFUNDHERE"; - $receiver->refund(array("refund_address" => $refundAddress)); - - $this->assertSame($refundAddress, $receiver->refund_address); - } -} diff --git a/htdocs/includes/stripe/tests/CardErrorTest.php b/htdocs/includes/stripe/tests/CardErrorTest.php deleted file mode 100644 index a0de752e512..00000000000 --- a/htdocs/includes/stripe/tests/CardErrorTest.php +++ /dev/null @@ -1,41 +0,0 @@ - '4000000000000002', - 'exp_month' => '3', - 'exp_year' => '2020' - ); - - $charge = array( - 'amount' => 100, - 'currency' => 'usd', - 'card' => $card - ); - - try { - Charge::create($charge); - } catch (Error\Card $e) { - $this->assertSame(402, $e->getHttpStatus()); - $this->assertTrue(strpos($e->getRequestId(), "req_") === 0, $e->getRequestId()); - $actual = $e->getJsonBody(); - $this->assertSame( - array('error' => array( - 'message' => 'Your card was declined.', - 'type' => 'card_error', - 'code' => 'card_declined', - 'decline_code' => 'generic_decline', - 'charge' => $actual['error']['charge'], - )), - $actual - ); - } - } -} diff --git a/htdocs/includes/stripe/tests/ChargeTest.php b/htdocs/includes/stripe/tests/ChargeTest.php deleted file mode 100644 index 6ec0fa1f1d4..00000000000 --- a/htdocs/includes/stripe/tests/ChargeTest.php +++ /dev/null @@ -1,204 +0,0 @@ -assertSame(Charge::classUrl(), '/v1/charges'); - $charge = new Charge('abcd/efgh'); - $this->assertSame($charge->instanceUrl(), '/v1/charges/abcd%2Fefgh'); - } - - public function testCreate() - { - self::authorizeFromEnv(); - - $card = array( - 'number' => '4242424242424242', - 'exp_month' => 5, - 'exp_year' => date('Y') + 1 - ); - - $c = Charge::create( - array( - 'amount' => 100, - 'currency' => 'usd', - 'card' => $card - ) - ); - $this->assertTrue($c->paid); - $this->assertFalse($c->refunded); - } - - public function testIdempotentCreate() - { - self::authorizeFromEnv(); - - $card = array( - 'number' => '4242424242424242', - 'exp_month' => 5, - 'exp_year' => date('Y') + 1 - ); - - $c = Charge::create( - array( - 'amount' => 100, - 'currency' => 'usd', - 'card' => $card - ), - array( - 'idempotency_key' => self::generateRandomString(), - ) - ); - - $this->assertTrue($c->paid); - $this->assertSame(200, $c->getLastResponse()->code); - } - - public function testRetrieve() - { - self::authorizeFromEnv(); - - $card = array( - 'number' => '4242424242424242', - 'exp_month' => 5, - 'exp_year' => date('Y') + 1 - ); - - $c = Charge::create( - array( - 'amount' => 100, - 'currency' => 'usd', - 'card' => $card - ) - ); - $d = Charge::retrieve($c->id); - $this->assertSame(200, $d->getLastResponse()->code); - $this->assertSame($d->id, $c->id); - } - - public function testUpdateMetadata() - { - self::authorizeFromEnv(); - - $card = array( - 'number' => '4242424242424242', - 'exp_month' => 5, - 'exp_year' => date('Y') + 1 - ); - - $charge = Charge::create( - array( - 'amount' => 100, - 'currency' => 'usd', - 'card' => $card - ) - ); - - $charge->metadata['test'] = 'foo bar'; - $charge->save(); - - $updatedCharge = Charge::retrieve($charge->id); - $this->assertSame('foo bar', $updatedCharge->metadata['test']); - } - - public function testUpdateMetadataAll() - { - self::authorizeFromEnv(); - - $card = array( - 'number' => '4242424242424242', - 'exp_month' => 5, - 'exp_year' => date('Y') + 1 - ); - - $charge = Charge::create( - array( - 'amount' => 100, - 'currency' => 'usd', - 'card' => $card - ) - ); - - $charge->metadata = array('test' => 'foo bar'); - $charge->save(); - $this->assertSame(200, $charge->getLastResponse()->code); - - $updatedCharge = Charge::retrieve($charge->id); - $this->assertSame('foo bar', $updatedCharge->metadata['test']); - } - - public function testMarkAsFraudulent() - { - self::authorizeFromEnv(); - - $card = array( - 'number' => '4242424242424242', - 'exp_month' => 5, - 'exp_year' => date('Y') + 1 - ); - - $charge = Charge::create( - array( - 'amount' => 100, - 'currency' => 'usd', - 'card' => $card - ) - ); - - $charge->refunds->create(); - $charge->markAsFraudulent(); - - $updatedCharge = Charge::retrieve($charge->id); - $this->assertSame( - 'fraudulent', - $updatedCharge['fraud_details']['user_report'] - ); - } - - public function testCreateWithBitcoinReceiverSource() - { - self::authorizeFromEnv(); - - $receiver = $this->createTestBitcoinReceiver("do+fill_now@stripe.com"); - - $charge = Charge::create( - array( - 'amount' => 100, - 'currency' => 'usd', - 'source' => $receiver->id - ) - ); - - $this->assertSame($receiver->id, $charge->source->id); - $this->assertSame("bitcoin_receiver", $charge->source->object); - $this->assertSame("succeeded", $charge->status); - $this->assertInstanceOf('Stripe\\BitcoinReceiver', $charge->source); - } - - public function markAsSafe() - { - self::authorizeFromEnv(); - - $card = array( - 'number' => '4242424242424242', - 'exp_month' => 5, - 'exp_year' => date('Y') + 1 - ); - - $charge = Charge::create( - array( - 'amount' => 100, - 'currency' => 'usd', - 'card' => $card - ) - ); - - $charge->markAsSafe(); - - $updatedCharge = Charge::retrieve($charge->id); - $this->assertSame('safe', $updatedCharge['fraud_details']['user_report']); - } -} diff --git a/htdocs/includes/stripe/tests/CollectionTest.php b/htdocs/includes/stripe/tests/CollectionTest.php deleted file mode 100644 index f8f923ff00d..00000000000 --- a/htdocs/includes/stripe/tests/CollectionTest.php +++ /dev/null @@ -1,105 +0,0 @@ - $id, - 'object' => 'pageablemodel' - )); - } - return array( - 'object' => 'list', - 'url' => '/v1/pageablemodels', - 'data' => $data, - 'has_more' => $hasMore - ); - } - - public function testAutoPagingOnePage() - { - $collection = Collection::constructFrom( - $this->pageableModelResponse(array('pm_123', 'pm_124'), false), - new Util\RequestOptions() - ); - - $seen = array(); - foreach ($collection->autoPagingIterator() as $item) { - array_push($seen, $item['id']); - } - - $this->assertSame($seen, array('pm_123', 'pm_124')); - } - - public function testAutoPagingThreePages() - { - $collection = Collection::constructFrom( - $this->pageableModelResponse(array('pm_123', 'pm_124'), true), - new Util\RequestOptions() - ); - $collection->setRequestParams(array('foo' => 'bar')); - - $this->mockRequest( - 'GET', - '/v1/pageablemodels', - array( - 'foo' => 'bar', - 'starting_after' => 'pm_124' - ), - $this->pageableModelResponse(array('pm_125', 'pm_126'), true) - ); - $this->mockRequest( - 'GET', - '/v1/pageablemodels', - array( - 'foo' => 'bar', - 'starting_after' => 'pm_126' - ), - $this->pageableModelResponse(array('pm_127'), false) - ); - - $seen = array(); - foreach ($collection->autoPagingIterator() as $item) { - array_push($seen, $item['id']); - } - - $this->assertSame($seen, array('pm_123', 'pm_124', 'pm_125', 'pm_126', 'pm_127')); - } - - public function testIteratorToArray() - { - $collection = Collection::constructFrom( - $this->pageableModelResponse(array('pm_123', 'pm_124'), true), - new Util\RequestOptions() - ); - - $this->mockRequest( - 'GET', - '/v1/pageablemodels', - array( - 'starting_after' => 'pm_124' - ), - $this->pageableModelResponse(array('pm_125', 'pm_126'), true) - ); - $this->mockRequest( - 'GET', - '/v1/pageablemodels', - array( - 'starting_after' => 'pm_126' - ), - $this->pageableModelResponse(array('pm_127'), false) - ); - - $seen = array(); - foreach (iterator_to_array($collection->autoPagingIterator()) as $item) { - array_push($seen, $item['id']); - } - - $this->assertSame($seen, array('pm_123', 'pm_124', 'pm_125', 'pm_126', 'pm_127')); - } -} diff --git a/htdocs/includes/stripe/tests/CountrySpecTest.php b/htdocs/includes/stripe/tests/CountrySpecTest.php deleted file mode 100644 index 19dc37062e5..00000000000 --- a/htdocs/includes/stripe/tests/CountrySpecTest.php +++ /dev/null @@ -1,31 +0,0 @@ -assertSame($d->object, "country_spec"); - $this->assertSame($d->id, $country); - $this->assertGreaterThan(0, count($d->supported_bank_account_currencies)); - $this->assertGreaterThan(0, count($d->supported_payment_currencies)); - $this->assertGreaterThan(0, count($d->supported_payment_methods)); - $this->assertGreaterThan(0, count($d->verification_fields)); - } - - public function testList() - { - self::authorizeFromEnv(); - - $d = CountrySpec::all(); - $this->assertSame($d->object, "list"); - $this->assertGreaterThan(0, count($d->data)); - $this->assertSame($d->data[0]->object, "country_spec"); - $this->assertInstanceOf("Stripe\\CountrySpec", $d->data[0]); - } -} diff --git a/htdocs/includes/stripe/tests/CouponTest.php b/htdocs/includes/stripe/tests/CouponTest.php deleted file mode 100644 index d23163e338e..00000000000 --- a/htdocs/includes/stripe/tests/CouponTest.php +++ /dev/null @@ -1,29 +0,0 @@ - 25, - 'duration' => 'repeating', - 'duration_in_months' => 5, - 'id' => $id, - ) - ); - $this->assertSame($id, $c->id); - // @codingStandardsIgnoreStart - $this->assertSame(25, $c->percent_off); - // @codingStandardsIgnoreEnd - $c->metadata['foo'] = 'bar'; - $c->save(); - - $stripeCoupon = Coupon::retrieve($id); - $this->assertEquals($c->metadata, $stripeCoupon->metadata); - } -} diff --git a/htdocs/includes/stripe/tests/CurlClientTest.php b/htdocs/includes/stripe/tests/CurlClientTest.php deleted file mode 100644 index 864607f088c..00000000000 --- a/htdocs/includes/stripe/tests/CurlClientTest.php +++ /dev/null @@ -1,100 +0,0 @@ -assertSame(CurlClient::DEFAULT_TIMEOUT, $curl->getTimeout()); - $this->assertSame(CurlClient::DEFAULT_CONNECT_TIMEOUT, $curl->getConnectTimeout()); - - // implicitly tests whether we're returning the CurlClient instance - $curl = $curl->setConnectTimeout(1)->setTimeout(10); - $this->assertSame(1, $curl->getConnectTimeout()); - $this->assertSame(10, $curl->getTimeout()); - - $curl->setTimeout(-1); - $curl->setConnectTimeout(-999); - $this->assertSame(0, $curl->getTimeout()); - $this->assertSame(0, $curl->getConnectTimeout()); - } - - public function testDefaultOptions() - { - // make sure options array loads/saves properly - $optionsArray = array(CURLOPT_PROXY => 'localhost:80'); - $withOptionsArray = new CurlClient($optionsArray); - $this->assertSame($withOptionsArray->getDefaultOptions(), $optionsArray); - - // make sure closure-based options work properly, including argument passing - $ref = null; - $withClosure = new CurlClient(function ($method, $absUrl, $headers, $params, $hasFile) use (&$ref) { - $ref = func_get_args(); - return array(); - }); - - $withClosure->request('get', 'https://httpbin.org/status/200', array(), array(), false); - $this->assertSame($ref, array('get', 'https://httpbin.org/status/200', array(), array(), false)); - - // this is the last test case that will run, since it'll throw an exception at the end - $withBadClosure = new CurlClient(function () { - return 'thisShouldNotWork'; - }); - $this->setExpectedException('Stripe\Error\Api', "Non-array value returned by defaultOptions CurlClient callback"); - $withBadClosure->request('get', 'https://httpbin.org/status/200', array(), array(), false); - } - - public function testEncode() - { - $a = array( - 'my' => 'value', - 'that' => array('your' => 'example'), - 'bar' => 1, - 'baz' => null - ); - - $enc = CurlClient::encode($a); - $this->assertSame('my=value&that%5Byour%5D=example&bar=1', $enc); - - $a = array('that' => array('your' => 'example', 'foo' => null)); - $enc = CurlClient::encode($a); - $this->assertSame('that%5Byour%5D=example', $enc); - - $a = array('that' => 'example', 'foo' => array('bar', 'baz')); - $enc = CurlClient::encode($a); - $this->assertSame('that=example&foo%5B%5D=bar&foo%5B%5D=baz', $enc); - - $a = array( - 'my' => 'value', - 'that' => array('your' => array('cheese', 'whiz', null)), - 'bar' => 1, - 'baz' => null - ); - - $enc = CurlClient::encode($a); - $expected = 'my=value&that%5Byour%5D%5B%5D=cheese' - . '&that%5Byour%5D%5B%5D=whiz&bar=1'; - $this->assertSame($expected, $enc); - - // Ignores an empty array - $enc = CurlClient::encode(array('foo' => array(), 'bar' => 'baz')); - $expected = 'bar=baz'; - $this->assertSame($expected, $enc); - - $a = array('foo' => array(array('bar' => 'baz'), array('bar' => 'bin'))); - $enc = CurlClient::encode($a); - $this->assertSame('foo%5B0%5D%5Bbar%5D=baz&foo%5B1%5D%5Bbar%5D=bin', $enc); - } - - public function testSslOption() - { - // make sure options array loads/saves properly - $optionsArray = array(CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1); - $withOptionsArray = new CurlClient($optionsArray); - $this->assertSame($withOptionsArray->getDefaultOptions(), $optionsArray); - } -} diff --git a/htdocs/includes/stripe/tests/CustomerTest.php b/htdocs/includes/stripe/tests/CustomerTest.php deleted file mode 100644 index 606536ee86f..00000000000 --- a/htdocs/includes/stripe/tests/CustomerTest.php +++ /dev/null @@ -1,278 +0,0 @@ -delete(); - - $this->assertTrue($customer->deleted); - $this->assertNull($customer['active_card']); - } - - public function testSave() - { - $customer = self::createTestCustomer(); - - $customer->email = 'gdb@stripe.com'; - $customer->save(); - $this->assertSame($customer->email, 'gdb@stripe.com'); - - $stripeCustomer = Customer::retrieve($customer->id); - $this->assertSame($customer->email, $stripeCustomer->email); - - Stripe::setApiKey(null); - $customer = Customer::create(null, self::API_KEY); - $customer->email = 'gdb@stripe.com'; - $customer->save(); - - self::authorizeFromEnv(); - $updatedCustomer = Customer::retrieve($customer->id); - $this->assertSame($updatedCustomer->email, 'gdb@stripe.com'); - } - - /** - * @expectedException Stripe\Error\InvalidRequest - */ - public function testBogusAttribute() - { - $customer = self::createTestCustomer(); - $customer->bogus = 'bogus'; - $customer->save(); - } - - /** - * @expectedException InvalidArgumentException - */ - public function testUpdateDescriptionEmpty() - { - $customer = self::createTestCustomer(); - $customer->description = ''; - } - - public function testUpdateDescriptionNull() - { - $customer = self::createTestCustomer(array('description' => 'foo bar')); - $customer->description = null; - - $customer->save(); - - $updatedCustomer = Customer::retrieve($customer->id); - $this->assertSame(null, $updatedCustomer->description); - } - - public function testUpdateMetadata() - { - $customer = self::createTestCustomer(); - - $customer->metadata['test'] = 'foo bar'; - $customer->save(); - - $updatedCustomer = Customer::retrieve($customer->id); - $this->assertSame('foo bar', $updatedCustomer->metadata['test']); - } - - public function testDeleteMetadata() - { - $customer = self::createTestCustomer(); - - $customer->metadata = null; - $customer->save(); - - $updatedCustomer = Customer::retrieve($customer->id); - $this->assertSame(0, count($updatedCustomer->metadata->keys())); - } - - public function testUpdateSomeMetadata() - { - $customer = self::createTestCustomer(); - $customer->metadata['shoe size'] = '7'; - $customer->metadata['shirt size'] = 'XS'; - $customer->save(); - - $customer->metadata['shoe size'] = '9'; - $customer->save(); - - $updatedCustomer = Customer::retrieve($customer->id); - $this->assertSame('XS', $updatedCustomer->metadata['shirt size']); - $this->assertSame('9', $updatedCustomer->metadata['shoe size']); - } - - public function testUpdateAllMetadata() - { - $customer = self::createTestCustomer(); - $customer->metadata['shoe size'] = '7'; - $customer->metadata['shirt size'] = 'XS'; - $customer->save(); - - $customer->metadata = array('shirt size' => 'XL'); - $customer->save(); - - $updatedCustomer = Customer::retrieve($customer->id); - $this->assertSame('XL', $updatedCustomer->metadata['shirt size']); - $this->assertFalse(isset($updatedCustomer->metadata['shoe size'])); - } - - /** - * @expectedException Stripe\Error\InvalidRequest - */ - public function testUpdateInvalidMetadata() - { - $customer = self::createTestCustomer(); - $customer->metadata = 'something'; - $customer->save(); - } - - public function testCancelSubscription() - { - $planID = 'gold-' . self::generateRandomString(20); - self::retrieveOrCreatePlan($planID); - - $customer = self::createTestCustomer( - array( - 'plan' => $planID, - ) - ); - - $customer->cancelSubscription(array('at_period_end' => true)); - $this->assertSame($customer->subscription->status, 'active'); - $this->assertTrue($customer->subscription->cancel_at_period_end); - $customer->cancelSubscription(); - $this->assertSame($customer->subscription->status, 'canceled'); - } - - public function testCustomerAddCard() - { - $token = Token::create( - array("card" => array( - "number" => "4242424242424242", - "exp_month" => 5, - "exp_year" => date('Y') + 3, - "cvc" => "314" - )) - ); - - $customer = $this->createTestCustomer(); - $createdCard = $customer->sources->create(array("card" => $token->id)); - $customer->save(); - - $updatedCustomer = Customer::retrieve($customer->id); - $updatedCards = $updatedCustomer->sources->all(); - $this->assertSame(count($updatedCards["data"]), 2); - } - - public function testCustomerUpdateCard() - { - $customer = $this->createTestCustomer(); - $customer->save(); - - $sources = $customer->sources->all(); - $this->assertSame(count($sources["data"]), 1); - - $card = $sources['data'][0]; - $card->name = "Jane Austen"; - $card->save(); - - $updatedCustomer = Customer::retrieve($customer->id); - $updatedCards = $updatedCustomer->sources->all(); - $this->assertSame($updatedCards["data"][0]->name, "Jane Austen"); - } - - public function testCustomerDeleteCard() - { - $token = Token::create( - array("card" => array( - "number" => "4242424242424242", - "exp_month" => 5, - "exp_year" => date('Y') + 3, - "cvc" => "314" - )) - ); - - $customer = $this->createTestCustomer(); - $createdCard = $customer->sources->create(array("card" => $token->id)); - $customer->save(); - - $updatedCustomer = Customer::retrieve($customer->id); - $updatedCards = $updatedCustomer->sources->all(); - $this->assertSame(count($updatedCards["data"]), 2); - - $deleteStatus = $updatedCustomer->sources->retrieve($createdCard->id)->delete(); - $this->assertTrue($deleteStatus->deleted); - $updatedCustomer->save(); - - $postDeleteCustomer = Customer::retrieve($customer->id); - $postDeleteCards = $postDeleteCustomer->sources->all(); - $this->assertSame(count($postDeleteCards["data"]), 1); - } - - public function testCustomerAddSource() - { - self::authorizeFromEnv(); - $token = Token::create( - array("card" => array( - "number" => "4242424242424242", - "exp_month" => 5, - "exp_year" => date('Y') + 3, - "cvc" => "314" - )) - ); - - $customer = $this->createTestCustomer(); - $createdSource = $customer->sources->create(array("source" => $token->id)); - $customer->save(); - - $updatedCustomer = Customer::retrieve($customer->id); - $updatedSources = $updatedCustomer->sources->all(); - $this->assertSame(count($updatedSources["data"]), 2); - } - - public function testCustomerUpdateSource() - { - $customer = $this->createTestCustomer(); - $customer->save(); - - $sources = $customer->sources->all(); - $this->assertSame(count($sources["data"]), 1); - - $source = $sources['data'][0]; - $source->name = "Jane Austen"; - $source->save(); - - $updatedCustomer = Customer::retrieve($customer->id); - $updatedSources = $updatedCustomer->sources->all(); - $this->assertSame($updatedSources["data"][0]->name, "Jane Austen"); - } - - public function testCustomerDeleteSource() - { - self::authorizeFromEnv(); - $token = Token::create( - array("card" => array( - "number" => "4242424242424242", - "exp_month" => 5, - "exp_year" => date('Y') + 3, - "cvc" => "314" - )) - ); - - $customer = $this->createTestCustomer(); - $createdSource = $customer->sources->create(array("source" => $token->id)); - $customer->save(); - - $updatedCustomer = Customer::retrieve($customer->id); - $updatedSources = $updatedCustomer->sources->all(); - $this->assertSame(count($updatedSources["data"]), 2); - - $deleteStatus = $updatedCustomer->sources->retrieve($createdSource->id)->delete(); - $this->assertTrue($deleteStatus->deleted); - $updatedCustomer->save(); - - $postDeleteCustomer = Customer::retrieve($customer->id); - $postDeleteSources = $postDeleteCustomer->sources->all(); - $this->assertSame(count($postDeleteSources["data"]), 1); - } -} diff --git a/htdocs/includes/stripe/tests/DiscountTest.php b/htdocs/includes/stripe/tests/DiscountTest.php deleted file mode 100644 index 1e77029ad2d..00000000000 --- a/htdocs/includes/stripe/tests/DiscountTest.php +++ /dev/null @@ -1,31 +0,0 @@ - 25, - 'duration' => 'repeating', - 'duration_in_months' => 5, - 'id' => $id, - ) - ); - $customer = self::createTestCustomer(array('coupon' => $id)); - - $this->assertTrue(isset($customer->discount)); - $this->assertTrue(isset($customer->discount->coupon)); - $this->assertSame($id, $customer->discount->coupon->id); - - $customer->deleteDiscount(); - $this->assertFalse(isset($customer->discount)); - - $customer = Customer::retrieve($customer->id); - $this->assertFalse(isset($customer->discount)); - } -} diff --git a/htdocs/includes/stripe/tests/DisputeTest.php b/htdocs/includes/stripe/tests/DisputeTest.php deleted file mode 100644 index 3c4f29678ea..00000000000 --- a/htdocs/includes/stripe/tests/DisputeTest.php +++ /dev/null @@ -1,96 +0,0 @@ -assertSame(Dispute::classUrl(), '/v1/disputes'); - $dispute = new Dispute('dp_123'); - $this->assertSame($dispute->instanceUrl(), '/v1/disputes/dp_123'); - } - - private function createDisputedCharge() - { - $card = array( - 'number' => '4000000000000259', - 'exp_month' => 5, - 'exp_year' => date('Y') + 1 - ); - - $c = Charge::create( - array( - 'amount' => 100, - 'currency' => 'usd', - 'card' => $card - ) - ); - $c = Charge::retrieve($c->id); - - $attempts = 0; - - while ($c->dispute === null) { - if ($attempts > 5) { - throw new \Exception("Charge is taking too long to be disputed"); - } - sleep(1); - $c = Charge::retrieve($c->id); - $attempts += 1; - } - - return $c; - } - - public function testAll() - { - self::authorizeFromEnv(); - - $sublist = Dispute::all( - array( - 'limit' => 3, - ) - ); - $this->assertSame(3, count($sublist->data)); - } - - - public function testUpdate() - { - self::authorizeFromEnv(); - - $c = $this->createDisputedCharge(); - - $d = Dispute::retrieve($c->dispute); - $d->evidence["customer_name"] = "Bob"; - $s = $d->save(); - - $this->assertSame($c->dispute, $s->id); - $this->assertSame("Bob", $s->evidence["customer_name"]); - } - - public function testClose() - { - self::authorizeFromEnv(); - - $c = $this->createDisputedCharge(); - $d = Dispute::retrieve($c->dispute); - - $this->assertNotSame("lost", $d->status); - - $d->close(); - - $this->assertSame("lost", $d->status); - } - - public function testRetrieve() - { - self::authorizeFromEnv(); - - $c = $this->createDisputedCharge(); - - $d = Dispute::retrieve($c->dispute); - - $this->assertSame($c->dispute, $d->id); - } -} diff --git a/htdocs/includes/stripe/tests/ErrorTest.php b/htdocs/includes/stripe/tests/ErrorTest.php deleted file mode 100644 index 75362427510..00000000000 --- a/htdocs/includes/stripe/tests/ErrorTest.php +++ /dev/null @@ -1,61 +0,0 @@ - 'bar') - ); - $this->fail("Did not raise error"); - } catch (Error\Api $e) { - $this->assertSame("hello", $e->getMessage()); - $this->assertSame(500, $e->getHttpStatus()); - $this->assertSame("{'foo':'bar'}", $e->getHttpBody()); - $this->assertSame(array('foo' => 'bar'), $e->getJsonBody()); - $this->assertSame(null, $e->getHttpHeaders()); - $this->assertSame(null, $e->getRequestId()); - } - } - - public function testResponseHeaders() - { - try { - throw new Error\Api( - "hello", - 500, - "{'foo':'bar'}", - array('foo' => 'bar'), - array('Request-Id' => 'req_bar') - ); - $this->fail("Did not raise error"); - } catch (Error\Api $e) { - $this->assertSame(array('Request-Id' => 'req_bar'), $e->getHttpHeaders()); - $this->assertSame('req_bar', $e->getRequestId()); - } - } - - public function testCode() - { - try { - throw new Error\Card( - "hello", - "some_param", - "some_code", - 400, - "{'foo':'bar'}", - array('foo' => 'bar') - ); - $this->fail("Did not raise error"); - } catch (Error\Card $e) { - $this->assertSame("some_param", $e->getStripeParam()); - $this->assertSame('some_code', $e->getStripeCode()); - } - } -} diff --git a/htdocs/includes/stripe/tests/ExternalAccountTest.php b/htdocs/includes/stripe/tests/ExternalAccountTest.php deleted file mode 100644 index 70c0068bc45..00000000000 --- a/htdocs/includes/stripe/tests/ExternalAccountTest.php +++ /dev/null @@ -1,30 +0,0 @@ - array( - 'country' => 'US', - 'routing_number' => '110000000', - 'account_number' => '000123456789', - 'account_holder_name' => 'Jane Austen', - 'account_holder_type' => 'company' - ) - ) - ); - $customer = Customer::create(); - $externalAccount = $customer->sources->create(array('bank_account' => $bankAccountToken->id)); - $verifiedAccount = $externalAccount->verify(array('amounts' => array(32, 45)), null); - - $base = Customer::classUrl(); - $parentExtn = $externalAccount['customer']; - $extn = $externalAccount['id']; - $this->assertEquals("$base/$parentExtn/sources/$extn", $externalAccount->instanceUrl()); - } -} diff --git a/htdocs/includes/stripe/tests/FileUploadTest.php b/htdocs/includes/stripe/tests/FileUploadTest.php deleted file mode 100644 index 7d1faf3b00f..00000000000 --- a/htdocs/includes/stripe/tests/FileUploadTest.php +++ /dev/null @@ -1,44 +0,0 @@ - 'dispute_evidence', - 'file' => $fp, - ) - ); - fclose($fp); - $this->assertSame(95, $file->size); - $this->assertSame('png', $file->type); - } - - public function testCreateAndRetrieveCurlFile() - { - if (!class_exists('\CurlFile', false)) { - // Older PHP versions don't support this - return; - } - - $curlFile = new \CurlFile(dirname(__FILE__).'/../data/test.png'); - self::authorizeFromEnv(); - $file = FileUpload::create( - array( - 'purpose' => 'dispute_evidence', - 'file' => $curlFile, - ) - ); - $this->assertSame(95, $file->size); - $this->assertSame('png', $file->type); - - // Just check that we don't get exceptions - $file = FileUpload::retrieve($file->id); - $file->refresh(); - } -} diff --git a/htdocs/includes/stripe/tests/InvalidRequestErrorTest.php b/htdocs/includes/stripe/tests/InvalidRequestErrorTest.php deleted file mode 100644 index 6cc6d682911..00000000000 --- a/htdocs/includes/stripe/tests/InvalidRequestErrorTest.php +++ /dev/null @@ -1,26 +0,0 @@ -assertSame(404, $e->getHttpStatus()); - } - } - - public function testBadData() - { - self::authorizeFromEnv(); - try { - Charge::create(); - } catch (Error\InvalidRequest $e) { - $this->assertSame(400, $e->getHttpStatus()); - } - } -} diff --git a/htdocs/includes/stripe/tests/InvoiceTest.php b/htdocs/includes/stripe/tests/InvoiceTest.php deleted file mode 100644 index a55ab83e4ac..00000000000 --- a/htdocs/includes/stripe/tests/InvoiceTest.php +++ /dev/null @@ -1,56 +0,0 @@ - $customer->id, - 'amount' => 0, - 'currency' => 'usd', - )); - - $invoice = Invoice::upcoming(array( - 'customer' => $customer->id, - )); - $this->assertSame($invoice->customer, $customer->id); - $this->assertSame($invoice->attempted, false); - } - - public function testItemsAccessWithParameter() - { - self::authorizeFromEnv(); - $customer = self::createTestCustomer(); - - InvoiceItem::create(array( - 'customer' => $customer->id, - 'amount' => 100, - 'currency' => 'usd', - )); - - $invoice = Invoice::upcoming( - array( - 'customer' => $customer->id, - ) - ); - - $lines = $invoice->lines->all(array('limit' => 10)); - - $this->assertSame(count($lines->data), 1); - $this->assertSame($lines->data[0]->amount, 100); - } - - // This is really just making sure that this operation does not trigger any - // warnings, as it's highly nested. - public function testAll() - { - self::authorizeFromEnv(); - $invoices = Invoice::all(); - $this->assertGreaterThan(0, count($invoices)); - } -} diff --git a/htdocs/includes/stripe/tests/PayoutTest.php b/htdocs/includes/stripe/tests/PayoutTest.php deleted file mode 100644 index 5e99faede87..00000000000 --- a/htdocs/includes/stripe/tests/PayoutTest.php +++ /dev/null @@ -1,94 +0,0 @@ -managedAccount === null) { - self::authorizeFromEnv(); - $account = self::createTestManagedAccount(); - - $charge = \Stripe\Charge::create(array( - 'currency' => 'usd', - 'amount' => '10000', - 'source' => array( - 'object' => 'card', - 'number' => '4000000000000077', - 'exp_month' => '09', - 'exp_year' => date('Y') + 3, - ), - 'destination' => array( - 'account' => $account->id - ) - )); - - $this->managedAccount = $account; - } - - return $this->managedAccount; - } - - private function createPayoutFromManagedAccount($accountId) - { - $payout = Payout::create( - array( - 'amount' => 100, - 'currency' => 'usd', - ), - array( - 'stripe_account' => $accountId - ) - ); - - return $payout; - } - - public function testCreate() - { - $account = self::createAccountWithBalance(); - $payout = self::createPayoutFromManagedAccount($account->id); - - $this->assertSame('pending', $payout->status); - } - - public function testRetrieve() - { - $account = self::createAccountWithBalance(); - $payout = self::createPayoutFromManagedAccount($account->id); - $reloaded = Payout::retrieve($payout->id, array('stripe_account' => $account->id)); - $this->assertSame($reloaded->id, $payout->id); - } - - public function testPayoutUpdateMetadata() - { - $account = self::createAccountWithBalance(); - $payout = self::createPayoutFromManagedAccount($account->id); - $payout->metadata['test'] = 'foo bar'; - $payout->save(); - - $updatedPayout = Payout::retrieve($payout->id, array('stripe_account' => $account->id)); - $this->assertSame('foo bar', $updatedPayout->metadata['test']); - } - - public function testPayoutUpdateMetadataAll() - { - $account = self::createAccountWithBalance(); - $payout = self::createPayoutFromManagedAccount($account->id); - - $payout->metadata = array('test' => 'foo bar'); - $payout->save(); - - $updatedPayout = Payout::retrieve($payout->id, array('stripe_account' => $account->id)); - $this->assertSame('foo bar', $updatedPayout->metadata['test']); - } -} diff --git a/htdocs/includes/stripe/tests/PermissionsErrorTest.php b/htdocs/includes/stripe/tests/PermissionsErrorTest.php deleted file mode 100644 index cc8a5cd0be0..00000000000 --- a/htdocs/includes/stripe/tests/PermissionsErrorTest.php +++ /dev/null @@ -1,22 +0,0 @@ - array(), - ); - } - - /** - * @expectedException Stripe\Error\Permission - */ - public function testPermission() - { - $this->mockRequest('GET', '/v1/accounts/acct_DEF', array(), $this->permissionErrorResponse(), 403); - Account::retrieve('acct_DEF'); - } -} diff --git a/htdocs/includes/stripe/tests/PlanTest.php b/htdocs/includes/stripe/tests/PlanTest.php deleted file mode 100644 index 9aa3589c719..00000000000 --- a/htdocs/includes/stripe/tests/PlanTest.php +++ /dev/null @@ -1,51 +0,0 @@ - 2000, - 'interval' => 'month', - 'currency' => 'usd', - 'name' => 'Plan', - 'id' => 'gold-' . self::generateRandomString(20) - )); - $p->delete(); - $this->assertTrue($p->deleted); - } - - public function testFalseyId() - { - try { - $retrievedPlan = Plan::retrieve('0'); - } catch (Error\InvalidRequest $e) { - // Can either succeed or 404, all other errors are bad - if ($e->httpStatus !== 404) { - $this->fail(); - } - } - } - - public function testSave() - { - self::authorizeFromEnv(); - $planID = 'gold-' . self::generateRandomString(20); - $p = Plan::create(array( - 'amount' => 2000, - 'interval' => 'month', - 'currency' => 'usd', - 'name' => 'Plan', - 'id' => $planID - )); - $p->name = 'A new plan name'; - $p->save(); - $this->assertSame($p->name, 'A new plan name'); - - $stripePlan = Plan::retrieve($planID); - $this->assertSame($p->name, $stripePlan->name); - } -} diff --git a/htdocs/includes/stripe/tests/ProductTest.php b/htdocs/includes/stripe/tests/ProductTest.php deleted file mode 100644 index 668d015e380..00000000000 --- a/htdocs/includes/stripe/tests/ProductTest.php +++ /dev/null @@ -1,158 +0,0 @@ -httpStatus !== 404) { - $this->fail(); - } - } - } - - public function testProductCreateUpdateRead() - { - - Stripe::setApiKey('sk_test_JieJALRz7rPz7boV17oMma7a'); - $ProductID = 'gold-' . self::generateRandomString(20); - $p = Product::create(array( - 'name' => 'Gold Product', - 'id' => $ProductID, - 'url' => 'www.stripe.com/gold' - )); - $this->assertSame($p->url, 'www.stripe.com/gold'); - - $p->name = 'A new Product name'; - $p->save(); - $this->assertSame($p->name, 'A new Product name'); - $this->assertSame($p->url, 'www.stripe.com/gold'); - - $stripeProduct = Product::retrieve($ProductID); - $this->assertSame($p->name, $stripeProduct->name); - $this->assertSame($stripeProduct->url, 'www.stripe.com/gold'); - } - - public function testSKUCreateUpdateRead() - { - Stripe::setApiKey('sk_test_JieJALRz7rPz7boV17oMma7a'); - $ProductID = 'silver-' . self::generateRandomString(20); - $p = Product::create(array( - 'name' => 'Silver Product', - 'id' => $ProductID, - 'url' => 'www.stripe.com/silver' - )); - - $SkuID = 'silver-sku-' . self::generateRandomString(20); - $sku = SKU::create(array( - 'price' => 500, - 'currency' => 'usd', - 'id' => $SkuID, - 'inventory' => array( - 'type' => 'finite', - 'quantity' => 40 - ), - 'product' => $ProductID - )); - - $sku->price = 600; - $sku->inventory->quantity = 50; - $sku->save(); - $this->assertSame($sku->price, 600); - $this->assertSame(50, $sku->inventory->quantity); - - $stripeSku = SKU::retrieve($SkuID); - $this->assertSame($sku->price, 600); - $this->assertSame('finite', $sku->inventory->type); - $this->assertSame(50, $sku->inventory->quantity); - } - - public function testSKUProductDelete() - { - Stripe::setApiKey('sk_test_JieJALRz7rPz7boV17oMma7a'); - $ProductID = 'silver-' . self::generateRandomString(20); - $p = Product::create(array( - 'name' => 'Silver Product', - 'id' => $ProductID, - 'url' => 'stripe.com/silver' - )); - - $SkuID = 'silver-sku-' . self::generateRandomString(20); - $sku = SKU::create(array( - 'price' => 500, - 'currency' => 'usd', - 'id' => $SkuID, - 'inventory' => array( - 'type' => 'finite', - 'quantity' => 40 - ), - 'product' => $ProductID - )); - - $deletedSku = $sku->delete(); - $this->assertTrue($deletedSku->deleted); - - $deletedProduct = $p->delete(); - $this->assertTrue($deletedProduct->deleted); - } - - public function testOrderCreateUpdateRetrievePayReturn() - { - Stripe::setApiKey('sk_test_JieJALRz7rPz7boV17oMma7a'); - $ProductID = 'silver-' . self::generateRandomString(20); - $p = Product::create(array( - 'name' => 'Silver Product', - 'id' => $ProductID, - 'url' => 'www.stripe.com/silver', - 'shippable' => false, - )); - - $SkuID = 'silver-sku-' . self::generateRandomString(20); - $sku = SKU::create(array( - 'price' => 500, - 'currency' => 'usd', - 'id' => $SkuID, - 'inventory' => array( - 'type' => 'finite', - 'quantity' => 40 - ), - 'product' => $ProductID - )); - - $order = Order::create(array( - 'items' => array( - 0 => array( - 'type' => 'sku', - 'parent' => $SkuID, - ), - ), - 'currency' => 'usd', - 'email' => 'foo@bar.com', - )); - - $order->metadata->foo = "bar"; - $order->save(); - - $stripeOrder = Order::retrieve($order->id); - $this->assertSame($order->metadata->foo, "bar"); - - $order->pay(array( - 'source' => array( - 'object' => 'card', - 'number' => '4242424242424242', - 'exp_month' => '05', - 'exp_year' => '2017' - ), - )); - $this->assertSame($order->status, 'paid'); - - $orderReturn = $order->returnOrder(); - $this->assertSame($orderReturn->order, $order->id); - } -} diff --git a/htdocs/includes/stripe/tests/RateLimitErrorTest.php b/htdocs/includes/stripe/tests/RateLimitErrorTest.php deleted file mode 100644 index 2d6a6b22a2b..00000000000 --- a/htdocs/includes/stripe/tests/RateLimitErrorTest.php +++ /dev/null @@ -1,22 +0,0 @@ - array(), - ); - } - - /** - * @expectedException Stripe\Error\RateLimit - */ - public function testRateLimit() - { - $this->mockRequest('GET', '/v1/accounts/acct_DEF', array(), $this->rateLimitErrorResponse(), 429); - Account::retrieve('acct_DEF'); - } -} diff --git a/htdocs/includes/stripe/tests/RecipientTest.php b/htdocs/includes/stripe/tests/RecipientTest.php deleted file mode 100644 index e26bfe8cddd..00000000000 --- a/htdocs/includes/stripe/tests/RecipientTest.php +++ /dev/null @@ -1,112 +0,0 @@ -delete(); - - $this->assertTrue($recipient->deleted); - } - - public function testSave() - { - $recipient = self::createTestRecipient(); - - $recipient->email = 'gdb@stripe.com'; - $recipient->save(); - $this->assertSame($recipient->email, 'gdb@stripe.com'); - - $stripeRecipient = Recipient::retrieve($recipient->id); - $this->assertSame($recipient->email, $stripeRecipient->email); - } - - /** - * @expectedException Stripe\Error\InvalidRequest - */ - public function testBogusAttribute() - { - $recipient = self::createTestRecipient(); - $recipient->bogus = 'bogus'; - $recipient->save(); - } - - public function testRecipientAddCard() - { - $token = Token::create( - array("card" => array( - "number" => "4000056655665556", - "exp_month" => 5, - "exp_year" => date('Y') + 3, - "cvc" => "314" - )) - ); - - $recipient = $this->createTestRecipient(); - $createdCard = $recipient->cards->create(array("card" => $token->id)); - $recipient->save(); - - $updatedRecipient = Recipient::retrieve($recipient->id); - $updatedCards = $updatedRecipient->cards->all(); - $this->assertSame(count($updatedCards["data"]), 1); - } - - public function testRecipientUpdateCard() - { - $token = Token::create( - array("card" => array( - "number" => "4000056655665556", - "exp_month" => 5, - "exp_year" => date('Y') + 3, - "cvc" => "314" - )) - ); - - $recipient = $this->createTestRecipient(); - $createdCard = $recipient->cards->create(array("card" => $token->id)); - $recipient->save(); - - $createdCards = $recipient->cards->all(); - $this->assertSame(count($createdCards["data"]), 1); - - $card = $createdCards['data'][0]; - $card->name = "Jane Austen"; - $card->save(); - - $updatedRecipient = Recipient::retrieve($recipient->id); - $updatedCards = $updatedRecipient->cards->all(); - $this->assertSame($updatedCards["data"][0]->name, "Jane Austen"); - } - - public function testRecipientDeleteCard() - { - $token = Token::create( - array("card" => array( - "number" => "4000056655665556", - "exp_month" => 5, - "exp_year" => date('Y') + 3, - "cvc" => "314" - )) - ); - - $recipient = $this->createTestRecipient(); - $createdCard = $recipient->cards->create(array("card" => $token->id)); - $recipient->save(); - - $updatedRecipient = Recipient::retrieve($recipient->id); - $updatedCards = $updatedRecipient->cards->all(); - $this->assertSame(count($updatedCards["data"]), 1); - - $deleteStatus = - $updatedRecipient->cards->retrieve($createdCard->id)->delete(); - $this->assertTrue($deleteStatus->deleted); - $updatedRecipient->save(); - - $postDeleteRecipient = Recipient::retrieve($recipient->id); - $postDeleteCards = $postDeleteRecipient->cards->all(); - $this->assertSame(count($postDeleteCards["data"]), 0); - } -} diff --git a/htdocs/includes/stripe/tests/RefundTest.php b/htdocs/includes/stripe/tests/RefundTest.php deleted file mode 100644 index e9dd8509cd3..00000000000 --- a/htdocs/includes/stripe/tests/RefundTest.php +++ /dev/null @@ -1,131 +0,0 @@ - 100, 'charge' => $charge->id)); - $this->assertSame(100, $refund->amount); - $this->assertSame($charge->id, $refund->charge); - } - - public function testUpdateAndRetrieve() - { - $charge = self::createTestCharge(); - $ref = Refund::create(array('amount' => 100, 'charge' => $charge->id)); - $ref->metadata["key"] = "value"; - $ref->save(); - $ref = Refund::retrieve($ref->id); - $this->assertSame("value", $ref->metadata["key"], "value"); - } - - public function testListForCharge() - { - $charge = self::createTestCharge(); - $refA = Refund::create(array('amount' => 100, 'charge' => $charge->id)); - $refB = Refund::create(array('amount' => 50, 'charge' => $charge->id)); - - $all = Refund::all(array('charge' => $charge)); - $this->assertSame(false, $all['has_more']); - $this->assertSame(2, count($all->data)); - $this->assertSame($refB->id, $all->data[0]->id); - $this->assertSame($refA->id, $all->data[1]->id); - } - - public function testList() - { - $all = Refund::all(); - - // Fetches all refunds on this test account. - $this->assertSame(true, $all['has_more']); - $this->assertSame(10, count($all->data)); - } - - public function testCreateForBitcoin() - { - self::authorizeFromEnv(); - - $receiver = $this->createTestBitcoinReceiver("do+fill_now@stripe.com"); - - $charge = Charge::create( - array( - 'amount' => $receiver->amount, - 'currency' => $receiver->currency, - 'description' => $receiver->description, - 'source' => $receiver->id - ) - ); - - $ref = Refund::create( - array( - 'amount' => $receiver->amount, - 'refund_address' => 'ABCDEF', - 'charge' => $charge->id - ) - ); - $this->assertSame($receiver->amount, $ref->amount); - $this->assertNotNull($ref->id); - } - - // Deprecated charge endpoints: - - public function testCreateViaCharge() - { - $charge = self::createTestCharge(); - $ref = $charge->refunds->create(array('amount' => 100)); - $this->assertSame(100, $ref->amount); - $this->assertSame($charge->id, $ref->charge); - } - - public function testUpdateAndRetrieveViaCharge() - { - $charge = self::createTestCharge(); - $ref = $charge->refunds->create(array('amount' => 100)); - $ref->metadata["key"] = "value"; - $ref->save(); - $ref = $charge->refunds->retrieve($ref->id); - $this->assertSame("value", $ref->metadata["key"], "value"); - } - - public function testListViaCharge() - { - $charge = self::createTestCharge(); - $refA = $charge->refunds->create(array('amount' => 50)); - $refB = $charge->refunds->create(array('amount' => 50)); - - $all = $charge->refunds->all(); - $this->assertSame(false, $all['has_more']); - $this->assertSame(2, count($all->data)); - $this->assertSame($refB->id, $all->data[0]->id); - $this->assertSame($refA->id, $all->data[1]->id); - } - - public function testCreateForBitcoinViaCharge() - { - self::authorizeFromEnv(); - - $receiver = $this->createTestBitcoinReceiver("do+fill_now@stripe.com"); - - $charge = Charge::create( - array( - 'amount' => $receiver->amount, - 'currency' => $receiver->currency, - 'description' => $receiver->description, - 'source' => $receiver->id - ) - ); - - $ref = $charge->refunds->create( - array( - 'amount' => $receiver->amount, - 'refund_address' => 'ABCDEF' - ) - ); - $this->assertSame($receiver->amount, $ref->amount); - $this->assertNotNull($ref->id); - } -} diff --git a/htdocs/includes/stripe/tests/RequestOptionsTest.php b/htdocs/includes/stripe/tests/RequestOptionsTest.php deleted file mode 100644 index 11546dd6ece..00000000000 --- a/htdocs/includes/stripe/tests/RequestOptionsTest.php +++ /dev/null @@ -1,69 +0,0 @@ -assertSame("foo", $opts->apiKey); - $this->assertSame(array(), $opts->headers); - } - - public function testNull() - { - $opts = Util\RequestOptions::parse(null); - $this->assertSame(null, $opts->apiKey); - $this->assertSame(array(), $opts->headers); - } - - public function testEmptyArray() - { - $opts = Util\RequestOptions::parse(array()); - $this->assertSame(null, $opts->apiKey); - $this->assertSame(array(), $opts->headers); - } - - public function testAPIKeyArray() - { - $opts = Util\RequestOptions::parse( - array( - 'api_key' => 'foo', - ) - ); - $this->assertSame('foo', $opts->apiKey); - $this->assertSame(array(), $opts->headers); - } - - public function testIdempotentKeyArray() - { - $opts = Util\RequestOptions::parse( - array( - 'idempotency_key' => 'foo', - ) - ); - $this->assertSame(null, $opts->apiKey); - $this->assertSame(array('Idempotency-Key' => 'foo'), $opts->headers); - } - - public function testKeyArray() - { - $opts = Util\RequestOptions::parse( - array( - 'idempotency_key' => 'foo', - 'api_key' => 'foo' - ) - ); - $this->assertSame('foo', $opts->apiKey); - $this->assertSame(array('Idempotency-Key' => 'foo'), $opts->headers); - } - - /** - * @expectedException Stripe\Error\Api - */ - public function testWrongType() - { - $opts = Util\RequestOptions::parse(5); - } -} diff --git a/htdocs/includes/stripe/tests/SourceTest.php b/htdocs/includes/stripe/tests/SourceTest.php deleted file mode 100644 index 5ba142b9be2..00000000000 --- a/htdocs/includes/stripe/tests/SourceTest.php +++ /dev/null @@ -1,218 +0,0 @@ -mockRequest( - 'GET', - '/v1/sources/src_foo', - array(), - array( - 'id' => 'src_foo', - 'object' => 'source', - ) - ); - $source = Source::retrieve('src_foo'); - $this->assertSame($source->id, 'src_foo'); - } - - public function testCreate() - { - $this->mockRequest( - 'POST', - '/v1/sources', - array( - 'type' => 'bitcoin', - 'amount' => 1000, - 'currency' => 'usd', - 'owner' => array('email' => 'jenny.rosen@example.com'), - ), - array( - 'id' => 'src_foo', - 'object' => 'source' - ) - ); - $source = Source::create(array( - 'type' => 'bitcoin', - 'amount' => 1000, - 'currency' => 'usd', - 'owner' => array('email' => 'jenny.rosen@example.com'), - )); - $this->assertSame($source->id, 'src_foo'); - } - - public function testSave() - { - $response = array( - 'id' => 'src_foo', - 'object' => 'source', - 'metadata' => array(), - ); - $this->mockRequest( - 'GET', - '/v1/sources/src_foo', - array(), - $response - ); - - $response['metadata'] = array('foo' => 'bar'); - $this->mockRequest( - 'POST', - '/v1/sources/src_foo', - array( - 'metadata' => array('foo' => 'bar'), - ), - $response - ); - - $source = Source::retrieve('src_foo'); - $source->metadata['foo'] = 'bar'; - $source->save(); - $this->assertSame($source->metadata['foo'], 'bar'); - } - - public function testSaveOwner() - { - $response = array( - 'id' => 'src_foo', - 'object' => 'source', - 'owner' => array( - 'name' => null, - 'address' => null, - ), - ); - $this->mockRequest( - 'GET', - '/v1/sources/src_foo', - array(), - $response - ); - - $response['owner'] = array( - 'name' => "Stripey McStripe", - 'address' => array( - 'line1' => "Test Address", - 'city' => "Test City", - 'postal_code' => "12345", - 'state' => "Test State", - 'country' => "Test Country", - ) - ); - $this->mockRequest( - 'POST', - '/v1/sources/src_foo', - array( - 'owner' => array( - 'name' => "Stripey McStripe", - 'address' => array( - 'line1' => "Test Address", - 'city' => "Test City", - 'postal_code' => "12345", - 'state' => "Test State", - 'country' => "Test Country", - ), - ), - ), - $response - ); - - $source = Source::retrieve('src_foo'); - $source->owner['name'] = "Stripey McStripe"; - $source->owner['address'] = array( - 'line1' => "Test Address", - 'city' => "Test City", - 'postal_code' => "12345", - 'state' => "Test State", - 'country' => "Test Country", - ); - $source->save(); - $this->assertSame($source->owner['name'], "Stripey McStripe"); - $this->assertSame($source->owner['address']['line1'], "Test Address"); - $this->assertSame($source->owner['address']['city'], "Test City"); - $this->assertSame($source->owner['address']['postal_code'], "12345"); - $this->assertSame($source->owner['address']['state'], "Test State"); - $this->assertSame($source->owner['address']['country'], "Test Country"); - } - - public function testDeleteAttached() - { - $response = array( - 'id' => 'src_foo', - 'object' => 'source', - 'customer' => 'cus_bar', - ); - $this->mockRequest( - 'GET', - '/v1/sources/src_foo', - array(), - $response - ); - - unset($response['customer']); - $this->mockRequest( - 'DELETE', - '/v1/customers/cus_bar/sources/src_foo', - array(), - $response - ); - - $source = Source::retrieve('src_foo'); - $source->delete(); - $this->assertFalse(array_key_exists('customer', $source)); - } - - /** - * @expectedException Stripe\Error\Api - */ - public function testDeleteUnattached() - { - $response = array( - 'id' => 'src_foo', - 'object' => 'source', - ); - $this->mockRequest( - 'GET', - '/v1/sources/src_foo', - array(), - $response - ); - - $source = Source::retrieve('src_foo'); - $source->delete(); - } - - public function testVerify() - { - $response = array( - 'id' => 'src_foo', - 'object' => 'source', - 'verification' => array('status' => 'pending'), - ); - $this->mockRequest( - 'GET', - '/v1/sources/src_foo', - array(), - $response - ); - - $response['verification']['status'] = 'succeeded'; - $this->mockRequest( - 'POST', - '/v1/sources/src_foo/verify', - array( - 'values' => array(32, 45), - ), - $response - ); - - $source = Source::retrieve('src_foo'); - $this->assertSame($source->verification->status, 'pending'); - $source->verify(array( - 'values' => array(32, 45), - )); - $this->assertSame($source->verification->status, 'succeeded'); - } -} diff --git a/htdocs/includes/stripe/tests/StripeObjectTest.php b/htdocs/includes/stripe/tests/StripeObjectTest.php deleted file mode 100644 index 5f922228270..00000000000 --- a/htdocs/includes/stripe/tests/StripeObjectTest.php +++ /dev/null @@ -1,108 +0,0 @@ -assertSame($s['foo'], 'a'); - $this->assertTrue(isset($s['foo'])); - unset($s['foo']); - $this->assertFalse(isset($s['foo'])); - } - - public function testNormalAccessorsSemantics() - { - $s = new StripeObject(); - $s->foo = 'a'; - $this->assertSame($s->foo, 'a'); - $this->assertTrue(isset($s->foo)); - unset($s->foo); - $this->assertFalse(isset($s->foo)); - } - - public function testArrayAccessorsMatchNormalAccessors() - { - $s = new StripeObject(); - $s->foo = 'a'; - $this->assertSame($s['foo'], 'a'); - - $s['bar'] = 'b'; - $this->assertSame($s->bar, 'b'); - } - - public function testKeys() - { - $s = new StripeObject(); - $s->foo = 'a'; - $this->assertSame($s->keys(), array('foo')); - } - - public function testToArray() - { - $s = new StripeObject(); - $s->foo = 'a'; - - $converted = $s->__toArray(); - - $this->assertInternalType('array', $converted); - $this->assertArrayHasKey('foo', $converted); - $this->assertEquals('a', $converted['foo']); - } - - public function testRecursiveToArray() - { - $s = new StripeObject(); - $z = new StripeObject(); - - $s->child = $z; - $z->foo = 'a'; - - $converted = $s->__toArray(true); - - $this->assertInternalType('array', $converted); - $this->assertArrayHasKey('child', $converted); - $this->assertInternalType('array', $converted['child']); - $this->assertArrayHasKey('foo', $converted['child']); - $this->assertEquals('a', $converted['child']['foo']); - } - - public function testNonexistentProperty() - { - $s = new StripeObject(); - $this->assertNull($s->nonexistent); - } - - public function testPropertyDoesNotExists() - { - $s = new StripeObject(); - $this->assertNull($s['nonexistent']); - } - - public function testJsonEncode() - { - // We can only JSON encode our objects in PHP 5.4+. 5.3 must use ->__toJSON() - if (version_compare(phpversion(), '5.4.0', '<')) { - return; - } - - $s = new StripeObject(); - $s->foo = 'a'; - - $this->assertEquals('{"foo":"a"}', json_encode($s->__toArray())); - } - - public function testReplaceNewNestedUpdatable() - { - StripeObject::init(); // Populate the $nestedUpdatableAttributes Set - $s = new StripeObject(); - - $s->metadata = array('bar'); - $this->assertSame($s->metadata, array('bar')); - $s->metadata = array('baz', 'qux'); - $this->assertSame($s->metadata, array('baz', 'qux')); - } -} diff --git a/htdocs/includes/stripe/tests/SubscriptionItemTest.php b/htdocs/includes/stripe/tests/SubscriptionItemTest.php deleted file mode 100644 index 4e4a545a5b1..00000000000 --- a/htdocs/includes/stripe/tests/SubscriptionItemTest.php +++ /dev/null @@ -1,38 +0,0 @@ - $plan0ID, 'customer' => $customer->id)); - - $plan1ID = 'gold-' . self::generateRandomString(20); - self::retrieveOrCreatePlan($plan1ID); - - $subItem = SubscriptionItem::create(array('plan' => $plan1ID, 'subscription' => $sub->id)); - $this->assertSame($subItem->plan->id, $plan1ID); - - $subItem->quantity = 2; - $subItem->save(); - - $subItem = SubscriptionItem::retrieve($subItem->id); - $this->assertSame($subItem->quantity, 2); - - // Update the quantity parameter one more time - $subItem = SubscriptionItem::update($subItem->id, array('quantity' => 3)); - $this->assertSame($subItem->quantity, 3); - - $subItems = SubscriptionItem::all(array('subscription'=>$sub->id, 'limit'=>3)); - $this->assertSame(get_class($subItems->data[0]), 'Stripe\SubscriptionItem'); - $this->assertSame(2, count($subItems->data)); - - $subItem->delete(); - $this->assertTrue($subItem->deleted); - } -} diff --git a/htdocs/includes/stripe/tests/SubscriptionTest.php b/htdocs/includes/stripe/tests/SubscriptionTest.php deleted file mode 100644 index 08f74108061..00000000000 --- a/htdocs/includes/stripe/tests/SubscriptionTest.php +++ /dev/null @@ -1,132 +0,0 @@ -subscriptions->create(array('plan' => $planID)); - - $this->assertSame($sub->status, 'active'); - $this->assertSame($sub->plan->id, $planID); - - $sub->quantity = 2; - $sub->save(); - - $sub = $customer->subscriptions->retrieve($sub->id); - $this->assertSame($sub->status, 'active'); - $this->assertSame($sub->plan->id, $planID); - $this->assertSame($sub->quantity, 2); - - $subs = $customer->subscriptions->all(array('limit'=>3)); - $this->assertSame(get_class($subs->data[0]), 'Stripe\Subscription'); - - $sub->cancel(array('at_period_end' => true)); - - $sub = $customer->subscriptions->retrieve($sub->id); - $this->assertSame($sub->status, 'active'); - // @codingStandardsIgnoreStart - $this->assertTrue($sub->cancel_at_period_end); - // @codingStandardsIgnoreEnd - } - - public function testCreateUpdateListCancel() - { - $planID = 'gold-' . self::generateRandomString(20); - self::retrieveOrCreatePlan($planID); - - $customer = self::createTestCustomer(); - - $sub = Subscription::create(array('plan' => $planID, 'customer' => $customer->id)); - - $this->assertSame($sub->status, 'active'); - $this->assertSame($sub->plan->id, $planID); - - $sub->quantity = 2; - $sub->save(); - - $sub = Subscription::retrieve($sub->id); - $this->assertSame($sub->status, 'active'); - $this->assertSame($sub->plan->id, $planID); - $this->assertSame($sub->quantity, 2); - - // Update the quantity parameter one more time - $sub = Subscription::update($sub->id, array("quantity" => 3)); - $this->assertSame($sub->status, 'active'); - $this->assertSame($sub->plan->id, $planID); - $this->assertSame($sub->quantity, 3); - - $subs = Subscription::all(array('customer'=>$customer->id, 'plan'=>$planID, 'limit'=>3)); - $this->assertSame(get_class($subs->data[0]), 'Stripe\Subscription'); - - $sub->cancel(array('at_period_end' => true)); - - $sub = Subscription::retrieve($sub->id); - $this->assertSame($sub->status, 'active'); - $this->assertTrue($sub->cancel_at_period_end); - } - - public function testCreateUpdateListCancelWithItems() - { - $plan0ID = 'gold-' . self::generateRandomString(20); - self::retrieveOrCreatePlan($plan0ID); - - $customer = self::createTestCustomer(); - - $sub = Subscription::create(array( - 'customer' => $customer->id, - 'items' => array( - array('plan' => $plan0ID), - ), - )); - - $this->assertSame(count($sub->items->data), 1); - $this->assertSame($sub->items->data[0]->plan->id, $plan0ID); - - $plan1ID = 'gold-' . self::generateRandomString(20); - self::retrieveOrCreatePlan($plan1ID); - - $sub = Subscription::update($sub->id, array( - 'items' => array( - array('plan' => $plan1ID), - ), - )); - - $this->assertSame(count($sub->items->data), 2); - $this->assertSame($sub->items->data[0]->plan->id, $plan0ID); - $this->assertSame($sub->items->data[1]->plan->id, $plan1ID); - } - - public function testDeleteDiscount() - { - $planID = 'gold-' . self::generateRandomString(20); - self::retrieveOrCreatePlan($planID); - - $couponID = '25off-' . self::generateRandomString(20); - self::retrieveOrCreateCoupon($couponID); - - $customer = self::createTestCustomer(); - - $sub = $customer->subscriptions->create( - array( - 'plan' => $planID, - 'coupon' => $couponID - ) - ); - - $this->assertSame($sub->status, 'active'); - $this->assertSame($sub->plan->id, $planID); - $this->assertSame($sub->discount->coupon->id, $couponID); - - $sub->deleteDiscount(); - $sub = $customer->subscriptions->retrieve($sub->id); - $this->assertNull($sub->discount); - } -} diff --git a/htdocs/includes/stripe/tests/TestCase.php b/htdocs/includes/stripe/tests/TestCase.php index a1fdc94f917..840c0ec58c1 100644 --- a/htdocs/includes/stripe/tests/TestCase.php +++ b/htdocs/includes/stripe/tests/TestCase.php @@ -3,269 +3,175 @@ namespace Stripe; /** - * Base class for Stripe test cases, provides some utility methods for creating - * objects. + * Base class for Stripe test cases. */ class TestCase extends \PHPUnit_Framework_TestCase { - const API_KEY = 'tGN0bIwXnHdwOa85VABjPdSn8nWY7G7I'; + /** @var string original API base URL */ + protected $origApiBase; - private $mock; + /** @var string original API key */ + protected $origApiKey; - protected static function authorizeFromEnv() - { - $apiKey = getenv('STRIPE_API_KEY'); - if (!$apiKey) { - $apiKey = self::API_KEY; - } + /** @var string original client ID */ + protected $origClientId; - Stripe::setApiKey($apiKey); - } + /** @var string original API version */ + protected $origApiVersion; + + /** @var string original account ID */ + protected $origAccountId; + + /** @var object HTTP client mocker */ + protected $clientMock; protected function setUp() { + // Save original values so that we can restore them after running tests + $this->origApiBase = Stripe::$apiBase; + $this->origApiKey = Stripe::getApiKey(); + $this->origClientId = Stripe::getClientId(); + $this->origApiVersion = Stripe::getApiVersion(); + $this->origAccountId = Stripe::getAccountId(); + + // Set up host and credentials for stripe-mock + Stripe::$apiBase = "http://localhost:" . MOCK_PORT; + Stripe::setApiKey("sk_test_123"); + Stripe::setClientId("ca_123"); + Stripe::setApiVersion(null); + Stripe::setAccountId(null); + + // Set up the HTTP client mocker + $this->clientMock = $this->getMock('\Stripe\HttpClient\ClientInterface'); + + // By default, use the real HTTP client ApiRequestor::setHttpClient(HttpClient\CurlClient::instance()); - - // Peg the API version so that it can be varied independently of the - // one set on the test account. - Stripe::setApiVersion('2017-04-06'); - - $this->mock = null; - $this->call = 0; } - protected function mockRequest($method, $path, $params = array(), $return = array('id' => 'myId'), $rcode = 200) + protected function tearDown() { - $mock = $this->setUpMockRequest(); - $mock->expects($this->at($this->call++)) - ->method('request') - ->with(strtolower($method), 'https://api.stripe.com' . $path, $this->anything(), $params, false) - ->willReturn(array(json_encode($return), $rcode, array())); + // Restore original values + Stripe::$apiBase = $this->origApiBase; + Stripe::setApiKey($this->origApiKey); + Stripe::setClientId($this->origClientId); + Stripe::setApiVersion($this->origApiVersion); + Stripe::setAccountId($this->origAccountId); } - private function setUpMockRequest() - { - if (!$this->mock) { - self::authorizeFromEnv(); - $this->mock = $this->getMock('\Stripe\HttpClient\ClientInterface'); - ApiRequestor::setHttpClient($this->mock); + /** + * Sets up a request expectation with the provided parameters. The request + * will actually go through and be emitted. + * + * @param string $method HTTP method (e.g. 'post', 'get', etc.) + * @param string $path relative path (e.g. '/v1/charges') + * @param array|null $params array of parameters. If null, parameters will + * not be checked. + * @param string[]|null $headers array of headers. Does not need to be + * exhaustive. If null, headers are not checked. + * @param bool $hasFile Whether the request parameters contains a file. + * Defaults to false. + */ + protected function expectsRequest( + $method, + $path, + $params = null, + $headers = null, + $hasFile = false + ) { + $this->prepareRequestMock($method, $path, $params, $headers, $hasFile) + ->will($this->returnCallback( + function ($method, $absUrl, $headers, $params, $hasFile) { + $curlClient = HttpClient\CurlClient::instance(); + ApiRequestor::setHttpClient($curlClient); + return $curlClient->request($method, $absUrl, $headers, $params, $hasFile); + } + )); + } + + /** + * Sets up a request expectation with the provided parameters. The request + * will not actually be emitted, instead the provided response parameters + * will be returned. + * + * @param string $method HTTP method (e.g. 'post', 'get', etc.) + * @param string $path relative path (e.g. '/v1/charges') + * @param array|null $params array of parameters. If null, parameters will + * not be checked. + * @param string[]|null $headers array of headers. Does not need to be + * exhaustive. If null, headers are not checked. + * @param bool $hasFile Whether the request parameters contains a file. + * Defaults to false. + * @param array $response + * @param integer $rcode + * @param string|null $base + * + * @return array + */ + protected function stubRequest( + $method, + $path, + $params = null, + $headers = null, + $hasFile = false, + $response = [], + $rcode = 200, + $base = null + ) { + $this->prepareRequestMock($method, $path, $params, $headers, $hasFile, $base) + ->willReturn([json_encode($response), $rcode, []]); + } + + /** + * Prepares the client mocker for an invocation of the `request` method. + * This helper method is used by both `expectsRequest` and `stubRequest` to + * prepare the client mocker to expect an invocation of the `request` method + * with the provided arguments. + * + * @param string $method HTTP method (e.g. 'post', 'get', etc.) + * @param string $path relative path (e.g. '/v1/charges') + * @param array|null $params array of parameters. If null, parameters will + * not be checked. + * @param string[]|null $headers array of headers. Does not need to be + * exhaustive. If null, headers are not checked. + * @param bool $hasFile Whether the request parameters contains a file. + * Defaults to false. + * @param string|null $base base URL (e.g. 'https://api.stripe.com') + * + * @return PHPUnit_Framework_MockObject_Builder_InvocationMocker + */ + private function prepareRequestMock( + $method, + $path, + $params = null, + $headers = null, + $hasFile = false, + $base = null + ) { + ApiRequestor::setHttpClient($this->clientMock); + + if ($base === null) { + $base = Stripe::$apiBase; } - return $this->mock; - } + $absUrl = $base . $path; - /** - * Create a valid test charge. - */ - protected static function createTestCharge(array $attributes = array()) - { - self::authorizeFromEnv(); - - return Charge::create( - $attributes + array( - 'amount' => 2000, - 'currency' => 'usd', - 'description' => 'Charge for test@example.com', - 'card' => array( - 'number' => '4242424242424242', - 'exp_month' => 5, - 'exp_year' => date('Y') + 3, - ), - ) - ); - } - - /** - * Create a valid test transfer. - */ - protected static function createTestTransfer(array $attributes = array(), $opts = null) - { - self::authorizeFromEnv(); - - $recipient = self::createTestRecipient(); - - return Transfer::create( - $attributes + array( - 'amount' => 2000, - 'currency' => 'usd', - 'description' => 'Transfer to test@example.com', - 'recipient' => $recipient->id - ), - $opts - ); - } - - /** - * Create a valid test customer. - */ - protected static function createTestCustomer(array $attributes = array()) - { - self::authorizeFromEnv(); - - return Customer::create( - $attributes + array( - 'card' => array( - 'number' => '4242424242424242', - 'exp_month' => 5, - 'exp_year' => date('Y') + 3, - ), - ) - ); - } - - /** - * Create a valid test recipient - */ - protected static function createTestRecipient(array $attributes = array()) - { - self::authorizeFromEnv(); - - return Recipient::create( - $attributes + array( - 'name' => 'PHP Test', - 'type' => 'individual', - 'tax_id' => '000000000', - 'bank_account' => array( - 'country' => 'US', - 'routing_number' => '110000000', - 'account_number' => '000123456789' - ), - ) - ); - } - - /** - * Create a test account - */ - protected static function createTestAccount(array $attributes = array()) - { - self::authorizeFromEnv(); - - return Account::create( - $attributes + array( - 'managed' => false, - 'country' => 'US', - 'email' => self::generateRandomEmail(), - ) - ); - } - - /** - * Create a test account - */ - protected static function createTestManagedAccount(array $attributes = array()) - { - self::authorizeFromEnv(); - - return Account::create( - $attributes + array( - 'managed' => true, - 'country' => 'US', - 'external_account' => array( - 'object' => 'bank_account', - 'country' => 'US', - 'currency' => 'usd', - 'routing_number' => '110000000', - 'account_number' => '000123456789' - ), - 'legal_entity' => array( - 'type' => 'individual', - 'personal_id_number' => '000000000', - 'type' => 'individual', - 'dob' => array('year' => '1980', 'month' => '01', 'day' => '01'), - 'first_name' => 'John', - 'last_name' => 'Doe', - 'address' => array( - 'line1' => '1234 Main Street', - 'postal_code' => '94110', - 'city' => 'San Francisco' - ), - 'personal_address' => array( - 'line1' => '1234 Main Street', - 'postal_code' => '94110', - 'city' => 'San Francisco' - ) - ), - 'tos_acceptance' => array('date' => time(), 'ip' => '127.0.0.1') - ) - ); - } - - /** - * Verify that a plan with a given ID exists, or create a new one if it does - * not. - */ - protected static function retrieveOrCreatePlan($id) - { - self::authorizeFromEnv(); - - try { - $plan = Plan::retrieve($id); - } catch (Error\InvalidRequest $exception) { - $plan = Plan::create( - array( - 'id' => $id, - 'amount' => 0, - 'currency' => 'usd', - 'interval' => 'month', - 'name' => 'Gold Test Plan', - ) + return $this->clientMock + ->expects($this->once()) + ->method('request') + ->with( + $this->identicalTo(strtolower($method)), + $this->identicalTo($absUrl), + // for headers, we only check that all of the headers provided in $headers are + // present in the list of headers of the actual request + $headers === null ? $this->anything() : $this->callback(function ($array) use ($headers) { + foreach ($headers as $header) { + if (!in_array($header, $array)) { + return false; + } + } + return true; + }), + $params === null ? $this->anything() : $this->identicalTo($params), + $this->identicalTo($hasFile) ); - } - } - - /** - * Verify that a coupon with a given ID exists, or create a new one if it - * does not. - */ - protected static function retrieveOrCreateCoupon($id) - { - self::authorizeFromEnv(); - - try { - $coupon = Coupon::retrieve($id); - } catch (Error\InvalidRequest $exception) { - $coupon = Coupon::create( - array( - 'id' => $id, - 'duration' => 'forever', - 'percent_off' => 25, - ) - ); - } - } - - /** - * Generate a semi-random string - */ - protected static function generateRandomString($length = 24) - { - $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTU'; - $charactersLength = strlen($characters); - $randomString = ''; - for ($i = 0; $i < $length; $i++) { - $randomString .= $characters[rand(0, $charactersLength - 1)]; - } - return $randomString; - } - - /** - * Generate a semi-random email. - */ - protected static function generateRandomEmail() - { - return 'dev-platform-bots+php-'.self::generateRandomString(12).'@stripe.com'; - } - - protected static function createTestBitcoinReceiver($email) - { - $receiver = BitcoinReceiver::create( - array( - 'amount' => 100, - 'currency' => 'usd', - 'description' => 'some details', - 'email' => $email - ) - ); - return $receiver; } } diff --git a/htdocs/includes/stripe/tests/ThreeDSecureTest.php b/htdocs/includes/stripe/tests/ThreeDSecureTest.php deleted file mode 100644 index ebdd62335ee..00000000000 --- a/htdocs/includes/stripe/tests/ThreeDSecureTest.php +++ /dev/null @@ -1,46 +0,0 @@ -mockRequest( - 'GET', - '/v1/3d_secure/tdsrc_test', - array(), - array( - 'id' => 'tdsrc_test', - 'object' => 'three_d_secure' - ) - ); - $three_d_secure = ThreeDSecure::retrieve('tdsrc_test'); - $this->assertSame($three_d_secure->id, 'tdsrc_test'); - } - - public function testCreate() - { - $this->mockRequest( - 'POST', - '/v1/3d_secure', - array( - 'card' => 'tok_test', - 'amount' => 1500, - 'currency' => 'usd', - 'return_url' => 'https://example.org/3d-secure-result' - ), - array( - 'id' => 'tdsrc_test', - 'object' => 'three_d_secure' - ) - ); - $three_d_secure = ThreeDSecure::create(array( - 'card' => 'tok_test', - 'amount' => 1500, - 'currency' => 'usd', - 'return_url' => 'https://example.org/3d-secure-result' - )); - $this->assertSame($three_d_secure->id, 'tdsrc_test'); - } -} diff --git a/htdocs/includes/stripe/tests/TokenTest.php b/htdocs/includes/stripe/tests/TokenTest.php deleted file mode 100644 index 60ec76a1544..00000000000 --- a/htdocs/includes/stripe/tests/TokenTest.php +++ /dev/null @@ -1,13 +0,0 @@ -assertSame(Token::classUrl(), '/v1/tokens'); - $token = new Token('abcd/efgh'); - $this->assertSame($token->instanceUrl(), '/v1/tokens/abcd%2Fefgh'); - } -} diff --git a/htdocs/includes/stripe/tests/TransferReversalTest.php b/htdocs/includes/stripe/tests/TransferReversalTest.php deleted file mode 100644 index 86d746650f5..00000000000 --- a/htdocs/includes/stripe/tests/TransferReversalTest.php +++ /dev/null @@ -1,19 +0,0 @@ - '2017-02-14'); - - public function testList() - { - $transfer = self::createTestTransfer(array(), $this->opts); - $all = $transfer->reversals->all(); - $this->assertSame(false, $all['has_more']); - $this->assertSame(0, count($all->data)); - } -} diff --git a/htdocs/includes/stripe/tests/TransferTest.php b/htdocs/includes/stripe/tests/TransferTest.php deleted file mode 100644 index f4fd347dc4e..00000000000 --- a/htdocs/includes/stripe/tests/TransferTest.php +++ /dev/null @@ -1,46 +0,0 @@ - '2017-02-14'); - - public function testCreate() - { - $transfer = self::createTestTransfer(array(), $this->opts); - $this->assertSame('transfer', $transfer->object); - } - - public function testRetrieve() - { - $transfer = self::createTestTransfer(array(), $this->opts); - $reloaded = Transfer::retrieve($transfer->id, $this->opts); - $this->assertSame($reloaded->id, $transfer->id); - } - - public function testTransferUpdateMetadata() - { - $transfer = self::createTestTransfer(array(), $this->opts); - - $transfer->metadata['test'] = 'foo bar'; - $transfer->save(); - - $updatedTransfer = Transfer::retrieve($transfer->id, $this->opts); - $this->assertSame('foo bar', $updatedTransfer->metadata['test']); - } - - public function testTransferUpdateMetadataAll() - { - $transfer = self::createTestTransfer(array(), $this->opts); - - $transfer->metadata = array('test' => 'foo bar'); - $transfer->save(); - - $updatedTransfer = Transfer::retrieve($transfer->id, $this->opts); - $this->assertSame('foo bar', $updatedTransfer->metadata['test']); - } -} diff --git a/htdocs/includes/stripe/tests/UtilTest.php b/htdocs/includes/stripe/tests/UtilTest.php deleted file mode 100644 index a1206d698f7..00000000000 --- a/htdocs/includes/stripe/tests/UtilTest.php +++ /dev/null @@ -1,45 +0,0 @@ -assertTrue(Util\Util::isList($list)); - - $notlist = array(5, 'nstaoush', array(), 'bar' => 'baz'); - $this->assertFalse(Util\Util::isList($notlist)); - } - - public function testThatPHPHasValueSemanticsForArrays() - { - $original = array('php-arrays' => 'value-semantics'); - $derived = $original; - $derived['php-arrays'] = 'reference-semantics'; - - $this->assertSame('value-semantics', $original['php-arrays']); - } - - public function testConvertStripeObjectToArrayIncludesId() - { - $customer = self::createTestCustomer(); - $this->assertTrue(array_key_exists("id", $customer->__toArray(true))); - } - - public function testUtf8() - { - // UTF-8 string - $x = "\xc3\xa9"; - $this->assertSame(Util\Util::utf8($x), $x); - - // Latin-1 string - $x = "\xe9"; - $this->assertSame(Util\Util::utf8($x), "\xc3\xa9"); - - // Not a string - $x = true; - $this->assertSame(Util\Util::utf8($x), $x); - } -} diff --git a/htdocs/includes/stripe/tests/bootstrap.no_autoload.php b/htdocs/includes/stripe/tests/bootstrap.no_autoload.php index 7358058780a..7011a3f4782 100644 --- a/htdocs/includes/stripe/tests/bootstrap.no_autoload.php +++ b/htdocs/includes/stripe/tests/bootstrap.no_autoload.php @@ -1,4 +1,5 @@ Date: Wed, 7 Mar 2018 19:26:06 +0100 Subject: [PATCH 15/22] NEW Upgrade of Stripe lib to 6.4.1 --- .../includes/stripe/lib/ApiOperations/All.php | 34 ++ .../stripe/lib/ApiOperations/Create.php | 28 + .../stripe/lib/ApiOperations/Delete.php | 27 + .../lib/ApiOperations/NestedResource.php | 115 ++++ .../stripe/lib/ApiOperations/Request.php | 60 ++ .../stripe/lib/ApiOperations/Retrieve.php | 27 + .../stripe/lib/ApiOperations/Update.php | 46 ++ .../includes/stripe/lib/Error/Idempotency.php | 7 + .../stripe/lib/Error/OAuth/InvalidClient.php | 10 + .../stripe/lib/Error/OAuth/InvalidGrant.php | 13 + .../stripe/lib/Error/OAuth/InvalidRequest.php | 11 + .../stripe/lib/Error/OAuth/InvalidScope.php | 10 + .../stripe/lib/Error/OAuth/OAuthBase.php | 23 + .../lib/Error/OAuth/UnsupportedGrantType.php | 11 + .../Error/OAuth/UnsupportedResponseType.php | 11 + .../lib/Error/SignatureVerification.php | 20 + .../stripe/lib/Util/DefaultLogger.php | 18 + .../stripe/lib/Util/LoggerInterface.php | 36 ++ .../stripe/lib/Util/RandomGenerator.php | 34 ++ .../stripe/tests/Stripe/AccountTest.php | 365 +++++++++++ .../stripe/tests/Stripe/AlipayAccountTest.php | 76 +++ .../stripe/tests/Stripe/ApiRequestorTest.php | 572 ++++++++++++++++++ .../tests/Stripe/ApplePayDomainTest.php | 52 ++ .../tests/Stripe/ApplicationFeeRefundTest.php | 21 + .../tests/Stripe/ApplicationFeeTest.php | 83 +++ .../stripe/tests/Stripe/BalanceTest.php | 16 + .../tests/Stripe/BalanceTransactionTest.php | 29 + .../stripe/tests/Stripe/BankAccountTest.php | 99 +++ .../tests/Stripe/BitcoinReceiverTest.php | 62 ++ .../includes/stripe/tests/Stripe/CardTest.php | 94 +++ .../stripe/tests/Stripe/ChargeTest.php | 140 +++++ .../stripe/tests/Stripe/CollectionTest.php | 147 +++++ .../stripe/tests/Stripe/CountrySpecTest.php | 29 + .../stripe/tests/Stripe/CouponTest.php | 79 +++ .../stripe/tests/Stripe/CustomerTest.php | 269 ++++++++ .../stripe/tests/Stripe/DisputeTest.php | 65 ++ .../stripe/tests/Stripe/EphemeralKeyTest.php | 43 ++ .../stripe/tests/Stripe/Error/BaseTest.php | 36 ++ .../Error/SignatureVerificationTest.php | 12 + .../stripe/tests/Stripe/EventTest.php | 29 + .../stripe/tests/Stripe/ExchangeRateTest.php | 54 ++ .../stripe/tests/Stripe/FileUploadTest.php | 104 ++++ .../Stripe/HttpClient/CurlClientTest.php | 228 +++++++ .../stripe/tests/Stripe/InvoiceItemTest.php | 78 +++ .../stripe/tests/Stripe/InvoiceTest.php | 87 +++ .../stripe/tests/Stripe/OAuthTest.php | 97 +++ .../stripe/tests/Stripe/OrderReturnTest.php | 29 + .../stripe/tests/Stripe/OrderTest.php | 87 +++ .../stripe/tests/Stripe/PayoutTest.php | 77 +++ .../includes/stripe/tests/Stripe/PlanTest.php | 80 +++ .../stripe/tests/Stripe/ProductTest.php | 77 +++ .../stripe/tests/Stripe/RecipientTest.php | 90 +++ .../stripe/tests/Stripe/RefundTest.php | 65 ++ .../includes/stripe/tests/Stripe/SKUTest.php | 82 +++ .../stripe/tests/Stripe/SourceTest.php | 134 ++++ .../stripe/tests/Stripe/StripeObjectTest.php | 453 ++++++++++++++ .../stripe/tests/Stripe/StripeTest.php | 30 + .../tests/Stripe/SubscriptionItemTest.php | 77 +++ .../stripe/tests/Stripe/SubscriptionTest.php | 115 ++++ .../stripe/tests/Stripe/ThreeDSecureTest.php | 32 + .../stripe/tests/Stripe/TokenTest.php | 28 + .../stripe/tests/Stripe/TopupTest.php | 69 +++ .../tests/Stripe/TransferReversalTest.php | 21 + .../stripe/tests/Stripe/TransferTest.php | 140 +++++ .../tests/Stripe/Util/DefaultLoggerTest.php | 28 + .../tests/Stripe/Util/RequestOptionsTest.php | 81 +++ .../stripe/tests/Stripe/Util/UtilTest.php | 90 +++ .../stripe/tests/Stripe/WebhookTest.php | 110 ++++ htdocs/includes/stripe/tests/data/test.png | Bin 0 -> 95 bytes 69 files changed, 5502 insertions(+) create mode 100644 htdocs/includes/stripe/lib/ApiOperations/All.php create mode 100644 htdocs/includes/stripe/lib/ApiOperations/Create.php create mode 100644 htdocs/includes/stripe/lib/ApiOperations/Delete.php create mode 100644 htdocs/includes/stripe/lib/ApiOperations/NestedResource.php create mode 100644 htdocs/includes/stripe/lib/ApiOperations/Request.php create mode 100644 htdocs/includes/stripe/lib/ApiOperations/Retrieve.php create mode 100644 htdocs/includes/stripe/lib/ApiOperations/Update.php create mode 100644 htdocs/includes/stripe/lib/Error/Idempotency.php create mode 100644 htdocs/includes/stripe/lib/Error/OAuth/InvalidClient.php create mode 100644 htdocs/includes/stripe/lib/Error/OAuth/InvalidGrant.php create mode 100644 htdocs/includes/stripe/lib/Error/OAuth/InvalidRequest.php create mode 100644 htdocs/includes/stripe/lib/Error/OAuth/InvalidScope.php create mode 100644 htdocs/includes/stripe/lib/Error/OAuth/OAuthBase.php create mode 100644 htdocs/includes/stripe/lib/Error/OAuth/UnsupportedGrantType.php create mode 100644 htdocs/includes/stripe/lib/Error/OAuth/UnsupportedResponseType.php create mode 100644 htdocs/includes/stripe/lib/Error/SignatureVerification.php create mode 100644 htdocs/includes/stripe/lib/Util/DefaultLogger.php create mode 100644 htdocs/includes/stripe/lib/Util/LoggerInterface.php create mode 100644 htdocs/includes/stripe/lib/Util/RandomGenerator.php create mode 100644 htdocs/includes/stripe/tests/Stripe/AccountTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/AlipayAccountTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/ApiRequestorTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/ApplePayDomainTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/ApplicationFeeRefundTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/ApplicationFeeTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/BalanceTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/BalanceTransactionTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/BankAccountTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/BitcoinReceiverTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/CardTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/ChargeTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/CollectionTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/CountrySpecTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/CouponTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/CustomerTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/DisputeTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/EphemeralKeyTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/Error/BaseTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/Error/SignatureVerificationTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/EventTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/ExchangeRateTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/FileUploadTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/HttpClient/CurlClientTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/InvoiceItemTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/InvoiceTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/OAuthTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/OrderReturnTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/OrderTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/PayoutTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/PlanTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/ProductTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/RecipientTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/RefundTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/SKUTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/SourceTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/StripeObjectTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/StripeTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/SubscriptionItemTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/SubscriptionTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/ThreeDSecureTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/TokenTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/TopupTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/TransferReversalTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/TransferTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/Util/DefaultLoggerTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/Util/RequestOptionsTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/Util/UtilTest.php create mode 100644 htdocs/includes/stripe/tests/Stripe/WebhookTest.php create mode 100644 htdocs/includes/stripe/tests/data/test.png diff --git a/htdocs/includes/stripe/lib/ApiOperations/All.php b/htdocs/includes/stripe/lib/ApiOperations/All.php new file mode 100644 index 00000000000..d1c6424816f --- /dev/null +++ b/htdocs/includes/stripe/lib/ApiOperations/All.php @@ -0,0 +1,34 @@ +json, $opts); + if (!is_a($obj, 'Stripe\\Collection')) { + $class = get_class($obj); + $message = "Expected type \"Stripe\\Collection\", got \"$class\" instead"; + throw new Error\Api($message); + } + $obj->setLastResponse($response); + $obj->setRequestParams($params); + return $obj; + } +} diff --git a/htdocs/includes/stripe/lib/ApiOperations/Create.php b/htdocs/includes/stripe/lib/ApiOperations/Create.php new file mode 100644 index 00000000000..0fb341d029b --- /dev/null +++ b/htdocs/includes/stripe/lib/ApiOperations/Create.php @@ -0,0 +1,28 @@ +json, $opts); + $obj->setLastResponse($response); + return $obj; + } +} diff --git a/htdocs/includes/stripe/lib/ApiOperations/Delete.php b/htdocs/includes/stripe/lib/ApiOperations/Delete.php new file mode 100644 index 00000000000..7df6797919a --- /dev/null +++ b/htdocs/includes/stripe/lib/ApiOperations/Delete.php @@ -0,0 +1,27 @@ +instanceUrl(); + list($response, $opts) = $this->_request('delete', $url, $params, $opts); + $this->refreshFrom($response, $opts); + return $this; + } +} diff --git a/htdocs/includes/stripe/lib/ApiOperations/NestedResource.php b/htdocs/includes/stripe/lib/ApiOperations/NestedResource.php new file mode 100644 index 00000000000..1c3a73f45de --- /dev/null +++ b/htdocs/includes/stripe/lib/ApiOperations/NestedResource.php @@ -0,0 +1,115 @@ +json, $opts); + $obj->setLastResponse($response); + return $obj; + } + + /** + * @param string $id + * @param string $nestedPath + * @param string|null $nestedId + * + * @return string + */ + protected static function _nestedResourceUrl($id, $nestedPath, $nestedId = null) + { + $url = static::resourceUrl($id) . $nestedPath; + if ($nestedId !== null) { + $url .= "/$nestedId"; + } + return $url; + } + + /** + * @param string $id + * @param string $nestedPath + * @param array|null $params + * @param array|string|null $options + * + * @return \Stripe\StripeObject + */ + protected static function _createNestedResource($id, $nestedPath, $params = null, $options = null) + { + $url = static::_nestedResourceUrl($id, $nestedPath); + return self::_nestedResourceOperation('post', $url, $params, $options); + } + + /** + * @param string $id + * @param string $nestedPath + * @param array|null $params + * @param array|string|null $options + * + * @return \Stripe\StripeObject + */ + protected static function _retrieveNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null) + { + $url = static::_nestedResourceUrl($id, $nestedPath, $nestedId); + return self::_nestedResourceOperation('get', $url, $params, $options); + } + + /** + * @param string $id + * @param string $nestedPath + * @param array|null $params + * @param array|string|null $options + * + * @return \Stripe\StripeObject + */ + protected static function _updateNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null) + { + $url = static::_nestedResourceUrl($id, $nestedPath, $nestedId); + return self::_nestedResourceOperation('post', $url, $params, $options); + } + + /** + * @param string $id + * @param string $nestedPath + * @param array|null $params + * @param array|string|null $options + * + * @return \Stripe\StripeObject + */ + protected static function _deleteNestedResource($id, $nestedPath, $nestedId, $params = null, $options = null) + { + $url = static::_nestedResourceUrl($id, $nestedPath, $nestedId); + return self::_nestedResourceOperation('delete', $url, $params, $options); + } + + /** + * @param string $id + * @param string $nestedPath + * @param array|null $params + * @param array|string|null $options + * + * @return \Stripe\StripeObject + */ + protected static function _allNestedResources($id, $nestedPath, $params = null, $options = null) + { + $url = static::_nestedResourceUrl($id, $nestedPath); + return self::_nestedResourceOperation('get', $url, $params, $options); + } +} diff --git a/htdocs/includes/stripe/lib/ApiOperations/Request.php b/htdocs/includes/stripe/lib/ApiOperations/Request.php new file mode 100644 index 00000000000..c6b06585ad2 --- /dev/null +++ b/htdocs/includes/stripe/lib/ApiOperations/Request.php @@ -0,0 +1,60 @@ + 100, " + . "'currency' => 'usd', 'source' => 'tok_1234'])\")"; + throw new \Stripe\Error\Api($message); + } + } + + /** + * @param string $method HTTP method ('get', 'post', etc.) + * @param string $url URL for the request + * @param array $params list of parameters for the request + * @param array|string|null $options + * + * @return array tuple containing (the JSON response, $options) + */ + protected function _request($method, $url, $params = [], $options = null) + { + $opts = $this->_opts->merge($options); + list($resp, $options) = static::_staticRequest($method, $url, $params, $opts); + $this->setLastResponse($resp); + return [$resp->json, $options]; + } + + /** + * @param string $method HTTP method ('get', 'post', etc.) + * @param string $url URL for the request + * @param array $params list of parameters for the request + * @param array|string|null $options + * + * @return array tuple containing (the JSON response, $options) + */ + protected static function _staticRequest($method, $url, $params, $options) + { + $opts = \Stripe\Util\RequestOptions::parse($options); + $requestor = new \Stripe\ApiRequestor($opts->apiKey, static::baseUrl()); + list($response, $opts->apiKey) = $requestor->request($method, $url, $params, $opts->headers); + $opts->discardNonPersistentHeaders(); + return [$response, $opts]; + } +} diff --git a/htdocs/includes/stripe/lib/ApiOperations/Retrieve.php b/htdocs/includes/stripe/lib/ApiOperations/Retrieve.php new file mode 100644 index 00000000000..a037326b3e8 --- /dev/null +++ b/htdocs/includes/stripe/lib/ApiOperations/Retrieve.php @@ -0,0 +1,27 @@ +refresh(); + return $instance; + } +} diff --git a/htdocs/includes/stripe/lib/ApiOperations/Update.php b/htdocs/includes/stripe/lib/ApiOperations/Update.php new file mode 100644 index 00000000000..0683e77af1a --- /dev/null +++ b/htdocs/includes/stripe/lib/ApiOperations/Update.php @@ -0,0 +1,46 @@ +json, $opts); + $obj->setLastResponse($response); + return $obj; + } + + /** + * @param array|string|null $opts + * + * @return \Stripe\ApiResource The saved resource. + */ + public function save($opts = null) + { + $params = $this->serializeParameters(); + if (count($params) > 0) { + $url = $this->instanceUrl(); + list($response, $opts) = $this->_request('post', $url, $params, $opts); + $this->refreshFrom($response, $opts); + } + return $this; + } +} diff --git a/htdocs/includes/stripe/lib/Error/Idempotency.php b/htdocs/includes/stripe/lib/Error/Idempotency.php new file mode 100644 index 00000000000..ea44d12e4ea --- /dev/null +++ b/htdocs/includes/stripe/lib/Error/Idempotency.php @@ -0,0 +1,7 @@ +code = $code; + } + + public function getErrorCode() + { + return $this->code; + } +} diff --git a/htdocs/includes/stripe/lib/Error/OAuth/UnsupportedGrantType.php b/htdocs/includes/stripe/lib/Error/OAuth/UnsupportedGrantType.php new file mode 100644 index 00000000000..421adc99645 --- /dev/null +++ b/htdocs/includes/stripe/lib/Error/OAuth/UnsupportedGrantType.php @@ -0,0 +1,11 @@ +sigHeader = $sigHeader; + } + + public function getSigHeader() + { + return $this->sigHeader; + } +} diff --git a/htdocs/includes/stripe/lib/Util/DefaultLogger.php b/htdocs/includes/stripe/lib/Util/DefaultLogger.php new file mode 100644 index 00000000000..1a8663699f5 --- /dev/null +++ b/htdocs/includes/stripe/lib/Util/DefaultLogger.php @@ -0,0 +1,18 @@ + 0) { + throw new \Exception('DefaultLogger does not currently implement context. Please implement if you need it.'); + } + error_log($message); + } +} diff --git a/htdocs/includes/stripe/lib/Util/LoggerInterface.php b/htdocs/includes/stripe/lib/Util/LoggerInterface.php new file mode 100644 index 00000000000..bbdfc929982 --- /dev/null +++ b/htdocs/includes/stripe/lib/Util/LoggerInterface.php @@ -0,0 +1,36 @@ +expectsRequest( + 'get', + '/v1/accounts' + ); + $resources = Account::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\Account", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/accounts/' . self::TEST_RESOURCE_ID + ); + $resource = Account::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\Account", $resource); + } + + public function testIsRetrievableWithoutId() + { + $this->expectsRequest( + 'get', + '/v1/account' + ); + $resource = Account::retrieve(); + $this->assertInstanceOf("Stripe\\Account", $resource); + } + + public function testIsCreatable() + { + $this->expectsRequest( + 'post', + '/v1/accounts' + ); + $resource = Account::create(["type" => "custom"]); + $this->assertInstanceOf("Stripe\\Account", $resource); + } + + public function testIsSaveable() + { + $resource = Account::retrieve(self::TEST_RESOURCE_ID); + $resource->metadata["key"] = "value"; + $this->expectsRequest( + 'post', + '/v1/accounts/' . $resource->id + ); + $resource->save(); + $this->assertInstanceOf("Stripe\\Account", $resource); + } + + public function testIsUpdatable() + { + $this->expectsRequest( + 'post', + '/v1/accounts/' . self::TEST_RESOURCE_ID + ); + $resource = Account::update(self::TEST_RESOURCE_ID, [ + "metadata" => ["key" => "value"], + ]); + $this->assertInstanceOf("Stripe\\Account", $resource); + } + + public function testIsDeletable() + { + $resource = Account::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'delete', + '/v1/accounts/' . $resource->id + ); + $resource->delete(); + $this->assertInstanceOf("Stripe\\Account", $resource); + } + + public function testIsRejectable() + { + $account = Account::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'post', + '/v1/accounts/' . $account->id . '/reject' + ); + $resource = $account->reject(["reason" => "fraud"]); + $this->assertInstanceOf("Stripe\\Account", $resource); + $this->assertSame($resource, $account); + } + + public function testIsDeauthorizable() + { + $resource = Account::retrieve(self::TEST_RESOURCE_ID); + $this->stubRequest( + 'post', + '/oauth/deauthorize', + [ + 'client_id' => Stripe::getClientId(), + 'stripe_user_id' => $resource->id, + ], + null, + false, + [ + 'stripe_user_id' => $resource->id, + ], + 200, + Stripe::$connectBase + ); + $resource->deauthorize(); + } + + public function testCanCreateExternalAccount() + { + $this->expectsRequest( + 'post', + '/v1/accounts/' . self::TEST_RESOURCE_ID . '/external_accounts' + ); + $resource = Account::createExternalAccount(self::TEST_RESOURCE_ID, [ + "external_account" => "btok_123", + ]); + $this->assertInstanceOf("Stripe\\BankAccount", $resource); + } + + public function testCanRetrieveExternalAccount() + { + $this->expectsRequest( + 'get', + '/v1/accounts/' . self::TEST_RESOURCE_ID . '/external_accounts/' . self::TEST_EXTERNALACCOUNT_ID + ); + $resource = Account::retrieveExternalAccount(self::TEST_RESOURCE_ID, self::TEST_EXTERNALACCOUNT_ID); + $this->assertInstanceOf("Stripe\\BankAccount", $resource); + } + + public function testCanUpdateExternalAccount() + { + $this->expectsRequest( + 'post', + '/v1/accounts/' . self::TEST_RESOURCE_ID . '/external_accounts/' . self::TEST_EXTERNALACCOUNT_ID + ); + $resource = Account::updateExternalAccount(self::TEST_RESOURCE_ID, self::TEST_EXTERNALACCOUNT_ID, [ + "name" => "name", + ]); + $this->assertInstanceOf("Stripe\\BankAccount", $resource); + } + + public function testCanDeleteExternalAccount() + { + $this->expectsRequest( + 'delete', + '/v1/accounts/' . self::TEST_RESOURCE_ID . '/external_accounts/' . self::TEST_EXTERNALACCOUNT_ID + ); + $resource = Account::deleteExternalAccount(self::TEST_RESOURCE_ID, self::TEST_EXTERNALACCOUNT_ID); + $this->assertInstanceOf("Stripe\\BankAccount", $resource); + } + + public function testCanListExternalAccounts() + { + $this->expectsRequest( + 'get', + '/v1/accounts/' . self::TEST_RESOURCE_ID . '/external_accounts' + ); + $resources = Account::allExternalAccounts(self::TEST_RESOURCE_ID); + $this->assertTrue(is_array($resources->data)); + } + + public function testCanCreateLoginLink() + { + $this->expectsRequest( + 'post', + '/v1/accounts/' . self::TEST_RESOURCE_ID . '/login_links' + ); + $resource = Account::createLoginLink(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\LoginLink", $resource); + } + + public function testSerializeNewAdditionalOwners() + { + $obj = Util\Util::convertToStripeObject([ + 'object' => 'account', + 'legal_entity' => StripeObject::constructFrom([]), + ], null); + $obj->legal_entity->additional_owners = [ + ['first_name' => 'Joe'], + ['first_name' => 'Jane'], + ]; + + $expected = [ + 'legal_entity' => [ + 'additional_owners' => [ + 0 => ['first_name' => 'Joe'], + 1 => ['first_name' => 'Jane'], + ], + ], + ]; + $this->assertSame($expected, $obj->serializeParameters()); + } + + public function testSerializePartiallyChangedAdditionalOwners() + { + $obj = Util\Util::convertToStripeObject([ + 'object' => 'account', + 'legal_entity' => [ + 'additional_owners' => [ + StripeObject::constructFrom(['first_name' => 'Joe']), + StripeObject::constructFrom(['first_name' => 'Jane']), + ], + ], + ], null); + $obj->legal_entity->additional_owners[1]->first_name = 'Stripe'; + + $expected = [ + 'legal_entity' => [ + 'additional_owners' => [ + 1 => ['first_name' => 'Stripe'], + ], + ], + ]; + $this->assertSame($expected, $obj->serializeParameters()); + } + + public function testSerializeUnchangedAdditionalOwners() + { + $obj = Util\Util::convertToStripeObject([ + 'object' => 'account', + 'legal_entity' => [ + 'additional_owners' => [ + StripeObject::constructFrom(['first_name' => 'Joe']), + StripeObject::constructFrom(['first_name' => 'Jane']), + ], + ], + ], null); + + $expected = [ + 'legal_entity' => [ + 'additional_owners' => [], + ], + ]; + $this->assertSame($expected, $obj->serializeParameters()); + } + + public function testSerializeUnsetAdditionalOwners() + { + $obj = Util\Util::convertToStripeObject([ + 'object' => 'account', + 'legal_entity' => [ + 'additional_owners' => [ + StripeObject::constructFrom(['first_name' => 'Joe']), + StripeObject::constructFrom(['first_name' => 'Jane']), + ], + ], + ], null); + $obj->legal_entity->additional_owners = null; + + // Note that the empty string that we send for this one has a special + // meaning for the server, which interprets it as an array unset. + $expected = [ + 'legal_entity' => [ + 'additional_owners' => '', + ], + ]; + $this->assertSame($expected, $obj->serializeParameters()); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testSerializeAdditionalOwnersDeletedItem() + { + $obj = Util\Util::convertToStripeObject([ + 'object' => 'account', + 'legal_entity' => [ + 'additional_owners' => [ + StripeObject::constructFrom(['first_name' => 'Joe']), + StripeObject::constructFrom(['first_name' => 'Jane']), + ], + ], + ], null); + unset($obj->legal_entity->additional_owners[0]); + + $obj->serializeParameters(); + } + + public function testSerializeExternalAccountString() + { + $obj = Util\Util::convertToStripeObject([ + 'object' => 'account', + ], null); + $obj->external_account = 'btok_123'; + + $expected = [ + 'external_account' => 'btok_123', + ]; + $this->assertSame($expected, $obj->serializeParameters()); + } + + public function testSerializeExternalAccountHash() + { + $obj = Util\Util::convertToStripeObject([ + 'object' => 'account', + ], null); + $obj->external_account = [ + 'object' => 'bank_account', + 'routing_number' => '110000000', + 'account_number' => '000123456789', + 'country' => 'US', + 'currency' => 'usd', + ]; + + $expected = [ + 'external_account' => [ + 'object' => 'bank_account', + 'routing_number' => '110000000', + 'account_number' => '000123456789', + 'country' => 'US', + 'currency' => 'usd', + ], + ]; + $this->assertSame($expected, $obj->serializeParameters()); + } + + public function testSerializeBankAccountString() + { + $obj = Util\Util::convertToStripeObject([ + 'object' => 'account', + ], null); + $obj->bank_account = 'btok_123'; + + $expected = [ + 'bank_account' => 'btok_123', + ]; + $this->assertSame($expected, $obj->serializeParameters()); + } + + public function testSerializeBankAccountHash() + { + $obj = Util\Util::convertToStripeObject([ + 'object' => 'account', + ], null); + $obj->bank_account = [ + 'object' => 'bank_account', + 'routing_number' => '110000000', + 'account_number' => '000123456789', + 'country' => 'US', + 'currency' => 'usd', + ]; + + $expected = [ + 'bank_account' => [ + 'object' => 'bank_account', + 'routing_number' => '110000000', + 'account_number' => '000123456789', + 'country' => 'US', + 'currency' => 'usd', + ], + ]; + $this->assertSame($expected, $obj->serializeParameters()); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/AlipayAccountTest.php b/htdocs/includes/stripe/tests/Stripe/AlipayAccountTest.php new file mode 100644 index 00000000000..7159f5444df --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/AlipayAccountTest.php @@ -0,0 +1,76 @@ + self::TEST_RESOURCE_ID, + 'object' => 'card', + 'metadata' => [], + ]; + return AlipayAccount::constructFrom( + array_merge($params, $base), + new Util\RequestOptions() + ); + } + + public function testHasCorrectUrlForCustomer() + { + $resource = $this->createFixture(['customer' => 'cus_123']); + $this->assertSame( + "/v1/customers/cus_123/sources/" . self::TEST_RESOURCE_ID, + $resource->instanceUrl() + ); + } + + /** + * @expectedException \Stripe\Error\InvalidRequest + */ + public function testIsNotDirectlyRetrievable() + { + AlipayAccount::retrieve(self::TEST_RESOURCE_ID); + } + + public function testIsSaveable() + { + $resource = $this->createFixture(); + $resource->metadata["key"] = "value"; + $this->expectsRequest( + 'post', + '/v1/customers/cus_123/sources/' . self::TEST_RESOURCE_ID + ); + $resource->save(); + $this->assertSame("Stripe\\AlipayAccount", get_class($resource)); + } + + /** + * @expectedException \Stripe\Error\InvalidRequest + */ + public function testIsNotDirectlyUpdatable() + { + AlipayAccount::update(self::TEST_RESOURCE_ID, [ + "metadata" => ["key" => "value"], + ]); + } + + public function testIsDeletable() + { + $resource = $this->createFixture(); + $this->expectsRequest( + 'delete', + '/v1/customers/cus_123/sources/' . self::TEST_RESOURCE_ID + ); + $resource->delete(); + $this->assertSame("Stripe\\AlipayAccount", get_class($resource)); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/ApiRequestorTest.php b/htdocs/includes/stripe/tests/Stripe/ApiRequestorTest.php new file mode 100644 index 00000000000..6fb8229c57d --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/ApiRequestorTest.php @@ -0,0 +1,572 @@ +getMethod('_encodeObjects'); + $method->setAccessible(true); + + $a = ['customer' => new Customer('abcd')]; + $enc = $method->invoke(null, $a); + $this->assertSame($enc, ['customer' => 'abcd']); + + // Preserves UTF-8 + $v = ['customer' => "☃"]; + $enc = $method->invoke(null, $v); + $this->assertSame($enc, $v); + + // Encodes latin-1 -> UTF-8 + $v = ['customer' => "\xe9"]; + $enc = $method->invoke(null, $v); + $this->assertSame($enc, ['customer' => "\xc3\xa9"]); + + // Encodes booleans + $v = true; + $enc = $method->invoke(null, $v); + $this->assertSame('true', $enc); + + $v = false; + $enc = $method->invoke(null, $v); + $this->assertSame('false', $enc); + } + + public function testHttpClientInjection() + { + $reflector = new \ReflectionClass('Stripe\\ApiRequestor'); + $method = $reflector->getMethod('httpClient'); + $method->setAccessible(true); + + $curl = new CurlClient(); + $curl->setTimeout(10); + ApiRequestor::setHttpClient($curl); + + $injectedCurl = $method->invoke(new ApiRequestor()); + $this->assertSame($injectedCurl, $curl); + } + + public function testDefaultHeaders() + { + $reflector = new \ReflectionClass('Stripe\\ApiRequestor'); + $method = $reflector->getMethod('_defaultHeaders'); + $method->setAccessible(true); + + // no way to stub static methods with PHPUnit 4.x :( + Stripe::setAppInfo('MyTestApp', '1.2.34', 'https://mytestapp.example'); + $apiKey = 'sk_test_notarealkey'; + $clientInfo = ['httplib' => 'testlib 0.1.2']; + + $headers = $method->invoke(null, $apiKey, $clientInfo); + + $ua = json_decode($headers['X-Stripe-Client-User-Agent']); + $this->assertSame($ua->application->name, 'MyTestApp'); + $this->assertSame($ua->application->version, '1.2.34'); + $this->assertSame($ua->application->url, 'https://mytestapp.example'); + + $this->assertSame($ua->httplib, 'testlib 0.1.2'); + + $this->assertSame( + $headers['User-Agent'], + 'Stripe/v1 PhpBindings/' . Stripe::VERSION . ' MyTestApp/1.2.34 (https://mytestapp.example)' + ); + + $this->assertSame($headers['Authorization'], 'Bearer ' . $apiKey); + } + + /** + * @expectedException \Stripe\Error\Authentication + * @expectedExceptionMessageRegExp #No API key provided# + */ + public function testRaisesAuthenticationErrorWhenNoApiKey() + { + Stripe::setApiKey(null); + Charge::create(); + } + + public function testRaisesInvalidRequestErrorOn400() + { + $this->stubRequest( + 'POST', + '/v1/charges', + [], + null, + false, + [ + 'error' => [ + 'type' => 'invalid_request_error', + 'message' => 'Missing id', + 'param' => 'id', + ], + ], + 400 + ); + + try { + Charge::create(); + $this->fail("Did not raise error"); + } catch (Error\InvalidRequest $e) { + $this->assertSame(400, $e->getHttpStatus()); + $this->assertTrue(is_array($e->getJsonBody())); + $this->assertSame('Missing id', $e->getMessage()); + $this->assertSame('id', $e->getStripeParam()); + } catch (\Exception $e) { + $this->fail("Unexpected exception: " . get_class($e)); + } + } + + public function testRaisesIdempotencyErrorOn400AndTypeIdempotencyError() + { + $this->stubRequest( + 'POST', + '/v1/charges', + array(), + null, + false, + array( + 'error' => array( + 'type' => 'idempotency_error', + 'message' => "Keys for idempotent requests can only be used with the same parameters they were first used with. Try using a key other than 'abc' if you meant to execute a different request.", + ), + ), + 400 + ); + + try { + Charge::create(); + $this->fail("Did not raise error"); + } catch (Error\Idempotency $e) { + $this->assertSame(400, $e->getHttpStatus()); + $this->assertTrue(is_array($e->getJsonBody())); + $this->assertSame("Keys for idempotent requests can only be used with the same parameters they were first used with. Try using a key other than 'abc' if you meant to execute a different request.", $e->getMessage()); + } catch (\Exception $e) { + $this->fail("Unexpected exception: " . get_class($e)); + } + } + + public function testRaisesAuthenticationErrorOn401() + { + $this->stubRequest( + 'POST', + '/v1/charges', + [], + null, + false, + [ + 'error' => [ + 'type' => 'invalid_request_error', + 'message' => 'You did not provide an API key.', + ], + ], + 401 + ); + + try { + Charge::create(); + $this->fail("Did not raise error"); + } catch (Error\Authentication $e) { + $this->assertSame(401, $e->getHttpStatus()); + $this->assertTrue(is_array($e->getJsonBody())); + $this->assertSame('You did not provide an API key.', $e->getMessage()); + } catch (\Exception $e) { + $this->fail("Unexpected exception: " . get_class($e)); + } + } + + public function testRaisesCardErrorOn402() + { + $this->stubRequest( + 'POST', + '/v1/charges', + [], + null, + false, + [ + 'error' => [ + 'type' => 'card_error', + 'message' => 'Your card was declined.', + 'code' => 'card_declined', + 'decline_code' => 'generic_decline', + 'charge' => 'ch_declined_charge', + 'param' => 'exp_month', + ], + ], + 402 + ); + + try { + Charge::create(); + $this->fail("Did not raise error"); + } catch (Error\Card $e) { + $this->assertSame(402, $e->getHttpStatus()); + $this->assertTrue(is_array($e->getJsonBody())); + $this->assertSame('Your card was declined.', $e->getMessage()); + $this->assertSame('card_declined', $e->getStripeCode()); + $this->assertSame('generic_decline', $e->getDeclineCode()); + $this->assertSame('exp_month', $e->getStripeParam()); + } catch (\Exception $e) { + $this->fail("Unexpected exception: " . get_class($e)); + } + } + + public function testRaisesPermissionErrorOn403() + { + $this->stubRequest( + 'GET', + '/v1/accounts/foo', + [], + null, + false, + [ + 'error' => [ + 'type' => 'invalid_request_error', + 'message' => "The provided key 'sk_test_********************1234' does not have access to account 'foo' (or that account does not exist). Application access may have been revoked.", + ], + ], + 403 + ); + + try { + Account::retrieve('foo'); + $this->fail("Did not raise error"); + } catch (Error\Permission $e) { + $this->assertSame(403, $e->getHttpStatus()); + $this->assertTrue(is_array($e->getJsonBody())); + $this->assertSame("The provided key 'sk_test_********************1234' does not have access to account 'foo' (or that account does not exist). Application access may have been revoked.", $e->getMessage()); + } catch (\Exception $e) { + $this->fail("Unexpected exception: " . get_class($e)); + } + } + + public function testRaisesInvalidRequestErrorOn404() + { + $this->stubRequest( + 'GET', + '/v1/charges/foo', + [], + null, + false, + [ + 'error' => [ + 'type' => 'invalid_request_error', + 'message' => 'No such charge: foo', + 'param' => 'id', + ], + ], + 404 + ); + + try { + Charge::retrieve('foo'); + $this->fail("Did not raise error"); + } catch (Error\InvalidRequest $e) { + $this->assertSame(404, $e->getHttpStatus()); + $this->assertTrue(is_array($e->getJsonBody())); + $this->assertSame('No such charge: foo', $e->getMessage()); + $this->assertSame('id', $e->getStripeParam()); + } catch (\Exception $e) { + $this->fail("Unexpected exception: " . get_class($e)); + } + } + + public function testRaisesRateLimitErrorOn429() + { + $this->stubRequest( + 'POST', + '/v1/charges', + [], + null, + false, + [ + 'error' => [ + 'message' => 'Too many requests', + ], + ], + 429 + ); + + try { + Charge::create(); + $this->fail("Did not raise error"); + } catch (Error\RateLimit $e) { + $this->assertSame(429, $e->getHttpStatus()); + $this->assertTrue(is_array($e->getJsonBody())); + $this->assertSame('Too many requests', $e->getMessage()); + } catch (\Exception $e) { + $this->fail("Unexpected exception: " . get_class($e)); + } + } + + public function testRaisesRateLimitErrorOn400AndCodeRateLimit() + { + $this->stubRequest( + 'POST', + '/v1/charges', + [], + null, + false, + [ + 'error' => [ + 'code' => 'rate_limit', + 'message' => 'Too many requests', + ], + ], + 400 + ); + + try { + Charge::create(); + $this->fail("Did not raise error"); + } catch (Error\RateLimit $e) { + $this->assertSame(400, $e->getHttpStatus()); + $this->assertTrue(is_array($e->getJsonBody())); + $this->assertSame('Too many requests', $e->getMessage()); + } catch (\Exception $e) { + $this->fail("Unexpected exception: " . get_class($e)); + } + } + + public function testRaisesOAuthInvalidRequestError() + { + $this->stubRequest( + 'POST', + '/oauth/token', + [], + null, + false, + [ + 'error' => 'invalid_request', + 'error_description' => 'No grant type specified', + ], + 400, + Stripe::$connectBase + ); + + try { + OAuth::token(); + $this->fail("Did not raise error"); + } catch (Error\OAuth\InvalidRequest $e) { + $this->assertSame(400, $e->getHttpStatus()); + $this->assertSame('invalid_request', $e->getErrorCode()); + $this->assertSame('No grant type specified', $e->getMessage()); + } catch (\Exception $e) { + $this->fail("Unexpected exception: " . get_class($e)); + } + } + + public function testRaisesOAuthInvalidClientError() + { + $this->stubRequest( + 'POST', + '/oauth/token', + [], + null, + false, + [ + 'error' => 'invalid_client', + 'error_description' => 'No authentication was provided. Send your secret API key using the Authorization header, or as a client_secret POST parameter.', + ], + 401, + Stripe::$connectBase + ); + + try { + OAuth::token(); + $this->fail("Did not raise error"); + } catch (Error\OAuth\InvalidClient $e) { + $this->assertSame(401, $e->getHttpStatus()); + $this->assertSame('invalid_client', $e->getErrorCode()); + $this->assertSame('No authentication was provided. Send your secret API key using the Authorization header, or as a client_secret POST parameter.', $e->getMessage()); + } catch (\Exception $e) { + $this->fail("Unexpected exception: " . get_class($e)); + } + } + + public function testRaisesOAuthInvalidGrantError() + { + $this->stubRequest( + 'POST', + '/oauth/token', + [], + null, + false, + [ + 'error' => 'invalid_grant', + 'error_description' => 'This authorization code has already been used. All tokens issued with this code have been revoked.', + ], + 400, + Stripe::$connectBase + ); + + try { + OAuth::token(); + $this->fail("Did not raise error"); + } catch (Error\OAuth\InvalidGrant $e) { + $this->assertSame(400, $e->getHttpStatus()); + $this->assertSame('invalid_grant', $e->getErrorCode()); + $this->assertSame('This authorization code has already been used. All tokens issued with this code have been revoked.', $e->getMessage()); + } catch (\Exception $e) { + $this->fail("Unexpected exception: " . get_class($e)); + } + } + + public function testRaisesOAuthInvalidScopeError() + { + $this->stubRequest( + 'POST', + '/oauth/token', + [], + null, + false, + [ + 'error' => 'invalid_scope', + 'error_description' => 'Invalid scope provided: invalid_scope.', + ], + 400, + Stripe::$connectBase + ); + + try { + OAuth::token(); + $this->fail("Did not raise error"); + } catch (Error\OAuth\InvalidScope $e) { + $this->assertSame(400, $e->getHttpStatus()); + $this->assertSame('invalid_scope', $e->getErrorCode()); + $this->assertSame('Invalid scope provided: invalid_scope.', $e->getMessage()); + } catch (\Exception $e) { + $this->fail("Unexpected exception: " . get_class($e)); + } + } + + public function testRaisesOAuthUnsupportedGrantTypeError() + { + $this->stubRequest( + 'POST', + '/oauth/token', + [], + null, + false, + [ + 'error' => 'unsupported_grant_type', + ], + 400, + Stripe::$connectBase + ); + + try { + OAuth::token(); + $this->fail("Did not raise error"); + } catch (Error\OAuth\UnsupportedGrantType $e) { + $this->assertSame(400, $e->getHttpStatus()); + $this->assertSame('unsupported_grant_type', $e->getErrorCode()); + } catch (\Exception $e) { + $this->fail("Unexpected exception: " . get_class($e)); + } + } + + public function testRaisesOAuthUnsupportedResponseTypeError() + { + $this->stubRequest( + 'POST', + '/oauth/token', + [], + null, + false, + [ + 'error' => 'unsupported_response_type', + 'error_description' => "Only 'code' response_type is supported, but 'unsupported_response_type' was provided", + ], + 400, + Stripe::$connectBase + ); + + try { + OAuth::token(); + $this->fail("Did not raise error"); + } catch (Error\OAuth\UnsupportedResponseType $e) { + $this->assertSame(400, $e->getHttpStatus()); + $this->assertSame('unsupported_response_type', $e->getErrorCode()); + $this->assertSame("Only 'code' response_type is supported, but 'unsupported_response_type' was provided", $e->getMessage()); + } catch (\Exception $e) { + $this->fail("Unexpected exception: " . get_class($e)); + } + } + + public function testHeaderStripeVersionGlobal() + { + Stripe::setApiVersion('2222-22-22'); + $this->stubRequest( + 'POST', + '/v1/charges', + [], + [ + 'Stripe-Version: 2222-22-22', + ], + false, + [ + 'id' => 'ch_123', + 'object' => 'charge', + ] + ); + Charge::create(); + } + + public function testHeaderStripeVersionRequestOptions() + { + $this->stubRequest( + 'POST', + '/v1/charges', + [], + [ + 'Stripe-Version: 2222-22-22', + ], + false, + [ + 'id' => 'ch_123', + 'object' => 'charge', + ] + ); + Charge::create([], ['stripe_version' => '2222-22-22']); + } + + public function testHeaderStripeAccountGlobal() + { + Stripe::setAccountId('acct_123'); + $this->stubRequest( + 'POST', + '/v1/charges', + [], + [ + 'Stripe-Account: acct_123', + ], + false, + [ + 'id' => 'ch_123', + 'object' => 'charge', + ] + ); + Charge::create(); + } + + public function testHeaderStripeAccountRequestOptions() + { + $this->stubRequest( + 'POST', + '/v1/charges', + [], + [ + 'Stripe-Account: acct_123', + ], + false, + [ + 'id' => 'ch_123', + 'object' => 'charge', + ] + ); + Charge::create([], ['stripe_account' => 'acct_123']); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/ApplePayDomainTest.php b/htdocs/includes/stripe/tests/Stripe/ApplePayDomainTest.php new file mode 100644 index 00000000000..d033f55cbb0 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/ApplePayDomainTest.php @@ -0,0 +1,52 @@ +expectsRequest( + 'get', + '/v1/apple_pay/domains' + ); + $resources = ApplePayDomain::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\ApplePayDomain", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/apple_pay/domains/' . self::TEST_RESOURCE_ID + ); + $resource = ApplePayDomain::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\ApplePayDomain", $resource); + } + + public function testIsCreatable() + { + $this->expectsRequest( + 'post', + '/v1/apple_pay/domains' + ); + $resource = ApplePayDomain::create([ + "domain_name" => "domain", + ]); + $this->assertInstanceOf("Stripe\\ApplePayDomain", $resource); + } + + public function testIsDeletable() + { + $resource = ApplePayDomain::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'delete', + '/v1/apple_pay/domains/' . $resource->id + ); + $resource->delete(); + $this->assertInstanceOf("Stripe\\ApplePayDomain", $resource); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/ApplicationFeeRefundTest.php b/htdocs/includes/stripe/tests/Stripe/ApplicationFeeRefundTest.php new file mode 100644 index 00000000000..9af059ff7f3 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/ApplicationFeeRefundTest.php @@ -0,0 +1,21 @@ +metadata["key"] = "value"; + $this->expectsRequest( + 'post', + '/v1/application_fees/' . $resource->fee . '/refunds/' . $resource->id + ); + $resource->save(); + $this->assertInstanceOf("Stripe\\ApplicationFeeRefund", $resource); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/ApplicationFeeTest.php b/htdocs/includes/stripe/tests/Stripe/ApplicationFeeTest.php new file mode 100644 index 00000000000..66e007ff3d2 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/ApplicationFeeTest.php @@ -0,0 +1,83 @@ +expectsRequest( + 'get', + '/v1/application_fees' + ); + $resources = ApplicationFee::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\ApplicationFee", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/application_fees/' . self::TEST_RESOURCE_ID + ); + $resource = ApplicationFee::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\ApplicationFee", $resource); + } + + public function testIsRefundable() + { + $fee = ApplicationFee::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'post', + '/v1/application_fees/' . $fee->id . '/refunds' + ); + $resource = $fee->refund(); + $this->assertInstanceOf("Stripe\\ApplicationFee", $resource); + $this->assertSame($resource, $fee); + } + + public function testCanCreateRefund() + { + $this->expectsRequest( + 'post', + '/v1/application_fees/' . self::TEST_RESOURCE_ID . '/refunds' + ); + $resource = ApplicationFee::createRefund(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\ApplicationFeeRefund", $resource); + } + + public function testCanRetrieveRefund() + { + $this->expectsRequest( + 'get', + '/v1/application_fees/' . self::TEST_RESOURCE_ID . '/refunds/' . self::TEST_FEEREFUND_ID + ); + $resource = ApplicationFee::retrieveRefund(self::TEST_RESOURCE_ID, self::TEST_FEEREFUND_ID); + $this->assertInstanceOf("Stripe\\ApplicationFeeRefund", $resource); + } + + public function testCanUpdateRefund() + { + $this->expectsRequest( + 'post', + '/v1/application_fees/' . self::TEST_RESOURCE_ID . '/refunds/' . self::TEST_FEEREFUND_ID + ); + $resource = ApplicationFee::updateRefund(self::TEST_RESOURCE_ID, self::TEST_FEEREFUND_ID); + $this->assertInstanceOf("Stripe\\ApplicationFeeRefund", $resource); + } + + public function testCanListRefunds() + { + $this->expectsRequest( + 'get', + '/v1/application_fees/' . self::TEST_RESOURCE_ID . '/refunds' + ); + $resources = ApplicationFee::allRefunds(self::TEST_RESOURCE_ID); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\ApplicationFeeRefund", $resources->data[0]); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/BalanceTest.php b/htdocs/includes/stripe/tests/Stripe/BalanceTest.php new file mode 100644 index 00000000000..ccbdbdfb747 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/BalanceTest.php @@ -0,0 +1,16 @@ +expectsRequest( + 'get', + '/v1/balance' + ); + $resource = Balance::retrieve(); + $this->assertInstanceOf("Stripe\\Balance", $resource); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/BalanceTransactionTest.php b/htdocs/includes/stripe/tests/Stripe/BalanceTransactionTest.php new file mode 100644 index 00000000000..8785e859113 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/BalanceTransactionTest.php @@ -0,0 +1,29 @@ +expectsRequest( + 'get', + '/v1/balance/history' + ); + $resources = BalanceTransaction::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\BalanceTransaction", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/balance/history/' . self::TEST_RESOURCE_ID + ); + $resource = BalanceTransaction::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\BalanceTransaction", $resource); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/BankAccountTest.php b/htdocs/includes/stripe/tests/Stripe/BankAccountTest.php new file mode 100644 index 00000000000..ab1dff9d5a8 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/BankAccountTest.php @@ -0,0 +1,99 @@ + self::TEST_RESOURCE_ID, + 'object' => 'bank_account', + 'metadata' => [], + ]; + return BankAccount::constructFrom( + array_merge($params, $base), + new Util\RequestOptions() + ); + } + + public function testHasCorrectUrlForCustomer() + { + $resource = $this->createFixture(['customer' => 'cus_123']); + $this->assertSame( + "/v1/customers/cus_123/sources/" . self::TEST_RESOURCE_ID, + $resource->instanceUrl() + ); + } + + public function testHasCorrectUrlForAccount() + { + $resource = $this->createFixture(['account' => 'acct_123']); + $this->assertSame( + "/v1/accounts/acct_123/external_accounts/" . self::TEST_RESOURCE_ID, + $resource->instanceUrl() + ); + } + + /** + * @expectedException \Stripe\Error\InvalidRequest + */ + public function testIsNotDirectlyRetrievable() + { + BankAccount::retrieve(self::TEST_RESOURCE_ID); + } + + public function testIsSaveable() + { + $resource = $this->createFixture(); + $resource->metadata["key"] = "value"; + $this->expectsRequest( + 'post', + '/v1/customers/cus_123/sources/' . self::TEST_RESOURCE_ID + ); + $resource->save(); + $this->assertSame("Stripe\\BankAccount", get_class($resource)); + } + + /** + * @expectedException \Stripe\Error\InvalidRequest + */ + public function testIsNotDirectlyUpdatable() + { + BankAccount::update(self::TEST_RESOURCE_ID, [ + "metadata" => ["key" => "value"], + ]); + } + + public function testIsDeletable() + { + $resource = $this->createFixture(); + $this->expectsRequest( + 'delete', + '/v1/customers/cus_123/sources/' . self::TEST_RESOURCE_ID + ); + $resource->delete(); + $this->assertSame("Stripe\\BankAccount", get_class($resource)); + } + + public function testIsVerifiable() + { + $resource = $this->createFixture(); + $this->expectsRequest( + 'post', + '/v1/customers/cus_123/sources/' . self::TEST_RESOURCE_ID . "/verify", + [ + "amounts" => [1, 2] + ] + ); + $resource->verify(["amounts" => [1, 2]]); + $this->assertInstanceOf("Stripe\\BankAccount", $resource); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/BitcoinReceiverTest.php b/htdocs/includes/stripe/tests/Stripe/BitcoinReceiverTest.php new file mode 100644 index 00000000000..cea999fc4f2 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/BitcoinReceiverTest.php @@ -0,0 +1,62 @@ + self::TEST_RESOURCE_ID, + 'object' => 'bitcoin_receiver', + 'metadata' => [], + ]; + return BitcoinReceiver::constructFrom( + array_merge($params, $base), + new Util\RequestOptions() + ); + } + + public function testHasCorrectStandaloneUrl() + { + $resource = $this->createFixture(); + $this->assertSame( + "/v1/bitcoin/receivers/" . self::TEST_RESOURCE_ID, + $resource->instanceUrl() + ); + } + + public function testHasCorrectUrlForCustomer() + { + $resource = $this->createFixture(['customer' => 'cus_123']); + $this->assertSame( + "/v1/customers/cus_123/sources/" . self::TEST_RESOURCE_ID, + $resource->instanceUrl() + ); + } + + public function testIsListable() + { + $this->expectsRequest( + 'get', + '/v1/bitcoin/receivers' + ); + $resources = BitcoinReceiver::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertSame("Stripe\\BitcoinReceiver", get_class($resources->data[0])); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/bitcoin/receivers/' . self::TEST_RESOURCE_ID + ); + $resource = BitcoinReceiver::retrieve(self::TEST_RESOURCE_ID); + $this->assertSame("Stripe\\BitcoinReceiver", get_class($resource)); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/CardTest.php b/htdocs/includes/stripe/tests/Stripe/CardTest.php new file mode 100644 index 00000000000..8976eff6679 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/CardTest.php @@ -0,0 +1,94 @@ + self::TEST_RESOURCE_ID, + 'object' => 'card', + 'metadata' => [], + ]; + return Card::constructFrom( + array_merge($params, $base), + new Util\RequestOptions() + ); + } + + public function testHasCorrectUrlForCustomer() + { + $resource = $this->createFixture(['customer' => 'cus_123']); + $this->assertSame( + "/v1/customers/cus_123/sources/" . self::TEST_RESOURCE_ID, + $resource->instanceUrl() + ); + } + + public function testHasCorrectUrlForAccount() + { + $resource = $this->createFixture(['account' => 'acct_123']); + $this->assertSame( + "/v1/accounts/acct_123/external_accounts/" . self::TEST_RESOURCE_ID, + $resource->instanceUrl() + ); + } + + public function testHasCorrectUrlForRecipient() + { + $resource = $this->createFixture(['recipient' => 'rp_123']); + $this->assertSame( + "/v1/recipients/rp_123/cards/" . self::TEST_RESOURCE_ID, + $resource->instanceUrl() + ); + } + + /** + * @expectedException \Stripe\Error\InvalidRequest + */ + public function testIsNotDirectlyRetrievable() + { + Card::retrieve(self::TEST_RESOURCE_ID); + } + + public function testIsSaveable() + { + $resource = $this->createFixture(); + $resource->metadata["key"] = "value"; + $this->expectsRequest( + 'post', + '/v1/customers/cus_123/sources/' . self::TEST_RESOURCE_ID + ); + $resource->save(); + $this->assertSame("Stripe\\Card", get_class($resource)); + } + + /** + * @expectedException \Stripe\Error\InvalidRequest + */ + public function testIsNotDirectlyUpdatable() + { + Card::update(self::TEST_RESOURCE_ID, [ + "metadata" => ["key" => "value"], + ]); + } + + public function testIsDeletable() + { + $resource = $this->createFixture(); + $this->expectsRequest( + 'delete', + '/v1/customers/cus_123/sources/' . self::TEST_RESOURCE_ID + ); + $resource->delete(); + $this->assertSame("Stripe\\Card", get_class($resource)); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/ChargeTest.php b/htdocs/includes/stripe/tests/Stripe/ChargeTest.php new file mode 100644 index 00000000000..b8c6cbabf3b --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/ChargeTest.php @@ -0,0 +1,140 @@ +expectsRequest( + 'get', + '/v1/charges' + ); + $resources = Charge::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\Charge", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/charges/' . self::TEST_RESOURCE_ID + ); + $resource = Charge::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\Charge", $resource); + } + + public function testIsCreatable() + { + $this->expectsRequest( + 'post', + '/v1/charges' + ); + $resource = Charge::create([ + "amount" => 100, + "currency" => "usd", + "source" => "tok_123" + ]); + $this->assertInstanceOf("Stripe\\Charge", $resource); + } + + public function testIsSaveable() + { + $resource = Charge::retrieve(self::TEST_RESOURCE_ID); + $resource->metadata["key"] = "value"; + $this->expectsRequest( + 'post', + '/v1/charges/' . $resource->id + ); + $resource->save(); + $this->assertInstanceOf("Stripe\\Charge", $resource); + } + + public function testIsUpdatable() + { + $this->expectsRequest( + 'post', + '/v1/charges/' . self::TEST_RESOURCE_ID + ); + $resource = Charge::update(self::TEST_RESOURCE_ID, [ + "metadata" => ["key" => "value"], + ]); + $this->assertInstanceOf("Stripe\\Charge", $resource); + } + + public function testCanRefund() + { + $charge = Charge::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'post', + '/v1/charges/' . $charge->id . '/refund' + ); + $resource = $charge->refund(); + $this->assertInstanceOf("Stripe\\Charge", $resource); + $this->assertSame($resource, $charge); + } + + public function testCanCapture() + { + $charge = Charge::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'post', + '/v1/charges/' . $charge->id . '/capture' + ); + $resource = $charge->capture(); + $this->assertInstanceOf("Stripe\\Charge", $resource); + $this->assertSame($resource, $charge); + } + + public function testCanUpdateDispute() + { + $charge = Charge::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'post', + '/v1/charges/' . $charge->id . '/dispute' + ); + $resource = $charge->updateDispute(); + $this->assertInstanceOf("Stripe\\Dispute", $resource); + } + + public function testCanCloseDispute() + { + $charge = Charge::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'post', + '/v1/charges/' . $charge->id . '/dispute/close' + ); + $resource = $charge->closeDispute(); + $this->assertInstanceOf("Stripe\\Charge", $resource); + $this->assertSame($resource, $charge); + } + + public function testCanMarkAsFraudulent() + { + $charge = Charge::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'post', + '/v1/charges/' . $charge->id, + ['fraud_details' => ['user_report' => 'fraudulent']] + ); + $resource = $charge->markAsFraudulent(); + $this->assertInstanceOf("Stripe\\Charge", $resource); + $this->assertSame($resource, $charge); + } + + public function testCanMarkAsSafe() + { + $charge = Charge::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'post', + '/v1/charges/' . $charge->id, + ['fraud_details' => ['user_report' => 'safe']] + ); + $resource = $charge->markAsSafe(); + $this->assertInstanceOf("Stripe\\Charge", $resource); + $this->assertSame($resource, $charge); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/CollectionTest.php b/htdocs/includes/stripe/tests/Stripe/CollectionTest.php new file mode 100644 index 00000000000..560085aede2 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/CollectionTest.php @@ -0,0 +1,147 @@ +fixture = Collection::constructFrom([ + 'data' => [['id' => 1]], + 'has_more' => true, + 'url' => '/things', + ]); + } + + public function testCanList() + { + $this->stubRequest( + 'GET', + '/things', + [], + null, + false, + [ + 'data' => [['id' => 1]], + 'has_more' => true, + 'url' => '/things', + ] + ); + + $resources = $this->fixture->all(); + $this->assertTrue(is_array($resources->data)); + } + + public function testCanRetrieve() + { + $this->stubRequest( + 'GET', + '/things/1', + [], + null, + false, + [ + 'id' => 1, + ] + ); + + $this->fixture->retrieve(1); + } + + public function testCanCreate() + { + $this->stubRequest( + 'POST', + '/things', + [ + 'foo' => 'bar', + ], + null, + false, + [ + 'id' => 2, + ] + ); + + $this->fixture->create([ + 'foo' => 'bar', + ]); + } + + public function testProvidesAutoPagingIterator() + { + $this->stubRequest( + 'GET', + '/things', + [ + 'starting_after' => 1, + ], + null, + false, + [ + 'data' => [['id' => 2], ['id' => 3]], + 'has_more' => false, + ] + ); + + $seen = []; + foreach ($this->fixture->autoPagingIterator() as $item) { + array_push($seen, $item['id']); + } + + $this->assertSame([1, 2, 3], $seen); + } + + public function testSupportsIteratorToArray() + { + $this->stubRequest( + 'GET', + '/things', + [ + 'starting_after' => 1, + ], + null, + false, + [ + 'data' => [['id' => 2], ['id' => 3]], + 'has_more' => false, + ] + ); + + $seen = []; + foreach (iterator_to_array($this->fixture->autoPagingIterator()) as $item) { + array_push($seen, $item['id']); + } + + $this->assertSame([1, 2, 3], $seen); + } + + public function testHeaders() + { + $this->stubRequest( + 'POST', + '/things', + [ + 'foo' => 'bar', + ], + [ + 'Stripe-Account: acct_foo', + 'Idempotency-Key: qwertyuiop', + ], + false, + [ + 'id' => 2, + ] + ); + + $this->fixture->create([ + 'foo' => 'bar', + ], [ + 'stripe_account' => 'acct_foo', + 'idempotency_key' => 'qwertyuiop', + ]); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/CountrySpecTest.php b/htdocs/includes/stripe/tests/Stripe/CountrySpecTest.php new file mode 100644 index 00000000000..cccd4116845 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/CountrySpecTest.php @@ -0,0 +1,29 @@ +expectsRequest( + 'get', + '/v1/country_specs' + ); + $resources = CountrySpec::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\CountrySpec", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/country_specs/' . self::TEST_RESOURCE_ID + ); + $resource = CountrySpec::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\CountrySpec", $resource); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/CouponTest.php b/htdocs/includes/stripe/tests/Stripe/CouponTest.php new file mode 100644 index 00000000000..8a6fbf630cd --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/CouponTest.php @@ -0,0 +1,79 @@ +expectsRequest( + 'get', + '/v1/coupons' + ); + $resources = Coupon::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\Coupon", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/coupons/' . self::TEST_RESOURCE_ID + ); + $resource = Coupon::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\Coupon", $resource); + } + + public function testIsCreatable() + { + $this->expectsRequest( + 'post', + '/v1/coupons' + ); + $resource = Coupon::create([ + "percent_off" => 25, + "duration" => "repeating", + "duration_in_months" => 3, + "id" => self::TEST_RESOURCE_ID, + ]); + $this->assertInstanceOf("Stripe\\Coupon", $resource); + } + + public function testIsSaveable() + { + $resource = Coupon::retrieve(self::TEST_RESOURCE_ID); + $resource->metadata["key"] = "value"; + $this->expectsRequest( + 'post', + '/v1/coupons/' . self::TEST_RESOURCE_ID + ); + $resource->save(); + $this->assertInstanceOf("Stripe\\Coupon", $resource); + } + + public function testIsUpdatable() + { + $this->expectsRequest( + 'post', + '/v1/coupons/' . self::TEST_RESOURCE_ID + ); + $resource = Coupon::update(self::TEST_RESOURCE_ID, [ + "metadata" => ["key" => "value"], + ]); + $this->assertInstanceOf("Stripe\\Coupon", $resource); + } + + public function testIsDeletable() + { + $resource = Coupon::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'delete', + '/v1/coupons/' . self::TEST_RESOURCE_ID + ); + $resource->delete(); + $this->assertInstanceOf("Stripe\\Coupon", $resource); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/CustomerTest.php b/htdocs/includes/stripe/tests/Stripe/CustomerTest.php new file mode 100644 index 00000000000..e279e5489e8 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/CustomerTest.php @@ -0,0 +1,269 @@ +expectsRequest( + 'get', + '/v1/customers' + ); + $resources = Customer::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\Customer", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/customers/' . self::TEST_RESOURCE_ID + ); + $resource = Customer::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\Customer", $resource); + } + + public function testIsCreatable() + { + $this->expectsRequest( + 'post', + '/v1/customers' + ); + $resource = Customer::create(); + $this->assertInstanceOf("Stripe\\Customer", $resource); + } + + public function testIsSaveable() + { + $resource = Customer::retrieve(self::TEST_RESOURCE_ID); + $resource->metadata["key"] = "value"; + $this->expectsRequest( + 'post', + '/v1/customers/' . $resource->id + ); + $resource->save(); + $this->assertInstanceOf("Stripe\\Customer", $resource); + } + + public function testIsUpdatable() + { + $this->expectsRequest( + 'post', + '/v1/customers/' . self::TEST_RESOURCE_ID + ); + $resource = Customer::update(self::TEST_RESOURCE_ID, [ + "metadata" => ["key" => "value"], + ]); + $this->assertInstanceOf("Stripe\\Customer", $resource); + } + + public function testIsDeletable() + { + $resource = Customer::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'delete', + '/v1/customers/' . $resource->id + ); + $resource->delete(); + $this->assertInstanceOf("Stripe\\Customer", $resource); + } + + public function testCanAddInvoiceItem() + { + $customer = Customer::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'post', + '/v1/invoiceitems', + [ + "amount" => 100, + "currency" => "usd", + "customer" => $customer->id + ] + ); + $resource = $customer->addInvoiceItem([ + "amount" => 100, + "currency" => "usd" + ]); + $this->assertInstanceOf("Stripe\\InvoiceItem", $resource); + } + + public function testCanListInvoices() + { + $customer = Customer::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'get', + '/v1/invoices', + ["customer" => $customer->id] + ); + $resources = $customer->invoices(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\Invoice", $resources->data[0]); + } + + public function testCanListInvoiceItems() + { + $customer = Customer::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'get', + '/v1/invoiceitems', + ["customer" => $customer->id] + ); + $resources = $customer->invoiceItems(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\InvoiceItem", $resources->data[0]); + } + + public function testCanListCharges() + { + $customer = Customer::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'get', + '/v1/charges', + ["customer" => $customer->id] + ); + $resources = $customer->charges(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\Charge", $resources->data[0]); + } + + public function testCanUpdateSubscription() + { + $customer = Customer::retrieve(self::TEST_RESOURCE_ID); + $this->stubRequest( + 'post', + '/v1/customers/' . $customer->id . '/subscription', + ["plan" => "plan"], + null, + false, + [ + "object" => "subscription", + "id" => "sub_foo" + ] + ); + $resource = $customer->updateSubscription(["plan" => "plan"]); + $this->assertInstanceOf("Stripe\\Subscription", $resource); + $this->assertSame("sub_foo", $customer->subscription->id); + } + + public function testCanCancelSubscription() + { + $customer = Customer::retrieve(self::TEST_RESOURCE_ID); + $this->stubRequest( + 'delete', + '/v1/customers/' . $customer->id . '/subscription', + [], + null, + false, + [ + "object" => "subscription", + "id" => "sub_foo" + ] + ); + $resource = $customer->cancelSubscription(); + $this->assertInstanceOf("Stripe\\Subscription", $resource); + $this->assertSame("sub_foo", $customer->subscription->id); + } + + public function testCanDeleteDiscount() + { + $customer = Customer::retrieve(self::TEST_RESOURCE_ID); + $this->stubRequest( + 'delete', + '/v1/customers/' . $customer->id . '/discount' + ); + $customer->deleteDiscount(); + $this->assertSame($customer->discount, null); + } + + public function testCanCreateSource() + { + $this->expectsRequest( + 'post', + '/v1/customers/' . self::TEST_RESOURCE_ID . '/sources' + ); + $resource = Customer::createSource(self::TEST_RESOURCE_ID, ["source" => "btok_123"]); + $this->assertInstanceOf("Stripe\\BankAccount", $resource); + } + + public function testCanRetrieveSource() + { + $this->expectsRequest( + 'get', + '/v1/customers/' . self::TEST_RESOURCE_ID . '/sources/' . self::TEST_SOURCE_ID + ); + $resource = Customer::retrieveSource(self::TEST_RESOURCE_ID, self::TEST_SOURCE_ID); + $this->assertInstanceOf("Stripe\\BankAccount", $resource); + } + + public function testCanUpdateSource() + { + $this->expectsRequest( + 'post', + '/v1/customers/' . self::TEST_RESOURCE_ID . '/sources/' . self::TEST_SOURCE_ID + ); + $resource = Customer::updateSource(self::TEST_RESOURCE_ID, self::TEST_SOURCE_ID, ["name" => "name"]); + // stripe-mock returns a Card on this method and not a bank account + $this->assertInstanceOf("Stripe\\Card", $resource); + } + + public function testCanDeleteSource() + { + $this->expectsRequest( + 'delete', + '/v1/customers/' . self::TEST_RESOURCE_ID . '/sources/' . self::TEST_SOURCE_ID + ); + $resource = Customer::deleteSource(self::TEST_RESOURCE_ID, self::TEST_SOURCE_ID); + $this->assertInstanceOf("Stripe\\BankAccount", $resource); + } + + public function testCanListSources() + { + $this->expectsRequest( + 'get', + '/v1/customers/' . self::TEST_RESOURCE_ID . '/sources' + ); + $resources = Customer::allSources(self::TEST_RESOURCE_ID); + $this->assertTrue(is_array($resources->data)); + } + + public function testSerializeSourceString() + { + $obj = Util\Util::convertToStripeObject([ + 'object' => 'customer', + ], null); + $obj->source = 'tok_visa'; + + $expected = [ + 'source' => 'tok_visa', + ]; + $this->assertSame($expected, $obj->serializeParameters()); + } + + public function testSerializeSourceMap() + { + $obj = Util\Util::convertToStripeObject([ + 'object' => 'customer', + ], null); + $obj->source = [ + 'object' => 'card', + 'number' => '4242424242424242', + 'exp_month' => 12, + 'exp_year' => 2032, + ]; + + $expected = [ + 'source' => [ + 'object' => 'card', + 'number' => '4242424242424242', + 'exp_month' => 12, + 'exp_year' => 2032, + ], + ]; + $this->assertSame($expected, $obj->serializeParameters()); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/DisputeTest.php b/htdocs/includes/stripe/tests/Stripe/DisputeTest.php new file mode 100644 index 00000000000..81d93da0213 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/DisputeTest.php @@ -0,0 +1,65 @@ +expectsRequest( + 'get', + '/v1/disputes' + ); + $resources = Dispute::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\Dispute", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/disputes/' . self::TEST_RESOURCE_ID + ); + $resource = Dispute::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\Dispute", $resource); + } + + public function testIsSaveable() + { + $resource = Dispute::retrieve(self::TEST_RESOURCE_ID); + $resource->metadata["key"] = "value"; + $this->expectsRequest( + 'post', + '/v1/disputes/' . $resource->id + ); + $resource->save(); + $this->assertInstanceOf("Stripe\\Dispute", $resource); + } + + public function testIsUpdatable() + { + $this->expectsRequest( + 'post', + '/v1/disputes/' . self::TEST_RESOURCE_ID + ); + $resource = Dispute::update(self::TEST_RESOURCE_ID, [ + "metadata" => ["key" => "value"], + ]); + $this->assertInstanceOf("Stripe\\Dispute", $resource); + } + + public function testIsClosable() + { + $dispute = Dispute::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'post', + '/v1/disputes/' . $dispute->id . '/close' + ); + $resource = $dispute->close(); + $this->assertInstanceOf("Stripe\\Dispute", $resource); + $this->assertSame($resource, $dispute); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/EphemeralKeyTest.php b/htdocs/includes/stripe/tests/Stripe/EphemeralKeyTest.php new file mode 100644 index 00000000000..e8a1fc0e9ef --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/EphemeralKeyTest.php @@ -0,0 +1,43 @@ +expectsRequest( + 'post', + '/v1/ephemeral_keys', + null, + ["Stripe-Version: 2017-05-25"] + ); + $resource = EphemeralKey::create([ + "customer" => "cus_123", + ], ["stripe_version" => "2017-05-25"]); + $this->assertInstanceOf("Stripe\\EphemeralKey", $resource); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testIsNotCreatableWithoutAnExplicitApiVersion() + { + $resource = EphemeralKey::create([ + "customer" => "cus_123", + ]); + } + + public function testIsDeletable() + { + $key = EphemeralKey::create([ + "customer" => "cus_123", + ], ["stripe_version" => "2017-05-25"]); + $this->expectsRequest( + 'delete', + '/v1/ephemeral_keys/' . $key->id + ); + $resource = $key->delete(); + $this->assertInstanceOf("Stripe\\EphemeralKey", $resource); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/Error/BaseTest.php b/htdocs/includes/stripe/tests/Stripe/Error/BaseTest.php new file mode 100644 index 00000000000..4c2732ed1d1 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/Error/BaseTest.php @@ -0,0 +1,36 @@ +getMockForAbstractClass('Stripe\\Error\\Base', [ + 'message', + 200, + '{"key": "value"}', + ['key' => 'value'], + [ + 'Some-Header' => 'Some Value', + 'Request-Id' => 'req_test', + ], + ]); + } + + public function testGetters() + { + $e = $this->createFixture(); + $this->assertSame(200, $e->getHttpStatus()); + $this->assertSame('{"key": "value"}', $e->getHttpBody()); + $this->assertSame(['key' => 'value'], $e->getJsonBody()); + $this->assertSame('Some Value', $e->getHttpHeaders()['Some-Header']); + $this->assertSame('req_test', $e->getRequestId()); + } + + public function testToString() + { + $e = $this->createFixture(); + $this->assertContains("from API request 'req_test'", (string)$e); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/Error/SignatureVerificationTest.php b/htdocs/includes/stripe/tests/Stripe/Error/SignatureVerificationTest.php new file mode 100644 index 00000000000..020a41f8f76 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/Error/SignatureVerificationTest.php @@ -0,0 +1,12 @@ +assertSame('sig_header', $e->getSigHeader()); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/EventTest.php b/htdocs/includes/stripe/tests/Stripe/EventTest.php new file mode 100644 index 00000000000..2e3c92f0e49 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/EventTest.php @@ -0,0 +1,29 @@ +expectsRequest( + 'get', + '/v1/events' + ); + $resources = Event::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\Event", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/events/' . self::TEST_RESOURCE_ID + ); + $resource = Event::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\Event", $resource); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/ExchangeRateTest.php b/htdocs/includes/stripe/tests/Stripe/ExchangeRateTest.php new file mode 100644 index 00000000000..8b07b5a1358 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/ExchangeRateTest.php @@ -0,0 +1,54 @@ +stubRequest( + 'get', + '/v1/exchange_rates', + [], + null, + false, + [ + 'object' => 'list', + 'data' => [ + [ + 'id' => 'eur', + 'object' => 'exchange_rate', + 'rates' => ['usd' => 1.18221], + ], + [ + 'id' => 'usd', + 'object' => 'exchange_rate', + 'rates' => ['eur' => 0.845876], + ], + ], + ] + ); + + $listRates = ExchangeRate::all(); + $this->assertTrue(is_array($listRates->data)); + $this->assertEquals('exchange_rate', $listRates->data[0]->object); + } + + public function testIsRetrievable() + { + $this->stubRequest( + 'get', + '/v1/exchange_rates/usd', + [], + null, + false, + [ + 'id' => 'usd', + 'object' => 'exchange_rate', + 'rates' => ['eur' => 0.845876], + ] + ); + $rates = ExchangeRate::retrieve("usd"); + $this->assertEquals('exchange_rate', $rates->object); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/FileUploadTest.php b/htdocs/includes/stripe/tests/Stripe/FileUploadTest.php new file mode 100644 index 00000000000..21bb0b568f6 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/FileUploadTest.php @@ -0,0 +1,104 @@ +fixture = [ + 'id' => self::TEST_RESOURCE_ID, + 'object' => 'file_upload', + ]; + } + + public function testIsListable() + { + $this->stubRequest( + 'get', + '/v1/files', + [], + null, + false, + [ + 'object' => 'list', + 'data' => [$this->fixture], + 'resource_url' => '/v1/files', + ], + 200, + Stripe::$apiUploadBase + ); + + $resources = FileUpload::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\FileUpload", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->stubRequest( + 'get', + '/v1/files/' . self::TEST_RESOURCE_ID, + [], + null, + false, + $this->fixture, + 200, + Stripe::$apiUploadBase + ); + $resource = FileUpload::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\FileUpload", $resource); + } + + public function testIsCreatableWithFileHandle() + { + $this->stubRequest( + 'post', + '/v1/files', + null, + ['Content-Type: multipart/form-data'], + true, + $this->fixture, + 200, + Stripe::$apiUploadBase + ); + $fp = fopen(dirname(__FILE__) . '/../data/test.png', 'r'); + $resource = FileUpload::create([ + "purpose" => "dispute_evidence", + "file" => $fp, + ]); + $this->assertInstanceOf("Stripe\\FileUpload", $resource); + } + + public function testIsCreatableWithCurlFile() + { + if (!class_exists('\CurlFile', false)) { + // Older PHP versions don't support this + return; + } + + $this->stubRequest( + 'post', + '/v1/files', + null, + ['Content-Type: multipart/form-data'], + true, + $this->fixture, + 200, + Stripe::$apiUploadBase + ); + $curlFile = new \CurlFile(dirname(__FILE__) . '/../data/test.png'); + $resource = FileUpload::create([ + "purpose" => "dispute_evidence", + "file" => $curlFile, + ]); + $this->assertInstanceOf("Stripe\\FileUpload", $resource); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/HttpClient/CurlClientTest.php b/htdocs/includes/stripe/tests/Stripe/HttpClient/CurlClientTest.php new file mode 100644 index 00000000000..086e6d3ee8d --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/HttpClient/CurlClientTest.php @@ -0,0 +1,228 @@ +origMaxNetworkRetries = Stripe::getMaxNetworkRetries(); + $this->origMaxNetworkRetryDelay = Stripe::getMaxNetworkRetryDelay(); + $this->origInitialNetworkRetryDelay = Stripe::getInitialNetworkRetryDelay(); + } + + /** + * @before + */ + public function setUpReflectors() + { + $stripeReflector = new \ReflectionClass('\Stripe\Stripe'); + + $this->maxNetworkRetryDelayProperty = $stripeReflector->getProperty('maxNetworkRetryDelay'); + $this->maxNetworkRetryDelayProperty->setAccessible(true); + + $this->initialNetworkRetryDelayProperty = $stripeReflector->getProperty('initialNetworkRetryDelay'); + $this->initialNetworkRetryDelayProperty->setAccessible(true); + + $curlClientReflector = new \ReflectionClass('Stripe\HttpClient\CurlClient'); + + $this->shouldRetryMethod = $curlClientReflector->getMethod('shouldRetry'); + $this->shouldRetryMethod->setAccessible(true); + + $this->sleepTimeMethod = $curlClientReflector->getMethod('sleepTime'); + $this->sleepTimeMethod->setAccessible(true); + } + + /** + * @after + */ + public function restoreOriginalNetworkValues() + { + Stripe::setMaxNetworkRetries($this->origMaxNetworkRetries); + $this->setMaxNetworkRetryDelay($this->origMaxNetworkRetryDelay); + $this->setInitialNetworkRetryDelay($this->origInitialNetworkRetryDelay); + } + + private function setMaxNetworkRetryDelay($maxNetworkRetryDelay) + { + $this->maxNetworkRetryDelayProperty->setValue(null, $maxNetworkRetryDelay); + } + + private function setInitialNetworkRetryDelay($initialNetworkRetryDelay) + { + $this->initialNetworkRetryDelayProperty->setValue(null, $initialNetworkRetryDelay); + } + + private function createFakeRandomGenerator($returnValue = 1.0) + { + $fakeRandomGenerator = $this->getMock('Stripe\Util\RandomGenetator', ['randFloat']); + $fakeRandomGenerator->method('randFloat')->willReturn($returnValue); + return $fakeRandomGenerator; + } + + public function testTimeout() + { + $curl = new CurlClient(); + $this->assertSame(CurlClient::DEFAULT_TIMEOUT, $curl->getTimeout()); + $this->assertSame(CurlClient::DEFAULT_CONNECT_TIMEOUT, $curl->getConnectTimeout()); + + // implicitly tests whether we're returning the CurlClient instance + $curl = $curl->setConnectTimeout(1)->setTimeout(10); + $this->assertSame(1, $curl->getConnectTimeout()); + $this->assertSame(10, $curl->getTimeout()); + + $curl->setTimeout(-1); + $curl->setConnectTimeout(-999); + $this->assertSame(0, $curl->getTimeout()); + $this->assertSame(0, $curl->getConnectTimeout()); + } + + public function testUserAgentInfo() + { + $curl = new CurlClient(); + $uaInfo = $curl->getUserAgentInfo(); + $this->assertNotNull($uaInfo); + $this->assertNotNull($uaInfo['httplib']); + $this->assertNotNull($uaInfo['ssllib']); + } + + public function testDefaultOptions() + { + // make sure options array loads/saves properly + $optionsArray = [CURLOPT_PROXY => 'localhost:80']; + $withOptionsArray = new CurlClient($optionsArray); + $this->assertSame($withOptionsArray->getDefaultOptions(), $optionsArray); + + // make sure closure-based options work properly, including argument passing + $ref = null; + $withClosure = new CurlClient(function ($method, $absUrl, $headers, $params, $hasFile) use (&$ref) { + $ref = func_get_args(); + return []; + }); + + $withClosure->request('get', 'https://httpbin.org/status/200', [], [], false); + $this->assertSame($ref, ['get', 'https://httpbin.org/status/200', [], [], false]); + + // this is the last test case that will run, since it'll throw an exception at the end + $withBadClosure = new CurlClient(function () { + return 'thisShouldNotWork'; + }); + $this->setExpectedException('Stripe\Error\Api', "Non-array value returned by defaultOptions CurlClient callback"); + $withBadClosure->request('get', 'https://httpbin.org/status/200', [], [], false); + } + + public function testSslOption() + { + // make sure options array loads/saves properly + $optionsArray = [CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1]; + $withOptionsArray = new CurlClient($optionsArray); + $this->assertSame($withOptionsArray->getDefaultOptions(), $optionsArray); + } + + public function testShouldRetryOnTimeout() + { + Stripe::setMaxNetworkRetries(2); + + $curlClient = new CurlClient(); + + $this->assertTrue($this->shouldRetryMethod->invoke($curlClient, CURLE_OPERATION_TIMEOUTED, 0, 0)); + } + + public function testShouldRetryOnConnectionFailure() + { + Stripe::setMaxNetworkRetries(2); + + $curlClient = new CurlClient(); + + $this->assertTrue($this->shouldRetryMethod->invoke($curlClient, CURLE_COULDNT_CONNECT, 0, 0)); + } + + public function testShouldRetryOnConflict() + { + Stripe::setMaxNetworkRetries(2); + + $curlClient = new CurlClient(); + + $this->assertTrue($this->shouldRetryMethod->invoke($curlClient, 0, 409, 0)); + } + + public function testShouldNotRetryAtMaximumCount() + { + Stripe::setMaxNetworkRetries(2); + + $curlClient = new CurlClient(); + + $this->assertFalse($this->shouldRetryMethod->invoke($curlClient, 0, 0, Stripe::getMaxNetworkRetries())); + } + + public function testShouldNotRetryOnCertValidationError() + { + Stripe::setMaxNetworkRetries(2); + + $curlClient = new CurlClient(); + + $this->assertFalse($this->shouldRetryMethod->invoke($curlClient, CURLE_SSL_PEER_CERTIFICATE, -1, 0)); + } + + public function testSleepTimeShouldGrowExponentially() + { + $this->setMaxNetworkRetryDelay(999); + + $curlClient = new CurlClient(null, $this->createFakeRandomGenerator()); + + $this->assertEquals( + Stripe::getInitialNetworkRetryDelay() * 1, + $this->sleepTimeMethod->invoke($curlClient, 1) + ); + $this->assertEquals( + Stripe::getInitialNetworkRetryDelay() * 2, + $this->sleepTimeMethod->invoke($curlClient, 2) + ); + $this->assertEquals( + Stripe::getInitialNetworkRetryDelay() * 4, + $this->sleepTimeMethod->invoke($curlClient, 3) + ); + $this->assertEquals( + Stripe::getInitialNetworkRetryDelay() * 8, + $this->sleepTimeMethod->invoke($curlClient, 4) + ); + } + + public function testSleepTimeShouldEnforceMaxNetworkRetryDelay() + { + $this->setInitialNetworkRetryDelay(1); + $this->setMaxNetworkRetryDelay(2); + + $curlClient = new CurlClient(null, $this->createFakeRandomGenerator()); + + $this->assertEquals(1, $this->sleepTimeMethod->invoke($curlClient, 1)); + $this->assertEquals(2, $this->sleepTimeMethod->invoke($curlClient, 2)); + $this->assertEquals(2, $this->sleepTimeMethod->invoke($curlClient, 3)); + $this->assertEquals(2, $this->sleepTimeMethod->invoke($curlClient, 4)); + } + + public function testSleepTimeShouldAddSomeRandomness() + { + $randomValue = 0.8; + $this->setInitialNetworkRetryDelay(1); + $this->setMaxNetworkRetryDelay(8); + + $curlClient = new CurlClient(null, $this->createFakeRandomGenerator($randomValue)); + + $baseValue = Stripe::getInitialNetworkRetryDelay() * (0.5 * (1 + $randomValue)); + + // the initial value cannot be smaller than the base, + // so the randomness is ignored + $this->assertEquals(Stripe::getInitialNetworkRetryDelay(), $this->sleepTimeMethod->invoke($curlClient, 1)); + + // after the first one, the randomness is applied + $this->assertEquals($baseValue * 2, $this->sleepTimeMethod->invoke($curlClient, 2)); + $this->assertEquals($baseValue * 4, $this->sleepTimeMethod->invoke($curlClient, 3)); + $this->assertEquals($baseValue * 8, $this->sleepTimeMethod->invoke($curlClient, 4)); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/InvoiceItemTest.php b/htdocs/includes/stripe/tests/Stripe/InvoiceItemTest.php new file mode 100644 index 00000000000..ffe140aa7ca --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/InvoiceItemTest.php @@ -0,0 +1,78 @@ +expectsRequest( + 'get', + '/v1/invoiceitems' + ); + $resources = InvoiceItem::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\InvoiceItem", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/invoiceitems/' . self::TEST_RESOURCE_ID + ); + $resource = InvoiceItem::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\InvoiceItem", $resource); + } + + public function testIsCreatable() + { + $this->expectsRequest( + 'post', + '/v1/invoiceitems' + ); + $resource = InvoiceItem::create([ + "amount" => 100, + "currency" => "usd", + "customer" => "cus_123" + ]); + $this->assertInstanceOf("Stripe\\InvoiceItem", $resource); + } + + public function testIsSaveable() + { + $resource = InvoiceItem::retrieve(self::TEST_RESOURCE_ID); + $resource->metadata["key"] = "value"; + $this->expectsRequest( + 'post', + '/v1/invoiceitems/' . $resource->id + ); + $resource->save(); + $this->assertInstanceOf("Stripe\\InvoiceItem", $resource); + } + + public function testIsUpdatable() + { + $this->expectsRequest( + 'post', + '/v1/invoiceitems/' . self::TEST_RESOURCE_ID + ); + $resource = InvoiceItem::update(self::TEST_RESOURCE_ID, [ + "metadata" => ["key" => "value"], + ]); + $this->assertInstanceOf("Stripe\\InvoiceItem", $resource); + } + + public function testIsDeletable() + { + $invoiceItem = InvoiceItem::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'delete', + '/v1/invoiceitems/' . $invoiceItem->id + ); + $resource = $invoiceItem->delete(); + $this->assertInstanceOf("Stripe\\InvoiceItem", $resource); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/InvoiceTest.php b/htdocs/includes/stripe/tests/Stripe/InvoiceTest.php new file mode 100644 index 00000000000..f1ae9378628 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/InvoiceTest.php @@ -0,0 +1,87 @@ +expectsRequest( + 'get', + '/v1/invoices' + ); + $resources = Invoice::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\Invoice", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/invoices/' . self::TEST_RESOURCE_ID + ); + $resource = Invoice::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\Invoice", $resource); + } + + public function testIsCreatable() + { + $this->expectsRequest( + 'post', + '/v1/invoices' + ); + $resource = Invoice::create([ + "customer" => "cus_123" + ]); + $this->assertInstanceOf("Stripe\\Invoice", $resource); + } + + public function testIsSaveable() + { + $resource = Invoice::retrieve(self::TEST_RESOURCE_ID); + $resource->metadata["key"] = "value"; + $this->expectsRequest( + 'post', + '/v1/invoices/' . $resource->id + ); + $resource->save(); + $this->assertInstanceOf("Stripe\\Invoice", $resource); + } + + public function testIsUpdatable() + { + $this->expectsRequest( + 'post', + '/v1/invoices/' . self::TEST_RESOURCE_ID + ); + $resource = Invoice::update(self::TEST_RESOURCE_ID, [ + "metadata" => ["key" => "value"], + ]); + $this->assertInstanceOf("Stripe\\Invoice", $resource); + } + + public function testCanRetrieveUpcoming() + { + $this->expectsRequest( + 'get', + '/v1/invoices/upcoming' + ); + $resource = Invoice::upcoming(["customer" => "cus_123"]); + $this->assertInstanceOf("Stripe\\Invoice", $resource); + } + + public function testIsPayable() + { + $invoice = Invoice::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'post', + '/v1/invoices/' . $invoice->id . '/pay' + ); + $resource = $invoice->pay(); + $this->assertInstanceOf("Stripe\\Invoice", $resource); + $this->assertSame($resource, $invoice); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/OAuthTest.php b/htdocs/includes/stripe/tests/Stripe/OAuthTest.php new file mode 100644 index 00000000000..b4e43a88103 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/OAuthTest.php @@ -0,0 +1,97 @@ + 'read_write', + 'state' => 'csrf_token', + 'stripe_user' => [ + 'email' => 'test@example.com', + 'url' => 'https://example.com/profile/test', + 'country' => 'US', + ], + ]); + + $uri = parse_url($uriStr); + parse_str($uri['query'], $params); + + $this->assertSame('https', $uri['scheme']); + $this->assertSame('connect.stripe.com', $uri['host']); + $this->assertSame('/oauth/authorize', $uri['path']); + + $this->assertSame('ca_123', $params['client_id']); + $this->assertSame('read_write', $params['scope']); + $this->assertSame('test@example.com', $params['stripe_user']['email']); + $this->assertSame('https://example.com/profile/test', $params['stripe_user']['url']); + $this->assertSame('US', $params['stripe_user']['country']); + } + + /** + * @expectedException \Stripe\Error\Authentication + * @expectedExceptionMessageRegExp #No client_id provided# + */ + public function testRaisesAuthenticationErrorWhenNoClientId() + { + Stripe::setClientId(null); + OAuth::authorizeUrl(); + } + + public function testToken() + { + $this->stubRequest( + 'POST', + '/oauth/token', + [ + 'grant_type' => 'authorization_code', + 'code' => 'this_is_an_authorization_code', + ], + null, + false, + [ + 'access_token' => 'sk_access_token', + 'scope' => 'read_only', + 'livemode' => false, + 'token_type' => 'bearer', + 'refresh_token' => 'sk_refresh_token', + 'stripe_user_id' => 'acct_test', + 'stripe_publishable_key' => 'pk_test', + ], + 200, + Stripe::$connectBase + ); + + $resp = OAuth::token([ + 'grant_type' => 'authorization_code', + 'code' => 'this_is_an_authorization_code', + ]); + $this->assertSame('sk_access_token', $resp->access_token); + } + + public function testDeauthorize() + { + $this->stubRequest( + 'POST', + '/oauth/deauthorize', + [ + 'stripe_user_id' => 'acct_test_deauth', + 'client_id' => 'ca_123', + ], + null, + false, + [ + 'stripe_user_id' => 'acct_test_deauth', + ], + 200, + Stripe::$connectBase + ); + + $resp = OAuth::deauthorize([ + 'stripe_user_id' => 'acct_test_deauth', + ]); + $this->assertSame('acct_test_deauth', $resp->stripe_user_id); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/OrderReturnTest.php b/htdocs/includes/stripe/tests/Stripe/OrderReturnTest.php new file mode 100644 index 00000000000..bb2d65c437a --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/OrderReturnTest.php @@ -0,0 +1,29 @@ +expectsRequest( + 'get', + '/v1/order_returns' + ); + $resources = OrderReturn::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\OrderReturn", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/order_returns/' . self::TEST_RESOURCE_ID + ); + $resource = OrderReturn::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\OrderReturn", $resource); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/OrderTest.php b/htdocs/includes/stripe/tests/Stripe/OrderTest.php new file mode 100644 index 00000000000..51d17e94fc7 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/OrderTest.php @@ -0,0 +1,87 @@ +expectsRequest( + 'get', + '/v1/orders' + ); + $resources = Order::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\Order", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/orders/' . self::TEST_RESOURCE_ID + ); + $resource = Order::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\Order", $resource); + } + + public function testIsCreatable() + { + $this->expectsRequest( + 'post', + '/v1/orders' + ); + $resource = Order::create([ + 'currency' => 'usd' + ]); + $this->assertInstanceOf("Stripe\\Order", $resource); + } + + public function testIsSaveable() + { + $resource = Order::retrieve(self::TEST_RESOURCE_ID); + $resource->metadata["key"] = "value"; + $this->expectsRequest( + 'post', + '/v1/orders/' . $resource->id + ); + $resource->save(); + $this->assertInstanceOf("Stripe\\Order", $resource); + } + + public function testIsUpdatable() + { + $this->expectsRequest( + 'post', + '/v1/orders/' . self::TEST_RESOURCE_ID + ); + $resource = Order::update(self::TEST_RESOURCE_ID, [ + "metadata" => ["key" => "value"], + ]); + $this->assertInstanceOf("Stripe\\Order", $resource); + } + + public function testIsPayable() + { + $resource = Order::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'post', + '/v1/orders/' . $resource->id . '/pay' + ); + $resource->pay(); + $this->assertInstanceOf("Stripe\\Order", $resource); + } + + public function testIsReturnable() + { + $order = Order::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'post', + '/v1/orders/' . $order->id . '/returns' + ); + $resource = $order->returnOrder(); + $this->assertInstanceOf("Stripe\\OrderReturn", $resource); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/PayoutTest.php b/htdocs/includes/stripe/tests/Stripe/PayoutTest.php new file mode 100644 index 00000000000..79c7b5fd015 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/PayoutTest.php @@ -0,0 +1,77 @@ +expectsRequest( + 'get', + '/v1/payouts' + ); + $resources = Payout::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\Payout", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/payouts/' . self::TEST_RESOURCE_ID + ); + $resource = Payout::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\Payout", $resource); + } + + public function testIsCreatable() + { + $this->expectsRequest( + 'post', + '/v1/payouts' + ); + $resource = Payout::create([ + "amount" => 100, + "currency" => "usd" + ]); + $this->assertInstanceOf("Stripe\\Payout", $resource); + } + + public function testIsSaveable() + { + $resource = Payout::retrieve(self::TEST_RESOURCE_ID); + $resource->metadata["key"] = "value"; + $this->expectsRequest( + 'post', + '/v1/payouts/' . $resource->id + ); + $resource->save(); + $this->assertInstanceOf("Stripe\\Payout", $resource); + } + + public function testIsUpdatable() + { + $this->expectsRequest( + 'post', + '/v1/payouts/' . self::TEST_RESOURCE_ID + ); + $resource = Payout::update(self::TEST_RESOURCE_ID, [ + "metadata" => ["key" => "value"], + ]); + $this->assertInstanceOf("Stripe\\Payout", $resource); + } + + public function testIsCancelable() + { + $resource = Payout::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'post', + '/v1/payouts/' . $resource->id . '/cancel' + ); + $resource->cancel(); + $this->assertInstanceOf("Stripe\\Payout", $resource); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/PlanTest.php b/htdocs/includes/stripe/tests/Stripe/PlanTest.php new file mode 100644 index 00000000000..8d71745ed56 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/PlanTest.php @@ -0,0 +1,80 @@ +expectsRequest( + 'get', + '/v1/plans' + ); + $resources = Plan::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\Plan", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/plans/' . self::TEST_RESOURCE_ID + ); + $resource = Plan::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\Plan", $resource); + } + + public function testIsCreatable() + { + $this->expectsRequest( + 'post', + '/v1/plans' + ); + $resource = Plan::create([ + 'amount' => 100, + 'interval' => 'month', + 'currency' => 'usd', + 'name' => self::TEST_RESOURCE_ID, + 'id' => self::TEST_RESOURCE_ID + ]); + $this->assertInstanceOf("Stripe\\Plan", $resource); + } + + public function testIsSaveable() + { + $resource = Plan::retrieve(self::TEST_RESOURCE_ID); + $resource->metadata["key"] = "value"; + $this->expectsRequest( + 'post', + '/v1/plans/' . $resource->id + ); + $resource->save(); + $this->assertInstanceOf("Stripe\\Plan", $resource); + } + + public function testIsUpdatable() + { + $this->expectsRequest( + 'post', + '/v1/plans/' . self::TEST_RESOURCE_ID + ); + $resource = Plan::update(self::TEST_RESOURCE_ID, [ + "metadata" => ["key" => "value"], + ]); + $this->assertInstanceOf("Stripe\\Plan", $resource); + } + + public function testIsDeletable() + { + $resource = Plan::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'delete', + '/v1/plans/' . $resource->id + ); + $resource->delete(); + $this->assertInstanceOf("Stripe\\Plan", $resource); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/ProductTest.php b/htdocs/includes/stripe/tests/Stripe/ProductTest.php new file mode 100644 index 00000000000..c2a3813c870 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/ProductTest.php @@ -0,0 +1,77 @@ +expectsRequest( + 'get', + '/v1/products' + ); + $resources = Product::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\Product", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/products/' . self::TEST_RESOURCE_ID + ); + $resource = Product::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\Product", $resource); + } + + public function testIsCreatable() + { + $this->expectsRequest( + 'post', + '/v1/products' + ); + $resource = Product::create([ + 'name' => 'name', + 'type' => 'good' + ]); + $this->assertInstanceOf("Stripe\\Product", $resource); + } + + public function testIsSaveable() + { + $resource = Product::retrieve(self::TEST_RESOURCE_ID); + $resource->metadata["key"] = "value"; + $this->expectsRequest( + 'post', + '/v1/products/' . $resource->id + ); + $resource->save(); + $this->assertInstanceOf("Stripe\\Product", $resource); + } + + public function testIsUpdatable() + { + $this->expectsRequest( + 'post', + '/v1/products/' . self::TEST_RESOURCE_ID + ); + $resource = Product::update(self::TEST_RESOURCE_ID, [ + "metadata" => ["key" => "value"], + ]); + $this->assertInstanceOf("Stripe\\Product", $resource); + } + + public function testIsDeletable() + { + $resource = Product::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'delete', + '/v1/products/' . $resource->id + ); + $resource->delete(); + $this->assertInstanceOf("Stripe\\Product", $resource); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/RecipientTest.php b/htdocs/includes/stripe/tests/Stripe/RecipientTest.php new file mode 100644 index 00000000000..43dd6e82a79 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/RecipientTest.php @@ -0,0 +1,90 @@ +expectsRequest( + 'get', + '/v1/recipients' + ); + $resources = Recipient::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\Recipient", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/recipients/' . self::TEST_RESOURCE_ID + ); + $resource = Recipient::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\Recipient", $resource); + } + + public function testIsCreatable() + { + $this->expectsRequest( + 'post', + '/v1/recipients' + ); + $resource = Recipient::create([ + "name" => "name", + "type" => "individual" + ]); + $this->assertInstanceOf("Stripe\\Recipient", $resource); + } + + public function testIsSaveable() + { + $resource = Recipient::retrieve(self::TEST_RESOURCE_ID); + $resource->metadata["key"] = "value"; + $this->expectsRequest( + 'post', + '/v1/recipients/' . $resource->id + ); + $resource->save(); + $this->assertInstanceOf("Stripe\\Recipient", $resource); + } + + public function testIsUpdatable() + { + $this->expectsRequest( + 'post', + '/v1/recipients/' . self::TEST_RESOURCE_ID + ); + $resource = Recipient::update(self::TEST_RESOURCE_ID, [ + "metadata" => ["key" => "value"], + ]); + $this->assertInstanceOf("Stripe\\Recipient", $resource); + } + + public function testIsDeletable() + { + $resource = Recipient::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'delete', + '/v1/recipients/' . $resource->id + ); + $resource->delete(); + $this->assertInstanceOf("Stripe\\Recipient", $resource); + } + + public function testCanListTransfers() + { + $recipient = Recipient::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'get', + '/v1/transfers', + ["recipient" => $recipient->id] + ); + $resources = $recipient->transfers(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\Transfer", $resources->data[0]); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/RefundTest.php b/htdocs/includes/stripe/tests/Stripe/RefundTest.php new file mode 100644 index 00000000000..788361d4d9d --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/RefundTest.php @@ -0,0 +1,65 @@ +expectsRequest( + 'get', + '/v1/refunds' + ); + $resources = Refund::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\Refund", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/refunds/' . self::TEST_RESOURCE_ID + ); + $resource = Refund::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\Refund", $resource); + } + + public function testIsCreatable() + { + $this->expectsRequest( + 'post', + '/v1/refunds' + ); + $resource = Refund::create([ + "charge" => "ch_123" + ]); + $this->assertInstanceOf("Stripe\\Refund", $resource); + } + + public function testIsSaveable() + { + $resource = Refund::retrieve(self::TEST_RESOURCE_ID); + $resource->metadata["key"] = "value"; + $this->expectsRequest( + 'post', + '/v1/refunds/' . $resource->id + ); + $resource->save(); + $this->assertInstanceOf("Stripe\\Refund", $resource); + } + + public function testIsUpdatable() + { + $this->expectsRequest( + 'post', + '/v1/refunds/' . self::TEST_RESOURCE_ID + ); + $resource = Refund::update(self::TEST_RESOURCE_ID, [ + "metadata" => ["key" => "value"], + ]); + $this->assertInstanceOf("Stripe\\Refund", $resource); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/SKUTest.php b/htdocs/includes/stripe/tests/Stripe/SKUTest.php new file mode 100644 index 00000000000..d4fc2ad408b --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/SKUTest.php @@ -0,0 +1,82 @@ +expectsRequest( + 'get', + '/v1/skus' + ); + $resources = SKU::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\SKU", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/skus/' . self::TEST_RESOURCE_ID + ); + $resource = SKU::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\SKU", $resource); + } + + public function testIsCreatable() + { + $this->expectsRequest( + 'post', + '/v1/skus' + ); + $resource = SKU::create([ + 'currency' => 'usd', + 'inventory' => [ + 'type' => 'finite', + 'quantity' => 1 + ], + 'price' => 100, + 'product' => "prod_123" + ]); + $this->assertInstanceOf("Stripe\\SKU", $resource); + } + + public function testIsSaveable() + { + $resource = SKU::retrieve(self::TEST_RESOURCE_ID); + $resource->metadata["key"] = "value"; + $this->expectsRequest( + 'post', + '/v1/skus/' . $resource->id + ); + $resource->save(); + $this->assertInstanceOf("Stripe\\SKU", $resource); + } + + public function testIsUpdatable() + { + $this->expectsRequest( + 'post', + '/v1/skus/' . self::TEST_RESOURCE_ID + ); + $resource = SKU::update(self::TEST_RESOURCE_ID, [ + "metadata" => ["key" => "value"], + ]); + $this->assertInstanceOf("Stripe\\SKU", $resource); + } + + public function testIsDeletable() + { + $resource = SKU::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'delete', + '/v1/skus/' . $resource->id + ); + $resource->delete(); + $this->assertInstanceOf("Stripe\\SKU", $resource); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/SourceTest.php b/htdocs/includes/stripe/tests/Stripe/SourceTest.php new file mode 100644 index 00000000000..ad11b0d3455 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/SourceTest.php @@ -0,0 +1,134 @@ +expectsRequest( + 'get', + '/v1/sources/' . self::TEST_RESOURCE_ID + ); + $resource = Source::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\Source", $resource); + } + + public function testIsCreatable() + { + $this->expectsRequest( + 'post', + '/v1/sources' + ); + $resource = Source::create([ + "type" => "card" + ]); + $this->assertInstanceOf("Stripe\\Source", $resource); + } + + public function testIsSaveable() + { + $resource = Source::retrieve(self::TEST_RESOURCE_ID); + $resource->metadata["key"] = "value"; + $this->expectsRequest( + 'post', + '/v1/sources/' . $resource->id + ); + $resource->save(); + $this->assertInstanceOf("Stripe\\Source", $resource); + } + + public function testIsUpdatable() + { + $this->expectsRequest( + 'post', + '/v1/sources/' . self::TEST_RESOURCE_ID + ); + $resource = Source::update(self::TEST_RESOURCE_ID, [ + "metadata" => ["key" => "value"], + ]); + $this->assertInstanceOf("Stripe\\Source", $resource); + } + + public function testCanSaveCardExpiryDate() + { + $response = [ + 'id' => 'src_foo', + 'object' => 'source', + 'card' => [ + 'exp_month' => 8, + 'exp_year' => 2019, + ], + ]; + $source = Source::constructFrom($response); + + $response['card']['exp_month'] = 12; + $response['card']['exp_year'] = 2022; + $this->stubRequest( + 'POST', + '/v1/sources/src_foo', + [ + 'card' => [ + 'exp_month' => 12, + 'exp_year' => 2022, + ] + ], + null, + false, + $response + ); + + $source->card->exp_month = 12; + $source->card->exp_year = 2022; + $source->save(); + + $this->assertSame(12, $source->card->exp_month); + $this->assertSame(2022, $source->card->exp_year); + } + + public function testIsDetachableWhenAttached() + { + $resource = Source::retrieve(self::TEST_RESOURCE_ID); + $resource->customer = "cus_123"; + $this->expectsRequest( + 'delete', + '/v1/customers/cus_123/sources/' . $resource->id + ); + $resource->delete(); + $this->assertInstanceOf("Stripe\\Source", $resource); + } + + /** + * @expectedException \Stripe\Error\Api + */ + public function testIsNotDetachableWhenUnattached() + { + $resource = Source::retrieve(self::TEST_RESOURCE_ID); + $resource->detach(); + } + + public function testCanListSourceTransactions() + { + $source = Source::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'get', + '/v1/sources/' . $source->id . "/source_transactions" + ); + $resources = $source->sourceTransactions(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\SourceTransaction", $resources->data[0]); + } + + public function testCanVerify() + { + $resource = Source::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'post', + '/v1/sources/' . $resource->id . "/verify" + ); + $resource->verify(["values" => [32, 45]]); + $this->assertInstanceOf("Stripe\\Source", $resource); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/StripeObjectTest.php b/htdocs/includes/stripe/tests/Stripe/StripeObjectTest.php new file mode 100644 index 00000000000..af1cd936e1c --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/StripeObjectTest.php @@ -0,0 +1,453 @@ +deepCopyReflector = new \ReflectionMethod('Stripe\\StripeObject', 'deepCopy'); + $this->deepCopyReflector->setAccessible(true); + + // This is used to access the `_opts` protected variable + $this->optsReflector = new \ReflectionProperty('Stripe\\StripeObject', '_opts'); + $this->optsReflector->setAccessible(true); + } + + public function testArrayAccessorsSemantics() + { + $s = new StripeObject(); + $s['foo'] = 'a'; + $this->assertSame($s['foo'], 'a'); + $this->assertTrue(isset($s['foo'])); + unset($s['foo']); + $this->assertFalse(isset($s['foo'])); + } + + public function testNormalAccessorsSemantics() + { + $s = new StripeObject(); + $s->foo = 'a'; + $this->assertSame($s->foo, 'a'); + $this->assertTrue(isset($s->foo)); + unset($s->foo); + $this->assertFalse(isset($s->foo)); + } + + public function testArrayAccessorsMatchNormalAccessors() + { + $s = new StripeObject(); + $s->foo = 'a'; + $this->assertSame($s['foo'], 'a'); + + $s['bar'] = 'b'; + $this->assertSame($s->bar, 'b'); + } + + public function testCount() + { + $s = new StripeObject(); + $this->assertSame(0, count($s)); + + $s['key1'] = 'value1'; + $this->assertSame(1, count($s)); + + $s['key2'] = 'value2'; + $this->assertSame(2, count($s)); + + unset($s['key1']); + $this->assertSame(1, count($s)); + } + + public function testKeys() + { + $s = new StripeObject(); + $s->foo = 'bar'; + $this->assertSame($s->keys(), ['foo']); + } + + public function testValues() + { + $s = new StripeObject(); + $s->foo = 'bar'; + $this->assertSame($s->values(), ['bar']); + } + + public function testToArray() + { + $s = new StripeObject(); + $s->foo = 'a'; + + $converted = $s->__toArray(); + + $this->assertInternalType('array', $converted); + $this->assertArrayHasKey('foo', $converted); + $this->assertEquals('a', $converted['foo']); + } + + public function testRecursiveToArray() + { + $s = new StripeObject(); + $z = new StripeObject(); + + $s->child = $z; + $z->foo = 'a'; + + $converted = $s->__toArray(true); + + $this->assertInternalType('array', $converted); + $this->assertArrayHasKey('child', $converted); + $this->assertInternalType('array', $converted['child']); + $this->assertArrayHasKey('foo', $converted['child']); + $this->assertEquals('a', $converted['child']['foo']); + } + + public function testNonexistentProperty() + { + $s = new StripeObject(); + $this->assertNull($s->nonexistent); + } + + public function testPropertyDoesNotExists() + { + $s = new StripeObject(); + $this->assertNull($s['nonexistent']); + } + + public function testJsonEncode() + { + $s = new StripeObject(); + $s->foo = 'a'; + + $this->assertEquals('{"foo":"a"}', json_encode($s)); + } + + public function testToString() + { + $s = new StripeObject(); + $s->foo = 'a'; + + $string = $s->__toString(); + $expected = <<assertEquals($expected, $string); + } + + public function testReplaceNewNestedUpdatable() + { + $s = new StripeObject(); + + $s->metadata = ['bar']; + $this->assertSame($s->metadata, ['bar']); + $s->metadata = ['baz', 'qux']; + $this->assertSame($s->metadata, ['baz', 'qux']); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testSetPermanentAttribute() + { + $s = new StripeObject(); + $s->id = 'abc_123'; + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testSetEmptyStringValue() + { + $s = new StripeObject(); + $s->foo = ''; + } + + public function testSerializeParametersOnEmptyObject() + { + $obj = StripeObject::constructFrom([]); + $this->assertSame([], $obj->serializeParameters()); + } + + public function testSerializeParametersOnNewObjectWithSubObject() + { + $obj = new StripeObject(); + $obj->metadata = ['foo' => 'bar']; + $this->assertSame(['metadata' => ['foo' => 'bar']], $obj->serializeParameters()); + } + + public function testSerializeParametersOnBasicObject() + { + $obj = StripeObject::constructFrom(['foo' => null]); + $obj->updateAttributes(['foo' => 'bar']); + $this->assertSame(['foo' => 'bar'], $obj->serializeParameters()); + } + + public function testSerializeParametersOnMoreComplexObject() + { + $obj = StripeObject::constructFrom([ + 'foo' => StripeObject::constructFrom([ + 'bar' => null, + 'baz' => null, + ]), + ]); + $obj->foo->bar = 'newbar'; + $this->assertSame(['foo' => ['bar' => 'newbar']], $obj->serializeParameters()); + } + + public function testSerializeParametersOnArray() + { + $obj = StripeObject::constructFrom([ + 'foo' => null, + ]); + $obj->foo = ['new-value']; + $this->assertSame(['foo' => ['new-value']], $obj->serializeParameters()); + } + + public function testSerializeParametersOnArrayThatShortens() + { + $obj = StripeObject::constructFrom([ + 'foo' => ['0-index', '1-index', '2-index'], + ]); + $obj->foo = ['new-value']; + $this->assertSame(['foo' => ['new-value']], $obj->serializeParameters()); + } + + public function testSerializeParametersOnArrayThatLengthens() + { + $obj = StripeObject::constructFrom([ + 'foo' => ['0-index', '1-index', '2-index'], + ]); + $obj->foo = array_fill(0, 4, 'new-value'); + $this->assertSame(['foo' => array_fill(0, 4, 'new-value')], $obj->serializeParameters()); + } + + public function testSerializeParametersOnArrayOfHashes() + { + $obj = StripeObject::constructFrom(['foo' => null]); + $obj->foo = [ + StripeObject::constructFrom(['bar' => null]), + ]; + + $obj->foo[0]->bar = 'baz'; + $this->assertSame(['foo' => [['bar' => 'baz']]], $obj->serializeParameters()); + } + + public function testSerializeParametersDoesNotIncludeUnchangedValues() + { + $obj = StripeObject::constructFrom([ + 'foo' => null, + ]); + $this->assertSame([], $obj->serializeParameters()); + } + + public function testSerializeParametersOnUnchangedArray() + { + $obj = StripeObject::constructFrom([ + 'foo' => ['0-index', '1-index', '2-index'], + ]); + $obj->foo = ['0-index', '1-index', '2-index']; + $this->assertSame([], $obj->serializeParameters()); + } + + public function testSerializeParametersWithStripeObject() + { + $obj = StripeObject::constructFrom([]); + $obj->metadata = StripeObject::constructFrom(['foo' => 'bar']); + + $serialized = $obj->serializeParameters(); + $this->assertSame(['foo' => 'bar'], $serialized['metadata']); + } + + public function testSerializeParametersOnReplacedStripeObject() + { + $obj = StripeObject::constructFrom([ + 'metadata' => StripeObject::constructFrom(['bar' => 'foo']), + ]); + $obj->metadata = StripeObject::constructFrom(['baz' => 'foo']); + + $serialized = $obj->serializeParameters(); + $this->assertSame(['bar' => '', 'baz' => 'foo'], $serialized['metadata']); + } + + public function testSerializeParametersOnArrayOfStripeObjects() + { + $obj = StripeObject::constructFrom([]); + $obj->metadata = [ + StripeObject::constructFrom(['foo' => 'bar']), + ]; + + $serialized = $obj->serializeParameters(); + $this->assertSame([['foo' => 'bar']], $serialized['metadata']); + } + + public function testSerializeParametersOnSetApiResource() + { + $customer = Customer::constructFrom(['id' => 'cus_123']); + $obj = StripeObject::constructFrom([]); + + // the key here is that the property is set explicitly (and therefore + // marked as unsaved), which is why it gets included below + $obj->customer = $customer; + + $serialized = $obj->serializeParameters(); + $this->assertSame(['customer' => $customer], $serialized); + } + + public function testSerializeParametersOnNotSetApiResource() + { + $customer = Customer::constructFrom(['id' => 'cus_123']); + $obj = StripeObject::constructFrom(['customer' => $customer]); + + $serialized = $obj->serializeParameters(); + $this->assertSame([], $serialized); + } + + public function testSerializeParametersOnApiResourceFlaggedWithSaveWithParent() + { + $customer = Customer::constructFrom(['id' => 'cus_123']); + $customer->saveWithParent = true; + + $obj = StripeObject::constructFrom(['customer' => $customer]); + + $serialized = $obj->serializeParameters(); + $this->assertSame(['customer' => []], $serialized); + } + + public function testSerializeParametersRaisesExceotionOnOtherEmbeddedApiResources() + { + // This customer doesn't have an ID and therefore the library doesn't know + // what to do with it and throws an InvalidArgumentException because it's + // probably not what the user expected to happen. + $customer = Customer::constructFrom([]); + + $obj = StripeObject::constructFrom([]); + $obj->customer = $customer; + + try { + $serialized = $obj->serializeParameters(); + $this->fail("Did not raise error"); + } catch (\InvalidArgumentException $e) { + $this->assertSame( + "Cannot save property `customer` containing an API resource of type Stripe\Customer. " . + "It doesn't appear to be persisted and is not marked as `saveWithParent`.", + $e->getMessage() + ); + } catch (\Exception $e) { + $this->fail("Unexpected exception: " . get_class($e)); + } + } + + public function testSerializeParametersForce() + { + $obj = StripeObject::constructFrom([ + 'id' => 'id', + 'metadata' => StripeObject::constructFrom([ + 'bar' => 'foo', + ]), + ]); + + $serialized = $obj->serializeParameters(true); + $this->assertSame(['id' => 'id', 'metadata' => ['bar' => 'foo']], $serialized); + } + + public function testDirty() + { + $obj = StripeObject::constructFrom([ + 'id' => 'id', + 'metadata' => StripeObject::constructFrom([ + 'bar' => 'foo', + ]), + ]); + + // note that `$force` and `dirty()` are for different things, but are + // functionally equivalent + $obj->dirty(); + + $serialized = $obj->serializeParameters(); + $this->assertSame(['id' => 'id', 'metadata' => ['bar' => 'foo']], $serialized); + } + + public function testDeepCopy() + { + $opts = [ + "api_base" => Stripe::$apiBase, + "api_key" => "apikey", + ]; + $values = [ + "id" => 1, + "name" => "Stripe", + "arr" => [ + StripeObject::constructFrom(["id" => "index0"], $opts), + "index1", + 2, + ], + "map" => [ + "0" => StripeObject::constructFrom(["id" => "index0"], $opts), + "1" => "index1", + "2" => 2 + ], + ]; + + $copyValues = $this->deepCopyReflector->invoke(null, $values); + + // we can't compare the hashes directly because they have embedded + // objects which are different from each other + $this->assertEquals($values["id"], $copyValues["id"]); + $this->assertEquals($values["name"], $copyValues["name"]); + $this->assertEquals(count($values["arr"]), count($copyValues["arr"])); + + // internal values of the copied StripeObject should be the same, + // but the object itself should be new (hence the assertNotSame) + $this->assertEquals($values["arr"][0]["id"], $copyValues["arr"][0]["id"]); + $this->assertNotSame($values["arr"][0], $copyValues["arr"][0]); + + // likewise, the Util\RequestOptions instance in _opts should have + // copied values but be a new instance + $this->assertEquals( + $this->optsReflector->getValue($values["arr"][0]), + $this->optsReflector->getValue($copyValues["arr"][0]) + ); + $this->assertNotSame( + $this->optsReflector->getValue($values["arr"][0]), + $this->optsReflector->getValue($copyValues["arr"][0]) + ); + + // scalars however, can be compared + $this->assertEquals($values["arr"][1], $copyValues["arr"][1]); + $this->assertEquals($values["arr"][2], $copyValues["arr"][2]); + + // and a similar story with the hash + $this->assertEquals($values["map"]["0"]["id"], $copyValues["map"]["0"]["id"]); + $this->assertNotSame($values["map"]["0"], $copyValues["map"]["0"]); + $this->assertNotSame( + $this->optsReflector->getValue($values["arr"][0]), + $this->optsReflector->getValue($copyValues["arr"][0]) + ); + $this->assertEquals( + $this->optsReflector->getValue($values["map"]["0"]), + $this->optsReflector->getValue($copyValues["map"]["0"]) + ); + $this->assertNotSame( + $this->optsReflector->getValue($values["map"]["0"]), + $this->optsReflector->getValue($copyValues["map"]["0"]) + ); + $this->assertEquals($values["map"]["1"], $copyValues["map"]["1"]); + $this->assertEquals($values["map"]["2"], $copyValues["map"]["2"]); + } + + public function testDeepCopyMaintainClass() + { + $charge = Charge::constructFrom(["id" => 1], null); + $copyCharge = $this->deepCopyReflector->invoke(null, $charge); + $this->assertEquals(get_class($charge), get_class($copyCharge)); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/StripeTest.php b/htdocs/includes/stripe/tests/Stripe/StripeTest.php new file mode 100644 index 00000000000..f594518d13d --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/StripeTest.php @@ -0,0 +1,30 @@ +orig = [ + 'caBundlePath' => Stripe::$caBundlePath, + ]; + } + + /** + * @after + */ + public function restoreOriginalValues() + { + Stripe::$caBundlePath = $this->orig['caBundlePath']; + } + + public function testCABundlePathAccessors() + { + Stripe::setCABundlePath('path/to/ca/bundle'); + $this->assertEquals('path/to/ca/bundle', Stripe::getCABundlePath()); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/SubscriptionItemTest.php b/htdocs/includes/stripe/tests/Stripe/SubscriptionItemTest.php new file mode 100644 index 00000000000..09e766c1bec --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/SubscriptionItemTest.php @@ -0,0 +1,77 @@ +expectsRequest( + 'get', + '/v1/subscription_items' + ); + $resources = SubscriptionItem::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\SubscriptionItem", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/subscription_items/' . self::TEST_RESOURCE_ID + ); + $resource = SubscriptionItem::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\SubscriptionItem", $resource); + } + + public function testIsCreatable() + { + $this->expectsRequest( + 'post', + '/v1/subscription_items' + ); + $resource = SubscriptionItem::create([ + "plan" => "plan", + "subscription" => "sub_123" + ]); + $this->assertInstanceOf("Stripe\\SubscriptionItem", $resource); + } + + public function testIsSaveable() + { + $resource = SubscriptionItem::retrieve(self::TEST_RESOURCE_ID); + $resource->metadata["key"] = "value"; + $this->expectsRequest( + 'post', + '/v1/subscription_items/' . $resource->id + ); + $resource->save(); + $this->assertInstanceOf("Stripe\\SubscriptionItem", $resource); + } + + public function testIsUpdatable() + { + $this->expectsRequest( + 'post', + '/v1/subscription_items/' . self::TEST_RESOURCE_ID + ); + $resource = SubscriptionItem::update(self::TEST_RESOURCE_ID, [ + "metadata" => ["key" => "value"], + ]); + $this->assertInstanceOf("Stripe\\SubscriptionItem", $resource); + } + + public function testIsDeletable() + { + $resource = SubscriptionItem::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'delete', + '/v1/subscription_items/' . $resource->id + ); + $resource->delete(); + $this->assertInstanceOf("Stripe\\SubscriptionItem", $resource); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/SubscriptionTest.php b/htdocs/includes/stripe/tests/Stripe/SubscriptionTest.php new file mode 100644 index 00000000000..4a42e218224 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/SubscriptionTest.php @@ -0,0 +1,115 @@ +expectsRequest( + 'get', + '/v1/subscriptions' + ); + $resources = Subscription::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\Subscription", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/subscriptions/' . self::TEST_RESOURCE_ID + ); + $resource = Subscription::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\Subscription", $resource); + } + + public function testIsCreatable() + { + $this->expectsRequest( + 'post', + '/v1/subscriptions' + ); + $resource = Subscription::create([ + "customer" => "cus_123", + "plan" => "plan" + ]); + $this->assertInstanceOf("Stripe\\Subscription", $resource); + } + + public function testIsSaveable() + { + $resource = Subscription::retrieve(self::TEST_RESOURCE_ID); + $resource->metadata["key"] = "value"; + $this->expectsRequest( + 'post', + '/v1/subscriptions/' . $resource->id + ); + $resource->save(); + $this->assertInstanceOf("Stripe\\Subscription", $resource); + } + + public function testIsUpdatable() + { + $this->expectsRequest( + 'post', + '/v1/subscriptions/' . self::TEST_RESOURCE_ID + ); + $resource = Subscription::update(self::TEST_RESOURCE_ID, [ + "metadata" => ["key" => "value"], + ]); + $this->assertInstanceOf("Stripe\\Subscription", $resource); + } + + public function testIsCancelable() + { + $resource = Subscription::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'delete', + '/v1/subscriptions/' . $resource->id, + [ + 'at_period_end' => 'true', + ] + ); + $resource->cancel([ + 'at_period_end' => true, + ]); + $this->assertInstanceOf("Stripe\\Subscription", $resource); + } + + public function testCanDeleteDiscount() + { + $resource = Subscription::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'delete', + '/v1/subscriptions/' . $resource->id . '/discount' + ); + $resource->deleteDiscount(); + $this->assertInstanceOf("Stripe\\Subscription", $resource); + } + + public function testSerializeParametersItems() + { + $obj = Util\Util::convertToStripeObject([ + 'object' => 'subscription', + 'items' => Util\Util::convertToStripeObject([ + 'object' => 'list', + 'data' => [], + ], null), + ], null); + $obj->items = [ + ['id' => 'si_foo', 'deleted' => true], + ['plan' => 'plan_bar'], + ]; + $expected = [ + 'items' => [ + 0 => ['id' => 'si_foo', 'deleted' => true], + 1 => ['plan' => 'plan_bar'], + ], + ]; + $this->assertSame($expected, $obj->serializeParameters()); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/ThreeDSecureTest.php b/htdocs/includes/stripe/tests/Stripe/ThreeDSecureTest.php new file mode 100644 index 00000000000..f56e649cbc1 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/ThreeDSecureTest.php @@ -0,0 +1,32 @@ +expectsRequest( + 'get', + '/v1/3d_secure/' . self::TEST_RESOURCE_ID + ); + $resource = ThreeDSecure::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\ThreeDSecure", $resource); + } + + public function testIsCreatable() + { + $this->expectsRequest( + 'post', + '/v1/3d_secure' + ); + $resource = ThreeDSecure::create([ + "amount" => 100, + "currency" => "usd", + "return_url" => "url" + ]); + $this->assertInstanceOf("Stripe\\ThreeDSecure", $resource); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/TokenTest.php b/htdocs/includes/stripe/tests/Stripe/TokenTest.php new file mode 100644 index 00000000000..36bb4bc8283 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/TokenTest.php @@ -0,0 +1,28 @@ +expectsRequest( + 'get', + '/v1/tokens/' . self::TEST_RESOURCE_ID + ); + $resource = Token::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\Token", $resource); + } + + public function testIsCreatable() + { + $this->expectsRequest( + 'post', + '/v1/tokens' + ); + $resource = Token::create(["card" => "tok_visa"]); + $this->assertInstanceOf("Stripe\\Token", $resource); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/TopupTest.php b/htdocs/includes/stripe/tests/Stripe/TopupTest.php new file mode 100644 index 00000000000..994447636c6 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/TopupTest.php @@ -0,0 +1,69 @@ +expectsRequest( + 'get', + '/v1/topups' + ); + $resources = Topup::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\Topup", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/topups/' . self::TEST_RESOURCE_ID + ); + $resource = Topup::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\Topup", $resource); + } + + public function testIsCreatable() + { + $this->expectsRequest( + 'post', + '/v1/topups' + ); + $resource = Topup::create([ + "amount" => 100, + "currency" => "usd", + "source" => "tok_123", + "description" => "description", + "statement_descriptor" => "statement descriptor" + ]); + $this->assertInstanceOf("Stripe\\Topup", $resource); + } + + public function testIsSaveable() + { + $resource = Topup::retrieve(self::TEST_RESOURCE_ID); + $resource->metadata["key"] = "value"; + $this->expectsRequest( + 'post', + '/v1/topups/' . $resource->id + ); + $resource->save(); + $this->assertInstanceOf("Stripe\\Topup", $resource); + } + + public function testIsUpdatable() + { + $this->expectsRequest( + 'post', + '/v1/topups/' . self::TEST_RESOURCE_ID + ); + $resource = Topup::update(self::TEST_RESOURCE_ID, [ + "metadata" => ["key" => "value"], + ]); + $this->assertInstanceOf("Stripe\\Topup", $resource); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/TransferReversalTest.php b/htdocs/includes/stripe/tests/Stripe/TransferReversalTest.php new file mode 100644 index 00000000000..37101c73208 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/TransferReversalTest.php @@ -0,0 +1,21 @@ +metadata["key"] = "value"; + $this->expectsRequest( + 'post', + '/v1/transfers/' . $resource->transfer . '/reversals/' . $resource->id + ); + $resource->save(); + $this->assertInstanceOf("Stripe\\TransferReversal", $resource); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/TransferTest.php b/htdocs/includes/stripe/tests/Stripe/TransferTest.php new file mode 100644 index 00000000000..d60d560e7c5 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/TransferTest.php @@ -0,0 +1,140 @@ +expectsRequest( + 'get', + '/v1/transfers' + ); + $resources = Transfer::all(); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\Transfer", $resources->data[0]); + } + + public function testIsRetrievable() + { + $this->expectsRequest( + 'get', + '/v1/transfers/' . self::TEST_RESOURCE_ID + ); + $resource = Transfer::retrieve(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\Transfer", $resource); + } + + public function testIsCreatable() + { + $this->expectsRequest( + 'post', + '/v1/transfers' + ); + $resource = Transfer::create([ + "amount" => 100, + "currency" => "usd", + "destination" => "acct_123" + ]); + $this->assertInstanceOf("Stripe\\Transfer", $resource); + } + + public function testIsSaveable() + { + $resource = Transfer::retrieve(self::TEST_RESOURCE_ID); + $resource->metadata["key"] = "value"; + $this->expectsRequest( + 'post', + '/v1/transfers/' . $resource->id + ); + $resource->save(); + $this->assertInstanceOf("Stripe\\Transfer", $resource); + } + + public function testIsUpdatable() + { + $this->expectsRequest( + 'post', + '/v1/transfers/' . self::TEST_RESOURCE_ID + ); + $resource = Transfer::update(self::TEST_RESOURCE_ID, [ + "metadata" => ["key" => "value"], + ]); + $this->assertInstanceOf("Stripe\\Transfer", $resource); + } + + public function testIsReversable() + { + $resource = Transfer::retrieve(self::TEST_RESOURCE_ID); + $this->expectsRequest( + 'post', + '/v1/transfers/' . $resource->id . '/reversals' + ); + $resource->reverse(); + $this->assertInstanceOf("Stripe\\Transfer", $resource); + } + + public function testIsCancelable() + { + $transfer = Transfer::retrieve(self::TEST_RESOURCE_ID); + + // stripe-mock does not support this anymore so we stub it + $this->stubRequest( + 'post', + '/v1/transfers/' . $transfer->id . '/cancel' + ); + $resource = $transfer->cancel(); + $this->assertInstanceOf("Stripe\\Transfer", $resource); + $this->assertSame($resource, $transfer); + } + + public function testCanCreateReversal() + { + $this->expectsRequest( + 'post', + '/v1/transfers/' . self::TEST_RESOURCE_ID . '/reversals' + ); + $resource = Transfer::createReversal(self::TEST_RESOURCE_ID); + $this->assertInstanceOf("Stripe\\TransferReversal", $resource); + } + + public function testCanRetrieveReversal() + { + $this->expectsRequest( + 'get', + '/v1/transfers/' . self::TEST_RESOURCE_ID . '/reversals/' . self::TEST_REVERSAL_ID + ); + $resource = Transfer::retrieveReversal(self::TEST_RESOURCE_ID, self::TEST_REVERSAL_ID); + $this->assertInstanceOf("Stripe\\TransferReversal", $resource); + } + + public function testCanUpdateReversal() + { + $this->expectsRequest( + 'post', + '/v1/transfers/' . self::TEST_RESOURCE_ID . '/reversals/' . self::TEST_REVERSAL_ID + ); + $resource = Transfer::updateReversal( + self::TEST_RESOURCE_ID, + self::TEST_REVERSAL_ID, + [ + "metadata" => ["key" => "value"], + ] + ); + $this->assertInstanceOf("Stripe\\TransferReversal", $resource); + } + + public function testCanListReversal() + { + $this->expectsRequest( + 'get', + '/v1/transfers/' . self::TEST_RESOURCE_ID . '/reversals' + ); + $resources = Transfer::allReversals(self::TEST_RESOURCE_ID); + $this->assertTrue(is_array($resources->data)); + $this->assertInstanceOf("Stripe\\TransferReversal", $resources->data[0]); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/Util/DefaultLoggerTest.php b/htdocs/includes/stripe/tests/Stripe/Util/DefaultLoggerTest.php new file mode 100644 index 00000000000..711af03c4a0 --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/Util/DefaultLoggerTest.php @@ -0,0 +1,28 @@ +error("message"); + + global $lastMessage; + $this->assertSame($lastMessage, "message"); + } +} + +// This is a little terrible, but unfortunately there's no clean way to stub a +// call to `error_log`. Here we overwrite it so that we can get the last arguments +// that went to it. This is obviously bad, but luckily it's constrained to +// being just in \Stripe\Util (i.e. won't interfere with PHPUnit for example) +// and _just_ present when tests are running. +function error_log($message) +{ + global $lastMessage; + $lastMessage = $message; +} diff --git a/htdocs/includes/stripe/tests/Stripe/Util/RequestOptionsTest.php b/htdocs/includes/stripe/tests/Stripe/Util/RequestOptionsTest.php new file mode 100644 index 00000000000..558f73982ea --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/Util/RequestOptionsTest.php @@ -0,0 +1,81 @@ +assertSame("foo", $opts->apiKey); + $this->assertSame([], $opts->headers); + } + + public function testNull() + { + $opts = Util\RequestOptions::parse(null); + $this->assertSame(null, $opts->apiKey); + $this->assertSame([], $opts->headers); + } + + public function testEmptyArray() + { + $opts = Util\RequestOptions::parse([]); + $this->assertSame(null, $opts->apiKey); + $this->assertSame([], $opts->headers); + } + + public function testAPIKeyArray() + { + $opts = Util\RequestOptions::parse( + [ + 'api_key' => 'foo', + ] + ); + $this->assertSame('foo', $opts->apiKey); + $this->assertSame([], $opts->headers); + } + + public function testIdempotentKeyArray() + { + $opts = Util\RequestOptions::parse( + [ + 'idempotency_key' => 'foo', + ] + ); + $this->assertSame(null, $opts->apiKey); + $this->assertSame(['Idempotency-Key' => 'foo'], $opts->headers); + } + + public function testKeyArray() + { + $opts = Util\RequestOptions::parse( + [ + 'idempotency_key' => 'foo', + 'api_key' => 'foo' + ] + ); + $this->assertSame('foo', $opts->apiKey); + $this->assertSame(['Idempotency-Key' => 'foo'], $opts->headers); + } + + /** + * @expectedException Stripe\Error\Api + */ + public function testWrongType() + { + $opts = Util\RequestOptions::parse(5); + } + + public function testDiscardNonPersistentHeaders() + { + $opts = Util\RequestOptions::parse( + [ + 'stripe_account' => 'foo', + 'idempotency_key' => 'foo', + ] + ); + $opts->discardNonPersistentHeaders(); + $this->assertSame(['Stripe-Account' => 'foo'], $opts->headers); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/Util/UtilTest.php b/htdocs/includes/stripe/tests/Stripe/Util/UtilTest.php new file mode 100644 index 00000000000..cf5130208db --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/Util/UtilTest.php @@ -0,0 +1,90 @@ +assertTrue(Util\Util::isList($list)); + + $notlist = [5, 'nstaoush', [], 'bar' => 'baz']; + $this->assertFalse(Util\Util::isList($notlist)); + } + + public function testThatPHPHasValueSemanticsForArrays() + { + $original = ['php-arrays' => 'value-semantics']; + $derived = $original; + $derived['php-arrays'] = 'reference-semantics'; + + $this->assertSame('value-semantics', $original['php-arrays']); + } + + public function testConvertStripeObjectToArrayIncludesId() + { + $customer = Util\Util::convertToStripeObject([ + 'id' => 'cus_123', + 'object' => 'customer', + ], null); + $this->assertTrue(array_key_exists("id", $customer->__toArray(true))); + } + + public function testUtf8() + { + // UTF-8 string + $x = "\xc3\xa9"; + $this->assertSame(Util\Util::utf8($x), $x); + + // Latin-1 string + $x = "\xe9"; + $this->assertSame(Util\Util::utf8($x), "\xc3\xa9"); + + // Not a string + $x = true; + $this->assertSame(Util\Util::utf8($x), $x); + } + + public function testUrlEncode() + { + $a = [ + 'my' => 'value', + 'that' => ['your' => 'example'], + 'bar' => 1, + 'baz' => null + ]; + + $enc = Util\Util::urlEncode($a); + $this->assertSame('my=value&that%5Byour%5D=example&bar=1', $enc); + + $a = ['that' => ['your' => 'example', 'foo' => null]]; + $enc = Util\Util::urlEncode($a); + $this->assertSame('that%5Byour%5D=example', $enc); + + $a = ['that' => 'example', 'foo' => ['bar', 'baz']]; + $enc = Util\Util::urlEncode($a); + $this->assertSame('that=example&foo%5B%5D=bar&foo%5B%5D=baz', $enc); + + $a = [ + 'my' => 'value', + 'that' => ['your' => ['cheese', 'whiz', null]], + 'bar' => 1, + 'baz' => null + ]; + + $enc = Util\Util::urlEncode($a); + $expected = 'my=value&that%5Byour%5D%5B%5D=cheese' + . '&that%5Byour%5D%5B%5D=whiz&bar=1'; + $this->assertSame($expected, $enc); + + // Ignores an empty array + $enc = Util\Util::urlEncode(['foo' => [], 'bar' => 'baz']); + $expected = 'bar=baz'; + $this->assertSame($expected, $enc); + + $a = ['foo' => [['bar' => 'baz'], ['bar' => 'bin']]]; + $enc = Util\Util::urlEncode($a); + $this->assertSame('foo%5B0%5D%5Bbar%5D=baz&foo%5B1%5D%5Bbar%5D=bin', $enc); + } +} diff --git a/htdocs/includes/stripe/tests/Stripe/WebhookTest.php b/htdocs/includes/stripe/tests/Stripe/WebhookTest.php new file mode 100644 index 00000000000..dcd82671afc --- /dev/null +++ b/htdocs/includes/stripe/tests/Stripe/WebhookTest.php @@ -0,0 +1,110 @@ +generateHeader(); + $event = Webhook::constructEvent(self::EVENT_PAYLOAD, $sigHeader, self::SECRET); + $this->assertEquals("evt_test_webhook", $event->id); + } + + /** + * @expectedException \UnexpectedValueException + */ + public function testInvalidJson() + { + $payload = "this is not valid JSON"; + $sigHeader = $this->generateHeader(["payload" => $payload]); + Webhook::constructEvent($payload, $sigHeader, self::SECRET); + } + + /** + * @expectedException \Stripe\Error\SignatureVerification + */ + public function testValidJsonAndInvalidHeader() + { + $sigHeader = "bad_header"; + Webhook::constructEvent(self::EVENT_PAYLOAD, $sigHeader, self::SECRET); + } + + /** + * @expectedException \Stripe\Error\SignatureVerification + * @expectedExceptionMessage Unable to extract timestamp and signatures from header + */ + public function testMalformedHeader() + { + $sigHeader = "i'm not even a real signature header"; + WebhookSignature::verifyHeader(self::EVENT_PAYLOAD, $sigHeader, self::SECRET); + } + + /** + * @expectedException \Stripe\Error\SignatureVerification + * @expectedExceptionMessage No signatures found with expected scheme + */ + public function testNoSignaturesWithExpectedScheme() + { + $sigHeader = $this->generateHeader(["scheme" => "v0"]); + WebhookSignature::verifyHeader(self::EVENT_PAYLOAD, $sigHeader, self::SECRET); + } + + /** + * @expectedException \Stripe\Error\SignatureVerification + * @expectedExceptionMessage No signatures found matching the expected signature for payload + */ + public function testNoValidSignatureForPayload() + { + $sigHeader = $this->generateHeader(["signature" => "bad_signature"]); + WebhookSignature::verifyHeader(self::EVENT_PAYLOAD, $sigHeader, self::SECRET); + } + + /** + * @expectedException \Stripe\Error\SignatureVerification + * @expectedExceptionMessage Timestamp outside the tolerance zone + */ + public function testTimestampOutsideTolerance() + { + $sigHeader = $this->generateHeader(["timestamp" => time() - 15]); + WebhookSignature::verifyHeader(self::EVENT_PAYLOAD, $sigHeader, self::SECRET, 10); + } + + public function testValidHeaderAndSignature() + { + $sigHeader = $this->generateHeader(); + $this->assertTrue(WebhookSignature::verifyHeader(self::EVENT_PAYLOAD, $sigHeader, self::SECRET, 10)); + } + + public function testHeaderContainsValidSignature() + { + $sigHeader = $this->generateHeader() . ",v1=bad_signature"; + $this->assertTrue(WebhookSignature::verifyHeader(self::EVENT_PAYLOAD, $sigHeader, self::SECRET, 10)); + } + + public function testTimestampOffButNoTolerance() + { + $sigHeader = $this->generateHeader(["timestamp" => 12345]); + $this->assertTrue(WebhookSignature::verifyHeader(self::EVENT_PAYLOAD, $sigHeader, self::SECRET)); + } +} diff --git a/htdocs/includes/stripe/tests/data/test.png b/htdocs/includes/stripe/tests/data/test.png new file mode 100644 index 0000000000000000000000000000000000000000..1914264c08781d1f30ee0b8482bccf44586f2dc1 GIT binary patch literal 95 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)ga%mF?ju0VQumF+E%TuG2$FoVOh l8)-lem#2$k2*>s01R$Gz9%CSj!PC{xWt~$(697H@6ZHT9 literal 0 HcmV?d00001 From 8c128a29854d48f3736c2d9f9cf32c3c8a929c3f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Mar 2018 19:28:04 +0100 Subject: [PATCH 16/22] Stripe has drop PHP 5.3 --- htdocs/core/modules/modStripe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modStripe.class.php b/htdocs/core/modules/modStripe.class.php index 8a11d6884db..dc46b886fc4 100644 --- a/htdocs/core/modules/modStripe.class.php +++ b/htdocs/core/modules/modStripe.class.php @@ -71,7 +71,7 @@ class modStripe extends DolibarrModules // Dependencies $this->depends = array(); // List of modules id that must be enabled if this module is enabled $this->requiredby = array(); // List of modules id to disable if this one is disabled - $this->phpmin = array(5,3); // Minimum version of PHP required by module + $this->phpmin = array(5,4); // Minimum version of PHP required by module $this->need_dolibarr_version = array(5,0); // Minimum version of Dolibarr required by module $this->langfiles = array("stripe"); From e5bb6030eb1a797a522b896a30a6e7b961e97de1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Mar 2018 19:33:43 +0100 Subject: [PATCH 17/22] Fix phpcs --- htdocs/blockedlog/class/blockedlog.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 8b7a3c150cc..6a38bc3ab49 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -675,8 +675,9 @@ class BlockedLog /** * Decode data * + * @param string $data Data to unserialize * @param string $mode 0=unserialize, 1=json_decode - * @return string Value unserialized + * @return string Value unserialized */ public function dolDecodeBlockedData($data, $mode=0) { From 93a9430e49ff45bfb9559f8de4d3d8250b38bbfb Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 7 Mar 2018 17:32:57 +0100 Subject: [PATCH 18/22] Fix: regression, restore primary key --- htdocs/admin/dict.php | 4 +- htdocs/comm/propal/class/propal.class.php | 4 +- htdocs/commande/class/commande.class.php | 4 +- htdocs/compta/bank/class/account.class.php | 4 +- htdocs/compta/bank/various_payment/index.php | 2 +- htdocs/compta/charges/index.php | 6 +- htdocs/compta/facture/card.php | 2 +- .../facture/class/facture-rec.class.php | 4 +- htdocs/compta/facture/class/facture.class.php | 4 +- .../facture/class/paymentterm.class.php | 57 +++++++++---------- htdocs/compta/paiement.php | 2 +- htdocs/compta/paiement/list.php | 2 +- htdocs/compta/resultat/clientfourn.php | 4 +- htdocs/compta/resultat/index.php | 4 +- htdocs/compta/salaries/index.php | 2 +- htdocs/compta/sociales/card.php | 2 +- .../sociales/class/chargesociales.class.php | 2 +- .../class/paymentsocialcontribution.class.php | 2 +- htdocs/compta/sociales/payments.php | 2 +- htdocs/compta/tva/reglement.php | 2 +- htdocs/core/class/commoninvoice.class.php | 10 +++- htdocs/core/class/html.form.class.php | 8 +-- .../modules/facture/doc/pdf_crabe.modules.php | 4 +- htdocs/core/modules/modFacture.class.php | 2 +- htdocs/core/modules/modSalaries.class.php | 2 +- htdocs/core/modules/modSociete.class.php | 4 +- .../modules/rapport/pdf_paiement.class.php | 4 +- .../pdf/pdf_canelle.modules.php | 2 +- htdocs/don/card.php | 7 ++- htdocs/don/class/don.class.php | 2 +- htdocs/don/class/paymentdonation.class.php | 2 +- htdocs/expensereport/card.php | 2 +- .../class/expensereport.class.php | 2 +- .../class/paymentexpensereport.class.php | 2 +- .../class/fournisseur.commande.class.php | 4 +- .../fourn/class/fournisseur.facture.class.php | 4 +- htdocs/fourn/class/paiementfourn.class.php | 2 +- htdocs/fourn/facture/card.php | 2 +- htdocs/fourn/facture/paiement.php | 2 +- .../install/mysql/migration/7.0.0-8.0.0.sql | 5 +- .../mysql/tables/llx_c_paiement.key.sql | 2 - .../mysql/tables/llx_c_payment_term.key.sql | 2 +- .../mysql/tables/llx_c_payment_term.sql | 2 +- htdocs/loan/card.php | 2 +- htdocs/loan/class/loanschedule.class.php | 2 +- htdocs/loan/class/paymentloan.class.php | 2 +- .../class/supplier_proposal.class.php | 4 +- 47 files changed, 104 insertions(+), 99 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index fbb0b5f38c5..e0d2c861cb2 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -383,8 +383,8 @@ $tabrowid[8] = "id"; $tabrowid[9] = "code_iso"; $tabrowid[10]= ""; $tabrowid[11]= "rowid"; -$tabrowid[12]= "rowid"; -$tabrowid[13]= "id"; +$tabrowid[12]= ""; +$tabrowid[13]= ""; $tabrowid[14]= ""; $tabrowid[15]= ""; $tabrowid[16]= "code"; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 3adc58ecbae..67090f386dc 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1343,8 +1343,8 @@ class Propal extends CommonObject $sql.= ", cr.code as cond_reglement_code, cr.libelle as cond_reglement, cr.libelle_facture as cond_reglement_libelle_doc"; $sql.= ", cp.code as mode_reglement_code, cp.libelle as mode_reglement"; $sql.= " FROM ".MAIN_DB_PREFIX."c_propalst as c, ".MAIN_DB_PREFIX."propal as p"; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_mode_reglement = cp.id AND cp.entity IN ('.getEntity('c_paiement').')'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON p.fk_cond_reglement = cr.rowid AND cr.entity IN ('.getEntity('c_payment_term').')'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_mode_reglement = cp.id'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON p.fk_cond_reglement = cr.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON p.fk_availability = ca.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON p.fk_input_reason = dr.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON p.fk_incoterms = i.rowid'; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 5cf5b6c7b40..f69ccb502fd 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1584,8 +1584,8 @@ class Commande extends CommonOrder $sql.= ', ca.code as availability_code, ca.label as availability_label'; $sql.= ', dr.code as demand_reason_code'; $sql.= ' FROM '.MAIN_DB_PREFIX.'commande as c'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON c.fk_cond_reglement = cr.rowid AND cr.entity IN ('.getEntity('c_payment_term').')'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON c.fk_mode_reglement = p.id AND p.entity IN ('.getEntity('c_paiement').')'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON c.fk_cond_reglement = cr.rowid'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON c.fk_mode_reglement = p.id'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON c.fk_availability = ca.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON c.fk_input_reason = ca.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid'; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 719a48c3e3c..2cba05f0bac 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -399,6 +399,8 @@ class Account extends CommonObject */ function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur='',$banque='', $accountancycode='') { + global $conf; + // Deprecatîon warning if (is_numeric($oper)) { dol_syslog(__METHOD__ . ": using numeric operations is deprecated", LOG_WARNING); @@ -414,7 +416,7 @@ class Account extends CommonObject { $sql = "SELECT code FROM ".MAIN_DB_PREFIX."c_paiement"; $sql.= " WHERE id=".$oper; - $sql.= " AND entity IN (".getEntity('c_paiement').")"; + $sql.= " AND entity = ".$conf->entity; $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/compta/bank/various_payment/index.php b/htdocs/compta/bank/various_payment/index.php index 41c0baa61d5..5e24463566c 100644 --- a/htdocs/compta/bank/various_payment/index.php +++ b/htdocs/compta/bank/various_payment/index.php @@ -102,7 +102,7 @@ $sql = "SELECT v.rowid, v.sens, v.amount, v.label, v.datep as datep, v.datev as $sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,"; $sql.= " pst.code as payment_code"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON v.fk_typepayment = pst.id AND pst.entity IN (" . getEntity('c_paiement').")"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON v.fk_typepayment = pst.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid"; $sql.= " WHERE v.entity IN (".getEntity('payment_various').")"; diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index 6e765cdacb0..321fad5baf6 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -139,7 +139,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,"; $sql.= " ".MAIN_DB_PREFIX."chargesociales as cs"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pc.fk_typepaiement = pct.id AND pct.entity IN (".getEntity('c_paiement').")"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pc.fk_typepaiement = pct.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON pc.fk_bank = b.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid"; $sql.= " WHERE cs.fk_type = c.id"; @@ -260,7 +260,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) $sql.= " FROM ".MAIN_DB_PREFIX."tva as pv"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON pv.fk_bank = b.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pv.fk_typepayment = pct.id AND pct.entity IN (".getEntity('c_paiement').")"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pv.fk_typepayment = pct.id"; $sql.= " WHERE pv.entity IN (".getEntity("tax").")"; if ($year > 0) { @@ -474,7 +474,7 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read) $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON s.fk_typepayment = pct.id AND pct.entity IN (".getEntity('c_paiement').")"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON s.fk_typepayment = pct.id"; $sql.= " , ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE s.entity IN (".getEntity('user').")"; $sql.= " AND u.rowid = s.fk_user"; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index a08b6663c38..028a9ed42c3 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -716,7 +716,7 @@ if (empty($reshook)) $sql = 'SELECT SUM(pf.amount) as total_paiements'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf, '.MAIN_DB_PREFIX.'paiement as p'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id AND c.entity IN (' . getEntity('c_paiement') . ')'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id'; $sql.= ' WHERE pf.fk_facture = '.$object->id; $sql.= ' AND pf.fk_paiement = p.rowid'; $sql.= ' AND p.entity IN (' . getEntity('facture').')'; diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index f45a0a46ede..c36e6cb09d1 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -304,8 +304,8 @@ class FactureRec extends CommonInvoice $sql.= ', c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_doc'; //$sql.= ', el.fk_source'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid AND c.entity IN ('.getEntity('c_payment_term').')'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id AND p.entity IN ('.getEntity('c_paiement').')'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id'; //$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = f.rowid AND el.targettype = 'facture'"; $sql.= ' WHERE f.entity IN ('.getEntity('facture').')'; if ($rowid) $sql.= ' AND f.rowid='.$rowid; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 7c49ff909d6..e4438d4771a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1256,8 +1256,8 @@ class Facture extends CommonInvoice $sql.= ', f.fk_incoterms, f.location_incoterms'; $sql.= ", i.libelle as libelle_incoterms"; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid AND c.entity IN (' . getEntity('c_payment_term').')'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id AND p.entity IN ('.getEntity('c_paiement').')'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON f.fk_incoterms = i.rowid'; $sql.= ' WHERE f.entity IN ('.getEntity('facture').')'; if ($rowid) $sql.= " AND f.rowid=".$rowid; diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php index bc13b0d5876..b0ee10aa19b 100644 --- a/htdocs/compta/facture/class/paymentterm.class.php +++ b/htdocs/compta/facture/class/paymentterm.class.php @@ -102,7 +102,7 @@ class PaymentTerm // extends CommonObject $sql.= "decalage"; $sql.= ") VALUES ("; $sql.= " ".(! isset($this->rowid)?'NULL':"'".$this->db->escape($this->rowid)."'").","; - $sql.= " ".(! isset($this->entity)?getEntity('c_payment_term'):"'".$this->db->escape($this->entity)."'").","; + $sql.= " ".(! isset($this->entity)?$conf->entity:"'".$this->db->escape($this->entity)."'").","; $sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").","; $sql.= " ".(! isset($this->sortorder)?'NULL':"'".$this->db->escape($this->sortorder)."'").","; $sql.= " ".(! isset($this->active)?'NULL':"'".$this->db->escape($this->active)."'").","; @@ -181,7 +181,6 @@ class PaymentTerm // extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t"; $sql.= " WHERE t.rowid = ".$id; - $sql.= " AND t.entity = " . getEntity('c_payment_term'); dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); @@ -221,36 +220,36 @@ class PaymentTerm // extends CommonObject * * @return int <0 if KO, >0 if OK */ - function getDefaultId() - { - global $langs; + function getDefaultId() + { + global $conf, $langs; - $ret=0; + $ret=0; - $sql = "SELECT"; + $sql = "SELECT"; $sql.= " t.rowid"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t"; - $sql.= " WHERE t.code = 'RECEP'"; - $sql.= " AND t.entity = " . getEntity('c_payment_term'); + $sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t"; + $sql.= " WHERE t.code = 'RECEP'"; + $sql.= " AND t.entity = " . $conf->entity; - dol_syslog(get_class($this)."::getDefaultId", LOG_DEBUG); - $resql=$this->db->query($sql); - if ($resql) - { - if ($this->db->num_rows($resql)) - { - $obj = $this->db->fetch_object($resql); - if ($obj) $ret=$obj->rowid; - } - $this->db->free($resql); - return $ret; - } - else - { - $this->error="Error ".$this->db->lasterror(); - return -1; - } - } + dol_syslog(get_class($this)."::getDefaultId", LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + if ($this->db->num_rows($resql)) + { + $obj = $this->db->fetch_object($resql); + if ($obj) $ret=$obj->rowid; + } + $this->db->free($resql); + return $ret; + } + else + { + $this->error="Error ".$this->db->lasterror(); + return -1; + } + } /** @@ -293,7 +292,6 @@ class PaymentTerm // extends CommonObject $sql.= " nbjour=".(isset($this->nbjour)?$this->nbjour:"null").","; $sql.= " decalage=".(isset($this->decalage)?$this->decalage:"null").""; $sql.= " WHERE rowid = " . $this->id; - $sql.= " AND entity = " . getEntity('c_payment_term'); $this->db->begin(); @@ -350,7 +348,6 @@ class PaymentTerm // extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."c_payment_term"; $sql.= " WHERE rowid = " . $this->id; - $sql.= " AND t.entity = " . getEntity('c_payment_term'); $this->db->begin(); diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 4f17a4444f5..29528aacfa3 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -827,7 +827,7 @@ if (! GETPOST('action','aZ09')) $sql = 'SELECT p.datep as dp, p.amount, f.amount as fa_amount, f.facnumber'; $sql.=', f.rowid as facid, c.libelle as paiement_type, p.num_paiement'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id AND c.entity IN (' . getEntity('c_paiement').')'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id'; $sql.= ', '.MAIN_DB_PREFIX.'facture as f'; $sql.= ' WHERE p.fk_facture = f.rowid'; $sql.= ' AND f.entity IN (' . getEntity('facture').')'; diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 595c9e868dc..6ca9f29c16e 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -138,7 +138,7 @@ else $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; $sql.= " FROM ".MAIN_DB_PREFIX."paiement as p"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id AND c.entity IN (" . getEntity('c_paiement') . ")"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank = b.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement"; diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 1bbeb9f2f29..8fde6fcb78c 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -822,7 +822,7 @@ else $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_expensereport as pe ON pe.fk_expensereport = p.rowid"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id AND c.entity IN (".getEntity('c_paiement').")"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id"; $sql.= " WHERE p.entity IN (".getEntity('expensereport').")"; $sql.= " AND p.fk_statut>=5"; @@ -906,7 +906,7 @@ else $sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount"; $sql.= " FROM ".MAIN_DB_PREFIX."don as p"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id AND c.entity IN (".getEntity('c_paiement').")"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id"; $sql.= " WHERE p.entity IN (".getEntity('donation').")"; $sql.= " AND fk_statut >= 2"; } diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 26f12e3f7c5..26647d5f0f0 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -698,7 +698,7 @@ if (! empty($conf->expensereport->enabled) && ($modecompta == 'CREANCES-DETTES' $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_expensereport as pe ON pe.fk_expensereport = p.rowid"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id AND c.entity IN (".getEntity('c_paiement').")"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id"; $sql.= " WHERE p.entity IN (".getEntity('expensereport').")"; $sql.= " AND p.fk_statut>=5"; @@ -761,7 +761,7 @@ if (! empty($conf->don->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco $sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(pe.datep,'%Y-%m') as dm, sum(p.amount) as amount"; $sql.= " FROM ".MAIN_DB_PREFIX."don as p"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id AND c.entity IN (".getEntity('c_paiement').")"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id"; $sql.= " WHERE p.entity IN (".getEntity('donation').")"; $sql.= " AND fk_statut >= 2"; if (! empty($date_start) && ! empty($date_end)) diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index f911636a7ef..4cad9117040 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -105,7 +105,7 @@ $sql.= " s.rowid, s.fk_user, s.amount, s.salary, s.label, s.datep as datep, s.da $sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel,"; $sql.= " pst.code as payment_code"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst.id AND pst.entity IN (".getEntity('c_paiement').")"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid,"; $sql.= " ".MAIN_DB_PREFIX."user as u"; diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 23e3494a25d..cdcabc5617b 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -586,7 +586,7 @@ if ($id > 0) $sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p"; $sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank as b ON p.fk_bank = b.rowid'; $sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank_account as ba ON b.fk_account = ba.rowid'; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepaiement = c.id AND c.entity IN (" . getEntity('c_paiement').")"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepaiement = c.id"; $sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs"; $sql.= " WHERE p.fk_charge = ".$id; $sql.= " AND p.fk_charge = cs.rowid"; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 2d75584cbda..fa4127c3af6 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -83,7 +83,7 @@ class ChargeSociales extends CommonObject $sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; $sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id"; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON cs.fk_mode_reglement = p.id AND p.entity IN ('.getEntity('c_paiement').')'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON cs.fk_mode_reglement = p.id'; $sql.= ' WHERE cs.entity IN ('.getEntity('tax').')'; if ($ref) $sql.= " AND cs.rowid = ".$ref; else $sql.= " AND cs.rowid = ".$id; diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 60a1a647661..4cd0dfd2b59 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -203,7 +203,7 @@ class PaymentSocialContribution extends CommonObject $sql.= " t.fk_user_modif,"; $sql.= " pt.code as type_code, pt.libelle as type_libelle,"; $sql.= ' b.fk_account'; - $sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as t LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepaiement = pt.id AND pt.entity IN (" . getEntity('c_paiement') . ")"; + $sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as t LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepaiement = pt.id"; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid'; $sql.= " WHERE t.rowid = ".$id; // TODO link on entity of tax; diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php index a7c388a26e6..879e9b69ee7 100644 --- a/htdocs/compta/sociales/payments.php +++ b/htdocs/compta/sociales/payments.php @@ -133,7 +133,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,"; $sql.= " ".MAIN_DB_PREFIX."chargesociales as cs,"; $sql.= " ".MAIN_DB_PREFIX."paiementcharge as pc"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pc.fk_typepaiement = pct.id AND pct.entity IN (".getEntity('c_paiement').")"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pc.fk_typepaiement = pct.id"; $sql.= " WHERE cs.fk_type = c.id AND pc.fk_charge = cs.rowid"; $sql.= " AND cs.entity = ".$conf->entity; if ($year > 0) diff --git a/htdocs/compta/tva/reglement.php b/htdocs/compta/tva/reglement.php index 27e314762f8..5041450dd8b 100644 --- a/htdocs/compta/tva/reglement.php +++ b/htdocs/compta/tva/reglement.php @@ -100,7 +100,7 @@ $bankstatic = new Account($db); $sql = "SELECT t.rowid, t.amount, t.label, t.datev, t.datep, t.fk_typepayment as type, t.num_payment, t.fk_bank, pst.code as payment_code,"; $sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel"; $sql.= " FROM ".MAIN_DB_PREFIX."tva as t"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON t.fk_typepayment = pst.id AND pst.entity IN (".getEntity('c_paiement').")"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON t.fk_typepayment = pst.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON t.fk_bank = b.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid"; $sql.= " WHERE t.entity IN (".getEntity('tax').")"; diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index ac5d3869a3d..97762482685 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -595,6 +595,8 @@ abstract class CommonInvoice extends CommonObject */ function calculate_date_lim_reglement($cond_reglement=0) { + global $conf; + if (! $cond_reglement) $cond_reglement=$this->cond_reglement_code; if (! $cond_reglement) $cond_reglement=$this->cond_reglement_id; @@ -602,9 +604,11 @@ abstract class CommonInvoice extends CommonObject $sqltemp = 'SELECT c.type_cdr,c.nbjour,c.decalage'; $sqltemp.= ' FROM '.MAIN_DB_PREFIX.'c_payment_term as c'; - $sqltemp.= " WHERE c.entity IN (" . getEntity('c_payment_term').")"; - if (is_numeric($cond_reglement)) $sqltemp.= " AND c.rowid=".$cond_reglement; - else $sqltemp.= " AND c.code='".$this->db->escape($cond_reglement)."'"; + if (is_numeric($cond_reglement)) $sqltemp.= " WHERE c.rowid=".$cond_reglement; + else { + $sqltemp.= " WHERE c.entity = ".$conf->entity; + $sqltemp.= " AND c.code='".$this->db->escape($cond_reglement)."'"; + } dol_syslog(get_class($this).'::calculate_date_lim_reglement', LOG_DEBUG); $resqltemp=$this->db->query($sqltemp); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 61d21cec7e8..3c4df109818 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2784,7 +2784,7 @@ class Form */ function load_cache_conditions_paiements() { - global $langs; + global $conf, $langs; $num = count($this->cache_conditions_paiements); if ($num > 0) return 0; // Cache already loaded @@ -2793,7 +2793,7 @@ class Form $sql = "SELECT rowid, code, libelle as label"; $sql.= " FROM ".MAIN_DB_PREFIX.'c_payment_term'; - $sql.= " WHERE entity = " . getEntity('c_payment_term'); + $sql.= " WHERE entity = " . $conf->entity; $sql.= " AND active > 0"; $sql.= " ORDER BY sortorder"; @@ -2997,7 +2997,7 @@ class Form */ function load_cache_types_paiements() { - global $langs; + global $conf, $langs; $num=count($this->cache_types_paiements); if ($num > 0) return $num; // Cache already loaded @@ -3008,7 +3008,7 @@ class Form $sql = "SELECT id, code, libelle as label, type, active"; $sql.= " FROM ".MAIN_DB_PREFIX."c_paiement"; - $sql.= " WHERE entity IN (".getEntity('c_paiement').")"; + $sql.= " WHERE entity = ".$conf->entity; //if ($active >= 0) $sql.= " AND active = ".$active; $resql = $this->db->query($sql); diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 8050abf811b..21adfe4edb4 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -828,7 +828,7 @@ class pdf_crabe extends ModelePDFFactures $sql = "SELECT p.datep as date, p.fk_paiement, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,"; $sql.= " cp.code"; $sql.= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id AND cp.entity IN (".getEntity('c_paiement').")"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id"; $sql.= " WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = ".$object->id; //$sql.= " WHERE pf.fk_paiement = p.rowid AND pf.fk_facture = 1"; $sql.= " ORDER BY p.datep"; @@ -1688,7 +1688,7 @@ class pdf_crabe extends ModelePDFFactures { $top_shift = $pdf->getY() - $current_y; } - + if ($showaddress) { // Sender properties diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 9a23c0e5e9d..0a7154a9ce2 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -259,7 +259,7 @@ class modFacture extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_extrafields as extra ON f.rowid = extra.fk_object'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiement as p ON pf.fk_paiement = p.rowid'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as pt ON pt.id = p.fk_paiement AND pt.entity IN ('.getEntity('c_paiement').')'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as pt ON pt.id = p.fk_paiement'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON b.rowid = p.fk_bank'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON ba.rowid = b.fk_account'; $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid'; diff --git a/htdocs/core/modules/modSalaries.class.php b/htdocs/core/modules/modSalaries.class.php index 1e648c1386a..1edfd419378 100644 --- a/htdocs/core/modules/modSalaries.class.php +++ b/htdocs/core/modules/modSalaries.class.php @@ -165,7 +165,7 @@ class modSalaries extends DolibarrModules $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'user as u'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'payment_salary as p ON p.fk_user = u.rowid'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_typepayment = cp.id AND cp.entity IN ('.getEntity('c_paiement').')'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_typepayment = cp.id'; $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('user').')'; } diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 52e865cbdbc..711e2ead71c 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -283,8 +283,8 @@ class modSociete extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_stcomm as st ON s.fk_stcomm = st.id'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON sc.fk_user = u.rowid'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as payterm ON s.cond_reglement = payterm.rowid AND payterm.entity IN ('.getEntity('c_payment_term').')'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as paymode ON s.mode_reglement = paymode.id AND paymode.entity IN ('.getEntity('c_paiement').')'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as payterm ON s.cond_reglement = payterm.rowid'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as paymode ON s.mode_reglement = paymode.id'; $this->export_sql_end[$r] .=' WHERE s.entity IN ('.getEntity('societe').')'; if (is_object($user) && empty($user->rights->societe->client->voir)) { $this->export_sql_end[$r] .=' AND (sc.fk_user = '.$user->id.' '; diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index 2bb784aa578..2594a4a0b6a 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -187,7 +187,7 @@ class pdf_paiement if (! empty($conf->banque->enabled)) $sql.= ", ba.ref as bankaccount"; $sql.= ", p.rowid as prowid"; - $sql.= " FROM ".MAIN_DB_PREFIX."paiement as p LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id AND c.entity IN (" . getEntity('c_paiement').")"; + $sql.= " FROM ".MAIN_DB_PREFIX."paiement as p LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id"; $sql.= ", ".MAIN_DB_PREFIX."facture as f,"; $sql.= " ".MAIN_DB_PREFIX."paiement_facture as pf,"; if (! empty($conf->banque->enabled)) @@ -218,7 +218,7 @@ class pdf_paiement if (! empty($conf->banque->enabled)) $sql.= ", ba.ref as bankaccount"; $sql.= ", p.rowid as prowid"; - $sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn as p LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id AND c.entity IN (".getEntity('c_paiement').")"; + $sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn as p LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id"; $sql.= ", ".MAIN_DB_PREFIX."facture_fourn as f,"; $sql.= " ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf,"; if (! empty($conf->banque->enabled)) diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 0a57ab1e449..9cdb9ebc6a0 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -933,7 +933,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $sql = "SELECT p.datep as date, p.fk_paiement as type, p.num_paiement as num, pf.amount as amount, pf.multicurrency_amount,"; $sql.= " cp.code"; $sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf, ".MAIN_DB_PREFIX."paiementfourn as p"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id AND cp.entity IN (".getEntity('c_paiement').")"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON p.fk_paiement = cp.id"; $sql.= " WHERE pf.fk_paiementfourn = p.rowid and pf.fk_facturefourn = ".$object->id; $sql.= " ORDER BY p.datep"; $resql=$this->db->query($sql); diff --git a/htdocs/don/card.php b/htdocs/don/card.php index ced8111a93f..38d7d6e6240 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2017 Laurent Destailleur +s * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Florian Henry * Copyright (C) 2015-2016 Alexandre Spangaro @@ -643,8 +643,9 @@ if (! empty($id) && $action != 'edit') * Payments */ $sql = "SELECT p.rowid, p.num_payment, p.datep as dp, p.amount,"; - $sql.= " c.code as type_code,c.libelle as paiement_type"; - $sql.= " FROM ".MAIN_DB_PREFIX."payment_donation as p LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON c.entity IN (".getEntity('c_paiement').")"; + $sql.= "c.code as type_code,c.libelle as paiement_type"; + $sql.= " FROM ".MAIN_DB_PREFIX."payment_donation as p"; + $sql.= ", ".MAIN_DB_PREFIX."c_paiement as c "; $sql.= ", ".MAIN_DB_PREFIX."don as d"; $sql.= " WHERE d.rowid = '".$id."'"; $sql.= " AND p.fk_donation = d.rowid"; diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 56a685eef12..86bfe2e6823 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -611,7 +611,7 @@ class Don extends CommonObject $sql.= " c.code as country_code, c.label as country"; $sql.= " FROM ".MAIN_DB_PREFIX."don as d"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = d.fk_projet"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON cp.id = d.fk_payment AND cp.entity IN (".getEntity('c_paiement').")"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON cp.id = d.fk_payment"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.fk_country = c.rowid"; $sql.= " WHERE d.entity IN (".getEntity('donation').")"; if (! empty($id)) diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php index 1023bf68b7a..8d31c292155 100644 --- a/htdocs/don/class/paymentdonation.class.php +++ b/htdocs/don/class/paymentdonation.class.php @@ -182,7 +182,7 @@ class PaymentDonation extends CommonObject $sql.= " pt.code as type_code, pt.libelle as type_libelle,"; $sql.= ' b.fk_account'; $sql.= " FROM ".MAIN_DB_PREFIX."payment_donation as t"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepayment = pt.id AND pt.entity IN (".getEntity('c_paiement').")"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepayment = pt.id"; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid'; $sql.= " WHERE t.rowid = ".$id; diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index dd5db880bc9..d4bc45e925a 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1880,7 +1880,7 @@ else $sql.= "c.code as p_code, c.libelle as payment_type,"; $sql.= "ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as e, ".MAIN_DB_PREFIX."payment_expensereport as p"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepayment = c.id AND c.entity IN (".getEntity('c_paiement').")"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepayment = c.id"; $sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank as b ON p.fk_bank = b.rowid'; $sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank_account as ba ON b.fk_account = ba.rowid'; $sql.= " WHERE e.rowid = '".$id."'"; diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 5674192906c..28870cc78de 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -450,7 +450,7 @@ class ExpenseReport extends CommonObject $sql.= " d.fk_statut as status, d.fk_c_paiement,"; $sql.= " dp.libelle as libelle_paiement, dp.code as code_paiement"; // INNER JOIN paiement $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as d"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as dp ON d.fk_c_paiement = dp.id AND dp.entity IN (".getEntity('c_paiement').")"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as dp ON d.fk_c_paiement = dp.id"; if ($ref) $sql.= " WHERE d.ref = '".$this->db->escape($ref)."'"; else $sql.= " WHERE d.rowid = ".$id; //$sql.= $restrict; diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index 023a9709d08..43fcacc8483 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -166,7 +166,7 @@ class PaymentExpenseReport extends CommonObject $sql.= " pt.code as type_code, pt.libelle as type_libelle,"; $sql.= ' b.fk_account'; $sql.= " FROM ".MAIN_DB_PREFIX."payment_expensereport as t"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepayment = pt.id AND pt.entity IN (".getEntity('c_paiement').")"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepayment = pt.id"; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid'; $sql.= " WHERE t.rowid = ".$id; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 1fd6bb84de1..b06b6188183 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -232,8 +232,8 @@ class CommandeFournisseur extends CommonOrder $sql.= ', c.fk_incoterms, c.location_incoterms'; $sql.= ', i.libelle as libelle_incoterms'; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_payment_term as cr ON c.fk_cond_reglement = cr.rowid AND cr.entity IN (".getEntity('c_payment_term').")"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON c.fk_mode_reglement = p.id AND p.entity IN (".getEntity('c_paiement').")"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_payment_term as cr ON c.fk_cond_reglement = cr.rowid"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON c.fk_mode_reglement = p.id"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_input_method as cm ON cm.rowid = c.fk_input_method"; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid'; $sql.= " WHERE c.entity = ".$conf->entity; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index ccbd93b46e4..51f0263a664 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -561,8 +561,8 @@ class FactureFournisseur extends CommonInvoice $sql.= ' t.fk_multicurrency, t.multicurrency_code, t.multicurrency_tx, t.multicurrency_total_ht, t.multicurrency_total_tva, t.multicurrency_total_ttc'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as t'; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (t.fk_soc = s.rowid)"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_payment_term as cr ON t.fk_cond_reglement = cr.rowid AND cr.entity IN (".getEntity('c_payment_term').")"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON t.fk_mode_reglement = p.id AND p.entity IN (".getEntity('c_paiement').")"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_payment_term as cr ON t.fk_cond_reglement = cr.rowid"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON t.fk_mode_reglement = p.id"; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON t.fk_incoterms = i.rowid'; if ($id) $sql.= " WHERE t.rowid=".$id; if ($ref) $sql.= " WHERE t.ref='".$this->db->escape($ref)."'"; diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index fc917e112f7..1a22356695a 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -80,7 +80,7 @@ class PaiementFourn extends Paiement $sql.= ' c.code as paiement_code, c.libelle as paiement_type,'; $sql.= ' p.num_paiement, p.note, b.fk_account'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as p'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id AND c.entity IN ('.getEntity('c_paiement').')'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid '; $sql.= ' WHERE p.entity IN ('.getEntity('facture_fourn').')'; if ($id > 0) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 1f9227ce9b6..0e2337228f6 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2433,7 +2433,7 @@ else $sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as p'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id AND c.entity IN ('.getEntity('c_paiement').')'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_paiementfourn = p.rowid'; $sql.= ' WHERE pf.fk_facturefourn = '.$object->id; $sql.= ' ORDER BY p.datep, p.tms'; diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 64223d4b4e9..cc636718bb7 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -745,7 +745,7 @@ if (empty($action)) $sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn AS p'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn AS pf ON p.rowid=pf.fk_paiementfourn'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn AS f ON f.rowid=pf.fk_facturefourn'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement AS c ON p.fk_paiement = c.id AND c.entity IN ('.getEntity('c_paiement').')'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement AS c ON p.fk_paiement = c.id'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON s.rowid = f.fk_soc'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid'; diff --git a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql index 2b2bb6949d5..2a86a414dca 100644 --- a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql +++ b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql @@ -76,4 +76,7 @@ ALTER TABLE llx_c_paiement DROP INDEX uk_c_paiement; ALTER TABLE llx_c_paiement ADD UNIQUE INDEX uk_c_paiement_code(entity, code); ALTER TABLE llx_c_paiement CHANGE COLUMN id id INTEGER AUTO_INCREMENT PRIMARY KEY; - +-- Add missing keys and primary key +ALTER TABLE llx_c_payment_term DROP INDEX uk_c_payment_term; +ALTER TABLE llx_c_payment_term CHANGE COLUMN rowid rowid INTEGER AUTO_INCREMENT PRIMARY KEY; +ALTER TABLE llx_c_payment_term ADD UNIQUE INDEX uk_c_payment_term_code(entity, code); diff --git a/htdocs/install/mysql/tables/llx_c_paiement.key.sql b/htdocs/install/mysql/tables/llx_c_paiement.key.sql index 1e22789d7bf..fc8147805ef 100644 --- a/htdocs/install/mysql/tables/llx_c_paiement.key.sql +++ b/htdocs/install/mysql/tables/llx_c_paiement.key.sql @@ -17,6 +17,4 @@ -- -- ======================================================================== -ALTER TABLE llx_c_paiement ADD UNIQUE INDEX uk_c_paiement(id, entity, code); - ALTER TABLE llx_c_paiement ADD UNIQUE INDEX uk_c_paiement_code(entity, code); diff --git a/htdocs/install/mysql/tables/llx_c_payment_term.key.sql b/htdocs/install/mysql/tables/llx_c_payment_term.key.sql index 1bd86401945..fc2f49de529 100644 --- a/htdocs/install/mysql/tables/llx_c_payment_term.key.sql +++ b/htdocs/install/mysql/tables/llx_c_payment_term.key.sql @@ -17,4 +17,4 @@ -- -- ======================================================================== -ALTER TABLE llx_c_payment_term ADD UNIQUE INDEX uk_c_payment_term(rowid, entity, code); +ALTER TABLE llx_c_payment_term ADD UNIQUE INDEX uk_c_payment_term_code(entity, code); diff --git a/htdocs/install/mysql/tables/llx_c_payment_term.sql b/htdocs/install/mysql/tables/llx_c_payment_term.sql index cc7c7a22dea..39ccaa70916 100644 --- a/htdocs/install/mysql/tables/llx_c_payment_term.sql +++ b/htdocs/install/mysql/tables/llx_c_payment_term.sql @@ -20,7 +20,7 @@ create table llx_c_payment_term ( - rowid integer, + rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, -- multi company id code varchar(16), sortorder smallint, diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index b920c8d1a6a..17900d1772a 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -676,7 +676,7 @@ if ($id > 0) $sql.= " p.amount_capital, p.amount_insurance, p.amount_interest,"; $sql.= " c.libelle as paiement_type"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_loan as p"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepayment = c.id AND c.entity IN (".getEntity('c_paiement').")"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepayment = c.id"; $sql.= ", ".MAIN_DB_PREFIX."loan as l"; $sql.= " WHERE p.fk_loan = ".$id; $sql.= " AND p.fk_loan = l.rowid"; diff --git a/htdocs/loan/class/loanschedule.class.php b/htdocs/loan/class/loanschedule.class.php index a72487e706a..ebb1820bca0 100644 --- a/htdocs/loan/class/loanschedule.class.php +++ b/htdocs/loan/class/loanschedule.class.php @@ -177,7 +177,7 @@ class LoanSchedule extends CommonObject $sql.= " pt.code as type_code, pt.libelle as type_libelle,"; $sql.= ' b.fk_account'; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepayment = pt.id AND pt.entity IN (".getEntity('c_paiement').")"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepayment = pt.id"; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid'; $sql.= " WHERE t.rowid = ".$id; diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index 557262de945..022cf050f11 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -176,7 +176,7 @@ class PaymentLoan extends CommonObject $sql.= " pt.code as type_code, pt.libelle as type_libelle,"; $sql.= ' b.fk_account'; $sql.= " FROM ".MAIN_DB_PREFIX."payment_loan as t"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepayment = pt.id AND pt.entity IN (".getEntity('c_paiement').")"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pt ON t.fk_typepayment = pt.id"; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON t.fk_bank = b.rowid'; $sql.= " WHERE t.rowid = ".$id; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 8a713bccb95..ce70fe996d3 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1153,8 +1153,8 @@ class SupplierProposal extends CommonObject $sql.= ", cr.code as cond_reglement_code, cr.libelle as cond_reglement, cr.libelle_facture as cond_reglement_libelle_doc"; $sql.= ", cp.code as mode_reglement_code, cp.libelle as mode_reglement"; $sql.= " FROM ".MAIN_DB_PREFIX."c_propalst as c, ".MAIN_DB_PREFIX."supplier_proposal as p"; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_mode_reglement = cp.id AND cp.entity IN ('.getEntity('c_paiement').')'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON p.fk_cond_reglement = cr.rowid AND cr.entity IN ('.getEntity('c_payment_term').')'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_mode_reglement = cp.id'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON p.fk_cond_reglement = cr.rowid'; $sql.= " WHERE p.fk_statut = c.id"; $sql.= " AND p.entity IN (".getEntity('supplier_proposal').")"; if ($ref) $sql.= " AND p.ref='".$ref."'"; From fd9c79fa7f245d87495572a6c426dad6d56ae6da Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 7 Mar 2018 17:53:15 +0100 Subject: [PATCH 19/22] Fix: use getEntity if no rowid to compare --- htdocs/compta/bank/class/account.class.php | 4 +--- htdocs/compta/facture/class/paymentterm.class.php | 6 +++--- htdocs/core/class/commoninvoice.class.php | 4 +--- htdocs/core/class/html.form.class.php | 8 ++++---- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 2cba05f0bac..719a48c3e3c 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -399,8 +399,6 @@ class Account extends CommonObject */ function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur='',$banque='', $accountancycode='') { - global $conf; - // Deprecatîon warning if (is_numeric($oper)) { dol_syslog(__METHOD__ . ": using numeric operations is deprecated", LOG_WARNING); @@ -416,7 +414,7 @@ class Account extends CommonObject { $sql = "SELECT code FROM ".MAIN_DB_PREFIX."c_paiement"; $sql.= " WHERE id=".$oper; - $sql.= " AND entity = ".$conf->entity; + $sql.= " AND entity IN (".getEntity('c_paiement').")"; $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php index b0ee10aa19b..ffe50e86ee4 100644 --- a/htdocs/compta/facture/class/paymentterm.class.php +++ b/htdocs/compta/facture/class/paymentterm.class.php @@ -102,7 +102,7 @@ class PaymentTerm // extends CommonObject $sql.= "decalage"; $sql.= ") VALUES ("; $sql.= " ".(! isset($this->rowid)?'NULL':"'".$this->db->escape($this->rowid)."'").","; - $sql.= " ".(! isset($this->entity)?$conf->entity:"'".$this->db->escape($this->entity)."'").","; + $sql.= " ".(! isset($this->entity)?getEntity('c_payment_term'):"'".$this->db->escape($this->entity)."'").","; $sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").","; $sql.= " ".(! isset($this->sortorder)?'NULL':"'".$this->db->escape($this->sortorder)."'").","; $sql.= " ".(! isset($this->active)?'NULL':"'".$this->db->escape($this->active)."'").","; @@ -222,7 +222,7 @@ class PaymentTerm // extends CommonObject */ function getDefaultId() { - global $conf, $langs; + global $langs; $ret=0; @@ -230,7 +230,7 @@ class PaymentTerm // extends CommonObject $sql.= " t.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t"; $sql.= " WHERE t.code = 'RECEP'"; - $sql.= " AND t.entity = " . $conf->entity; + $sql.= " AND t.entity IN (".getEntity('c_payment_term').")"; dol_syslog(get_class($this)."::getDefaultId", LOG_DEBUG); $resql=$this->db->query($sql); diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 97762482685..595105c5695 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -595,8 +595,6 @@ abstract class CommonInvoice extends CommonObject */ function calculate_date_lim_reglement($cond_reglement=0) { - global $conf; - if (! $cond_reglement) $cond_reglement=$this->cond_reglement_code; if (! $cond_reglement) $cond_reglement=$this->cond_reglement_id; @@ -606,7 +604,7 @@ abstract class CommonInvoice extends CommonObject $sqltemp.= ' FROM '.MAIN_DB_PREFIX.'c_payment_term as c'; if (is_numeric($cond_reglement)) $sqltemp.= " WHERE c.rowid=".$cond_reglement; else { - $sqltemp.= " WHERE c.entity = ".$conf->entity; + $sqltemp.= " WHERE c.entity IN (".getEntity('c_payment_term').")"; $sqltemp.= " AND c.code='".$this->db->escape($cond_reglement)."'"; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 3c4df109818..785685e9011 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2784,7 +2784,7 @@ class Form */ function load_cache_conditions_paiements() { - global $conf, $langs; + global $langs; $num = count($this->cache_conditions_paiements); if ($num > 0) return 0; // Cache already loaded @@ -2793,7 +2793,7 @@ class Form $sql = "SELECT rowid, code, libelle as label"; $sql.= " FROM ".MAIN_DB_PREFIX.'c_payment_term'; - $sql.= " WHERE entity = " . $conf->entity; + $sql.= " WHERE entity IN (".getEntity('c_payment_term').")"; $sql.= " AND active > 0"; $sql.= " ORDER BY sortorder"; @@ -2997,7 +2997,7 @@ class Form */ function load_cache_types_paiements() { - global $conf, $langs; + global $langs; $num=count($this->cache_types_paiements); if ($num > 0) return $num; // Cache already loaded @@ -3008,7 +3008,7 @@ class Form $sql = "SELECT id, code, libelle as label, type, active"; $sql.= " FROM ".MAIN_DB_PREFIX."c_paiement"; - $sql.= " WHERE entity = ".$conf->entity; + $sql.= " WHERE entity IN (".getEntity('c_paiement').")"; //if ($active >= 0) $sql.= " AND active = ".$active; $resql = $this->db->query($sql); From 861a831e249bd8d00e10a362546e6533e8e33785 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 8 Mar 2018 11:53:46 +0100 Subject: [PATCH 20/22] Fix: debug --- htdocs/api/class/api_setup.class.php | 6 ++++-- htdocs/compta/facture/class/paymentterm.class.php | 2 -- htdocs/compta/paiement/class/cpaiement.class.php | 7 ++++--- htdocs/compta/salaries/card.php | 2 +- htdocs/core/lib/functions.lib.php | 5 ----- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 65ba8f4ff37..22c763100d4 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -66,7 +66,8 @@ class Setup extends DolibarrApi $sql = "SELECT id, code, type, libelle as label, module"; $sql.= " FROM ".MAIN_DB_PREFIX."c_paiement as t"; - $sql.= " WHERE t.active = ".$active; + $sql.= " WHERE t.entity IN (".getEntity('c_paiement').")"; + $sql.= " AND t.active = ".$active; // Add sql filters if ($sqlfilters) { @@ -538,7 +539,8 @@ class Setup extends DolibarrApi $sql = "SELECT rowid as id, code, sortorder, libelle as label, libelle_facture as descr, type_cdr, nbjour, decalage, module"; $sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t"; - $sql.= " WHERE t.active = ".$active; + $sql.= " WHERE t.entity IN (".getEntity('c_payment_term').")"; + $sql.= " AND t.active = ".$active; // Add sql filters if ($sqlfilters) { diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php index ffe50e86ee4..9c1f0020d36 100644 --- a/htdocs/compta/facture/class/paymentterm.class.php +++ b/htdocs/compta/facture/class/paymentterm.class.php @@ -90,7 +90,6 @@ class PaymentTerm // extends CommonObject // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."c_payment_term("; - $sql.= "rowid,"; $sql.= "entity,"; $sql.= "code,"; $sql.= "sortorder,"; @@ -101,7 +100,6 @@ class PaymentTerm // extends CommonObject $sql.= "nbjour,"; $sql.= "decalage"; $sql.= ") VALUES ("; - $sql.= " ".(! isset($this->rowid)?'NULL':"'".$this->db->escape($this->rowid)."'").","; $sql.= " ".(! isset($this->entity)?getEntity('c_payment_term'):"'".$this->db->escape($this->entity)."'").","; $sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").","; $sql.= " ".(! isset($this->sortorder)?'NULL':"'".$this->db->escape($this->sortorder)."'").","; diff --git a/htdocs/compta/paiement/class/cpaiement.class.php b/htdocs/compta/paiement/class/cpaiement.class.php index b089cac6aab..59f13023b24 100644 --- a/htdocs/compta/paiement/class/cpaiement.class.php +++ b/htdocs/compta/paiement/class/cpaiement.class.php @@ -107,7 +107,7 @@ class Cpaiement // Insert request $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '('; - $sql.= 'id,'; + $sql.= 'entity,'; $sql.= 'code,'; $sql.= 'libelle,'; $sql.= 'type,'; @@ -118,7 +118,7 @@ class Cpaiement $sql .= ') VALUES ('; - $sql .= ' '.(! isset($this->id)?'NULL':$this->id).','; + $sql .= ' '.(! isset($this->entity)?getEntity('c_paiement'):$this->entity).','; $sql .= ' '.(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").','; $sql .= ' '.(! isset($this->libelle)?'NULL':"'".$this->db->escape($this->libelle)."'").','; $sql .= ' '.(! isset($this->type)?'NULL':$this->type).','; @@ -186,7 +186,8 @@ class Cpaiement $sql .= " t.module"; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; if (null !== $ref) { - $sql .= ' WHERE t.code = ' . '\'' . $ref . '\''; + $sql .= ' WHERE t.entity IN ('.getEntity('c_paiement').')'; + $sql .= ' AND t.code = ' . '\'' . $ref . '\''; } else { $sql .= ' WHERE t.id = ' . $id; } diff --git a/htdocs/compta/salaries/card.php b/htdocs/compta/salaries/card.php index 608b5a737b0..4f28e2c76c9 100644 --- a/htdocs/compta/salaries/card.php +++ b/htdocs/compta/salaries/card.php @@ -73,7 +73,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $dateep=dol_mktime(12,0,0, $_POST["dateepmonth"], $_POST["dateepday"], $_POST["dateepyear"]); if (empty($datev)) $datev=$datep; - $type_payment = dol_getIdFromCode($db, GETPOST("paymenttype", 'alpha'), 'c_paiement'); + $type_payment = dol_getIdFromCode($db, GETPOST("paymenttype", 'alpha'), 'c_paiement', 'code', 'id', 1); $object->accountid=GETPOST("accountid") > 0 ? GETPOST("accountid","int") : 0; $object->fk_user=GETPOST("fk_user") > 0 ? GETPOST("fk_user","int") : 0; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index bc06c31b10e..b38024b3ec0 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -121,11 +121,6 @@ function getEntity($element, $shared=1, $forceentity=null) { global $conf, $mc; - // For backward compatibilty - if ($element == 'actioncomm') $element='agenda'; - if ($element == 'fichinter') $element='intervention'; - if ($element == 'categorie') $element='category'; - if (is_object($mc)) { return $mc->getEntity($element, $shared, $forceentity); From 73a63c1abc49b78ca57849712a9209c5f5baa8c8 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 8 Mar 2018 11:57:38 +0100 Subject: [PATCH 21/22] Fix: syntax error --- htdocs/don/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 38d7d6e6240..78b8d01e51d 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -1,6 +1,6 @@ -s * Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Florian Henry * Copyright (C) 2015-2016 Alexandre Spangaro From 0b316c39807585d604e271ee520ec850f4fc1ae4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 Mar 2018 15:01:34 +0100 Subject: [PATCH 22/22] Attach invoice on email subscription confirmation --- htdocs/adherents/class/adherent.class.php | 69 +++++++++++++---------- htdocs/adherents/subscription.php | 41 ++++++++++++-- htdocs/core/class/html.formmail.class.php | 9 ++- htdocs/langs/en_US/members.lang | 5 +- htdocs/public/payment/paymentok.php | 27 ++++++++- htdocs/public/paypal/paymentok.php | 2 +- 6 files changed, 113 insertions(+), 40 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 78fc662f6b4..20041333ee6 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1330,19 +1330,19 @@ class Adherent extends CommonObject /** * Do complementary actions after subscription recording. * - * @param int $subscriptionid Id of created subscription - * @param string $option Which action ('bankdirect', 'invoiceonly', ...) - * @param int $accountid Id bank account - * @param int $datesubscription Date of subscription - * @param int $paymentdate Date of payment - * @param string $operation Code of type of operation (if Id bank account provided). Example 'CB', ... - * @param string $label Label operation (if Id bank account provided) - * @param double $amount Amount of subscription (0 accepted for some members) - * @param string $num_chq Numero cheque (if Id bank account provided) - * @param string $emetteur_nom Name of cheque writer - * @param string $emetteur_banque Name of bank of cheque + * @param int $subscriptionid Id of created subscription + * @param string $option Which action ('bankdirect', 'invoiceonly', ...) + * @param int $accountid Id bank account + * @param int $datesubscription Date of subscription + * @param int $paymentdate Date of payment + * @param string $operation Code of type of operation (if Id bank account provided). Example 'CB', ... + * @param string $label Label operation (if Id bank account provided) + * @param double $amount Amount of subscription (0 accepted for some members) + * @param string $num_chq Numero cheque (if Id bank account provided) + * @param string $emetteur_nom Name of cheque writer + * @param string $emetteur_banque Name of bank of cheque * @param string $autocreatethirdparty Auto create new thirdparty if member not linked to a thirdparty. - * @return int <0 if KO, >0 if OK + * @return int <0 if KO, >0 if OK */ function subscriptionComplementaryActions($subscriptionid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom='', $emetteur_banque='', $autocreatethirdparty=0) { @@ -1350,6 +1350,8 @@ class Adherent extends CommonObject $error = 0; + $this->invoice = null; // This will contains invoice if an invoice is created + // Insert into bank account directlty (if option choosed for) + link to llx_subscription if option is 'bankdirect' if ($option == 'bankdirect' && $accountid) { @@ -1489,6 +1491,10 @@ class Adherent extends CommonObject $this->errors=$invoice->errors; $error++; } + else + { + $this->invoice = $invoice; + } } if (! $error) @@ -1524,6 +1530,11 @@ class Adherent extends CommonObject } } + if (! $error) + { + // TODO Link invoice with subscription ? + } + // Add payment onto invoice if (! $error && $option == 'bankviainvoice' && $accountid) { @@ -1584,25 +1595,25 @@ class Adherent extends CommonObject // Set invoice as paid $invoice->set_paid($user); } + } - if (! $error) - { - // Define output language - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) - $newlang = $_REQUEST['lang_id']; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) - $newlang = $customer->default_lang; - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - // Generate PDF (whatever is option MAIN_DISABLE_PDF_AUTOUPDATE) so we can include it into email - //if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) - - $invoice->generateDocument($invoice->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + if (! $error) + { + // Define output language + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) + $newlang = $_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) + $newlang = $customer->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); } + // Generate PDF (whatever is option MAIN_DISABLE_PDF_AUTOUPDATE) so we can include it into email + //if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) + + $invoice->generateDocument($invoice->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } } diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 3b200ed526c..9d164307e91 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -322,11 +322,15 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! $error++; setEventMessages($object->error, $object->errors, 'errors'); } + else + { + // If an invoice was created, it is into $object->invoice + } } if (! $error) { - $db->commit(); +// $db->commit(); } else { @@ -334,6 +338,11 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! $action = 'addsubscription'; } + if (! $error) + { + setEventMessages("SubscriptionRecorded", null, 'mesgs'); + } + // Send email if (! $error) { @@ -343,12 +352,36 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! $subjecttosend=$object->makeSubstitution($conf->global->ADHERENT_MAIL_COTIS_SUBJECT); $texttosend=$object->makeSubstitution($adht->getMailOnSubscription()); - $result=$object->send_an_email($texttosend,$subjecttosend,array(),array(),array(),"","",0,-1); + // Attach a file ? + $file=''; + $listofpaths=array(); + $listofnames=array(); + $listofmimes=array(); + if (is_object($object->invoice)) + { + $invoicediroutput = $conf->facture->dir_output; + $fileparams = dol_most_recent_file($invoicediroutput . '/' . $object->invoice->ref, preg_quote($object->invoice->ref, '/').'[^\-]+'); + $file = $fileparams['fullname']; + + $listofpaths=array($file); + $listofnames=array(basename($file)); + $listofmimes=array(dol_mimetype($file)); + } + + $result=$object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofnames, $listofmimes, "", "", 0, -1); if ($result < 0) { $errmsg=$object->error; - setEventMessages($errmsg, null, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } + else + { + setEventMessages($langs->trans("EmailSentToMember", $object->email), null, 'mesgs'); + } + } + else + { + setEventMessages($langs->trans("NoEmailSentToMember"), null, 'mesgs'); } } @@ -998,7 +1031,7 @@ if ($rowid > 0) $helpcontent.=''.$langs->trans("MailText").':
'; $helpcontent.=dol_htmlentitiesbr($texttosend)."\n"; - print $form->textwithpicto($tmp,$helpcontent,1,'help'); + print $form->textwithpicto($tmp, $helpcontent, 1, 'help', '', 0, 2, 'helpemailtosend'); } print ''; print ''; diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 8aa7f0ce54e..40274b00b76 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -148,16 +148,19 @@ class FormMail extends Form * Add a file into the list of attached files (stored in SECTION array) * * @param string $path Full absolute path on filesystem of file, including file name - * @param string $file Only filename - * @param string $type Mime type + * @param string $file Only filename (can be basename($path)) + * @param string $type Mime type (can be dol_mimetype($file)) * @return void */ - function add_attached_files($path,$file,$type) + function add_attached_files($path, $file='', $type='') { $listofpaths=array(); $listofnames=array(); $listofmimes=array(); + if (empty($file)) $file=basename($path); + if (empty($type)) $type=dol_mimetype($file); + $keytoavoidconflict = empty($this->trackid)?'':'-'.$this->trackid; // this->trackid must be defined if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';',$_SESSION["listofpaths".$keytoavoidconflict]); if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';',$_SESSION["listofnames".$keytoavoidconflict]); diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 2a98f700027..bfa338605f2 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -176,4 +176,7 @@ VATToUseForSubscriptions=VAT rate to use for subscriptions NoVatOnSubscription=No TVA for subscriptions MEMBER_PAYONLINE_SENDEMAIL=Email to use for email warning when Dolibarr receive a confirmation of a validated payment for a subscription (Example: paymentdone@example.com) ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS=Product used for subscription line into invoice: %s -NameOrCompany=Name or company \ No newline at end of file +NameOrCompany=Name or company +SubscriptionRecorded=Subscription recorded +NoEmailSentToMember=No email sent to member +EmailSentToMember=Email sent to member at %s \ No newline at end of file diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 83b672604cc..285bf2920eb 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -374,6 +374,8 @@ if ($ispaymentok) if ($option == 'bankdirect') $postactionmessages[] = 'Bank record created'; if ($option == 'invoiceonly') $postactionmessages[] = 'Invoice recorded'; $ispostactionok = 1; + + // If an invoice was created, it is into $object->invoice } } @@ -395,13 +397,34 @@ if ($ispaymentok) $subjecttosend=$object->makeSubstitution($conf->global->ADHERENT_MAIL_COTIS_SUBJECT); $texttosend=$object->makeSubstitution($adht->getMailOnSubscription()); - $result=$object->send_an_email($texttosend,$subjecttosend,array(),array(),array(),"","",0,-1); + // Attach a file ? + $file=''; + $listofpaths=array(); + $listofnames=array(); + $listofmimes=array(); + if (is_object($object->invoice)) + { + $invoicediroutput = $conf->facture->dir_output; + $fileparams = dol_most_recent_file($invoicediroutput . '/' . $object->invoice->ref, preg_quote($object->invoice->ref, '/').'[^\-]+'); + $file = $fileparams['fullname']; + + $listofpaths=array($file); + $listofnames=array(basename($file)); + $listofmimes=array(dol_mimetype($file)); + } + + $result=$object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofnames, $listofmimes, "", "", 0, -1); if ($result < 0) { $errmsg=$object->error; $postactionmessages[] = $errmsg; $ispostactionok = -1; } + else + { + if ($file) $postactionmessages[] = 'Email sent to member (with invoice document attached)'; + else $postactionmessages[] = 'Email sent to member (without any attached document)'; + } } } } @@ -601,7 +624,7 @@ if ($ispaymentok) $content=""; if (in_array('MEM', array_keys($tmptag))) { - $url=$urlwithroot."/adherents/card_subscriptions.php?rowid=".$tmptag['MEM']; + $url=$urlwithroot."/adherents/subscription.php?rowid=".$tmptag['MEM']; $content.=''.$companylangs->trans("PaymentSubscription")."

\n"; $content.=$companylangs->trans("MemberId").': '.$tmptag['MEM']."
\n"; $content.=$companylangs->trans("Link").': '.$url.''."
\n"; diff --git a/htdocs/public/paypal/paymentok.php b/htdocs/public/paypal/paymentok.php index 80ec1d8ec2b..d50dd66d903 100644 --- a/htdocs/public/paypal/paymentok.php +++ b/htdocs/public/paypal/paymentok.php @@ -212,7 +212,7 @@ if ($PAYPALTOKEN) if (! empty($tmptag['MEM'])) { $langs->load("members"); - $url=$urlwithroot."/adherents/card_subscriptions.php?rowid=".$tmptag['MEM']; + $url=$urlwithroot."/adherents/subscriptions/card.php?rowid=".$tmptag['MEM']; $content.=$langs->trans("PaymentSubscription")."
\n"; $content.=$langs->trans("MemberId").': '.$tmptag['MEM']."
\n"; $content.=$langs->trans("Link").': '.$url.''."
\n";