Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Exception when trying to apply Credit Card Payment to Sales Receipt #517

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/Data/IPPSalesReceipt.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@ public function __construct($keyValInitializers=array(), $verbose=FALSE)
* @var float
*/
public $LessCIS;

/**
* @Definition
Product: ALL
Description Information about a credit card payment for the Recipet.
NotApplicableTo: Estimate, SalesOrder
* @xmlType element
* @xmlNamespace http://schema.intuit.com/finance/v3
* @xmlMinOccurs 0
* @xmlName SalesReceiptCCPayment
* @var com\intuit\schema\finance\v3\IPPCreditCardPayment
*/
public $SalesReceiptCCPayment;

} // end class IPPSalesReceipt
4 changes: 3 additions & 1 deletion src/Facades/FacadeClassMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ public static function OtherAntiPatternNameEntity(){
'AdjustmentTaxRateList' => 'TaxRateList',
//Use JournalEntryEntity to replace Entity
'JournalEntryEntity' => 'EntityTypeRef',
'ScheduleInfo' => 'RecurringScheduleInfo'
'ScheduleInfo' => 'RecurringScheduleInfo',
// Sales Receipt mapping
'SalesReceiptCCPayment' => 'CreditCardPayment',
];
}

Expand Down
8 changes: 5 additions & 3 deletions src/Facades/FacadeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,14 +433,16 @@ private static function assignValue($targetObject, $key, $value){
$reflectionClassOfTargetObject = new \ReflectionClass($targetObject);
if(strcasecmp($key, "JournalEntryEntity") == 0){
$key = "Entity";
}else if(strcasecmp($key, "JournalEntryType") == 0){
} else if(strcasecmp($key, "JournalEntryType") == 0){
$key = "Type";
} else if(strcasecmp($key, "SalesReceiptCCPayment") == 0){
$key = "CreditCardPayment";
}
$property = $reflectionClassOfTargetObject->getProperty($key);
if($property instanceof \ReflectionProperty){
if($property instanceof \ReflectionProperty) {
$value = FacadeHelper::convertValueTypeToAppropriateString($value);
$property->setValue($targetObject,$value);
}else{
} else {
throw new \Exception("No Reflection Property Found.");
}
}
Expand Down