mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-18 11:30:55 +01:00
Fix a bug with creating Phortune merchant accounts without applying an email address transaction and some null field issues
Summary: When Phortune merchant accounts are created via mechanisms other than the web UI (for example, by Phacility unit tests) this validation check may fail. Transactions are validated even if no transactions of the given type are being applied, to allow the editor to raise errors like "Name is required!". If there's no TYPE_INVOICEEMAIL transaction, we'll get called with empty `$xactions` and fail on `strlen($new_email)` because the variable is never defined. As a secondary issue, if contactInfo, invoiceEmail or invoiceFooter are not provided the record will fail to insert (none of these are nullable). Test Plan: Ran Phacility unit tests, got a clean result for new instance creation. Reviewers: chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D16798
This commit is contained in:
parent
0f1785c0aa
commit
c2565d5e24
2 changed files with 5 additions and 1 deletions
|
@ -134,6 +134,7 @@ final class PhortuneMerchantEditor
|
|||
}
|
||||
break;
|
||||
case PhortuneMerchantTransaction::TYPE_INVOICEEMAIL:
|
||||
$new_email = null;
|
||||
foreach ($xactions as $xaction) {
|
||||
switch ($xaction->getTransactionType()) {
|
||||
case PhortuneMerchantTransaction::TYPE_INVOICEEMAIL:
|
||||
|
|
|
@ -19,7 +19,10 @@ final class PhortuneMerchant extends PhortuneDAO
|
|||
public static function initializeNewMerchant(PhabricatorUser $actor) {
|
||||
return id(new PhortuneMerchant())
|
||||
->setViewPolicy(PhabricatorPolicies::getMostOpenPolicy())
|
||||
->attachMemberPHIDs(array());
|
||||
->attachMemberPHIDs(array())
|
||||
->setContactInfo('')
|
||||
->setInvoiceEmail('')
|
||||
->setInvoiceFooter('');
|
||||
}
|
||||
|
||||
protected function getConfiguration() {
|
||||
|
|
Loading…
Reference in a new issue