I am trying to send a receipt (bill/ expense) as a draft to the Xero, but what ever I try and do, I am getting an error. Basically, I want to upload the receipt( the invoice sent by the supplier), enter the Name of the supplier, Amount to pay, Invoice Number from the supplier and our reference code merged (eg: Inv Num / Ref as 987/ 123), due date, and a small description like 1 dozen blue ball pens.
Can you please guide me how to solve this issue please.
$invoice= new \XeroPHP\Models\Accounting\Receipt();
$xcontact= new \XeroPHP\Models\Accounting\Contact();
$xcontact->setName('Test Contact');
$xcontact->setFirstName('Test');
$xcontact->setLastName('Contact');
$xcontact->setEmailAddress('amo.chohan#gmail.com');
$xcontact->setDefaultCurrency('AUD');
$invoice->setContact($xcontact);
// till the above code, things are working fine but having issues here)
$invoice->setTotal('300.00');
$dateInstance = new DateTime();
$invoice->setDate($dateInstance);
$invoice->setReceiptNumber('987/');
$invoice->setReference('123');
i was trying to send the info but giving me an error as:
Call to undefined method XeroPHP\Models\Accounting\Receipt::setReceiptNumber()
and if comment the setReceiptNumber(); I get the following error as:
XeroPHP\Models\Accounting\Receipt::$LineItems is mandatory and is
either missing or empty.
Not too sure how can I send the Bills to the Xero.
Thanks for your time.
Use sendEmail() function to send email.
$invoice->sendEmail();
Related
I am using the gabrielbull ups api wrapper and it is working fine, except when I want to add an UPS access point; the documentation says I have to declare a "AlternateDeliveryAddress". The access point data should then be printed on the ups label, but they are not appearing.
Since there isn't an example for this case on the wrapper GitHub page, I searched for methods on my own and found one but I have the feeling I forgot something since I don't receive any errors. I tried this code for the specific part. The surrounding code is like in the shipping class example
$address = new \Ups\Entity\Address();
$address->setAddressLine1($ap_addressline1);
$address->setPostalCode($ap_postal);
$address->setCity($ap_city);
$address->setCountryCode($ap_country);
$alternateTo = new \Ups\Entity\AlternateDeliveryAddress;
$alternateTo->setAddress($address);
$alternateTo->setUpsAccessPointId($ap_id);
$alternateTo->setName($ap_name);
$alternateTo->setAttentionName($ap_name);
$shipment->setAlternateDeliveryAddress($alternateTo);
Edit: I got this info of setting up the accesspoint from UPS support. The guy told me to set an alternate address with the AccessPoint data that will be printed at the bottom line of the label (where it's currently missing). If I misunderstood something (though we did a video conference and he showed me the result) and you know another way, feel free to tell me.
Ok after re-reading the official docs I found out what was missing.
If you want to use an accesspoint as address you also have to set the Indication Type via setShipmentIndicationType. There are 2 codes: 01 and 02 depending on the way you want to send it. Ofcourse I didn't add them before...
I haven't finished it yet because I get some errors but that's more about what information ups needs from me and so on. At least I can work with that.
As I mentioned in my initial post I used the example of the api wrapper as base and insert the required part before the request was send:
...
// Set Reference Number
...
// this is the part where you set shipment indication type for the accesspoint
$accesspoint = new \Ups\Entity\ShipmentIndicationType;
$accesspoint->setCode(Ups\Entity\ShipmentIndicationType::CODE_HOLD_FOR_PICKUP_ACCESS_POINT); // for "01"
#$accesspoint->setCode(Ups\Entity\ShipmentIndicationType::CODE_ACCESS_POINT_DELIVERY); // for "02"
$shipment->setShipmentIndicationType($accesspoint);
// Set payment information
...
// Ask for negotiated rates (optional)
...
// Get shipment info
...
I am trying to create Passenger Name Record using Create Passenger Name Record API of Sabre. But When I pass information fetched from BargainFinderMax API to Passenger Name Record API, It gives the following error. It happens in some requests.
Please find below my Request Sample Flight segment part
"OriginDestinationInformation":{
"FlightSegment":[
{
"Status":"NN",
"MarriageGrp":"O",
"FlightNumber":"206",
"NumberInParty":"2",
"OriginLocation":{
"LocationCode":"JFK"
},
"ArrivalDateTime":"2018-09-15T22:10:00",
"MarketingAirline":{
"Code":"EK",
"FlightNumber":"206"
},
"ResBookDesigCode":"U",
"DepartureDateTime":"2018-09-14T22:20:00",
"DestinationLocation":{
"LocationCode":"DXB"
}
},{
"Status":"NN",
"MarriageGrp":"I",
"FlightNumber":"604",
"NumberInParty":"2",
"OriginLocation":{
"LocationCode":"DXB"
},
"ArrivalDateTime":"2018-09-16T05:30:00",
"MarketingAirline":{
"Code":"EK",
"FlightNumber":"604"
},
"ResBookDesigCode":"U",
"DepartureDateTime":"2018-09-16T02:30:00",
"DestinationLocation":{
"LocationCode":"KHI"
}
}
]
}
Below is the response with error that I receive from the API.
{"CreatePassengerNameRecordRS":{"ApplicationResults":{"status":"NotProcessed","Error":[{"type":"BusinessLogic","timeStamp":"2018-09-11T08:45:51.946-05:00","SystemSpecificResults":[{"Message":[{"code":"ERR.SWS.HOST.ERROR_IN_RESPONSE","content":"Unable to perform air booking step"}]}]}],"Warning":[{"type":"Application","timeStamp":"2018-09-11T08:45:51.946-05:00","SystemSpecificResults":[{"Message":[{"code":"WARN.SP.PROVIDER_ERROR","content":"EnhancedAirBookRQ: CODE - UC SEG STATUS NOT ALLOWED-0003"}]}]}]}},"Links":[{"rel":"self","href":"https://api.test.sabre.com/v2.1.0/passenger/records?mode=create"},{"rel":"linkTemplate","href":"https://api.test.sabre.com//passenger/records?mode="}]}
could you please guide me why this happens. please also note that I am sending this request from PHP using CURL. In some cases booking is successfully completed.
Thanks in advance.
This is normal, but the rate of getting is UC code should be less than 10%.
Possible reasons could be
Your PCC is blocked. Which is not the case with you because you are not getting this code on all requests.
The airline when you are booking becomes unavailable or the seat is taken before you confirm your PNR
The issue also comes in some coshare flights where partnered airlines have some issues
This is normal behavior and depends on the flights you use, at the moment of booking them they may not be available anymore. cURL and PHP do not affect this in any way. Are you obtaining this flight combination from BFM or an availability request?
As this workflow is notorious unstable, i recommend you using the SOAP Enhanced Airbook + Passenger Details. I have not heared of anybody that is using create PNR in production yet.
I created two group one is A and other is B . i want there multiple option as each have different prices as acording to customer group i have some code but it does not run properly it give a message as "Call to undefined method Cart\Customer::getCustomerGroupId() in C:\xampp\htdocs\postal\vqmod\vqcache\vq2-catalog_model_catalog_product.php on line 340".
the code is in vqmod xml file -enter code here
problem is there i can not know how to definde customer group id and this code is running in old version perfectly
the code is attach in link -- product-option by download-customer group
please check this and send me how to define and fix the bug.
the code run proper before login- wen i login then give error message.
I suggest to modify system\library\cart\customer.php to:
/create a function/
public function getCustomerGroupId() {
return $this->customer_group_id;
}
Banging my head for the last two days but unable to achieve this. Help!!
Whenever a shipment email is communicated I want to trigger a code which will send a SMS to the customer informing him/her that his order has been dispatched and also communicate the tracking number.
The code will be something like this:
<?php
$url = "http://www.abcde.in/binapi/pushsms.php?usr=xyz&pwd=abc&sndr=MEGYTR&ph=8888829554&text=This is test. MegaYtr&rpt=1";
$result = file_get_contents($url);
?>
Questions:
1) From where do I run this code?
2) How do I get additional info like Order Number, Customer Name, Grand Total & Tracking Number. I had done something similar for sending SMS when customer places order at that I used this code:
$order_id = Mage::getSingleton('checkout/session')->getLastRealOrderId();
$order_details = Mage::getModel('sales/order')->loadByIncrementId($order_id);
$shipping_address_data = $order_details->getShippingAddress();
$first_name = $shipping_address_data['firstname'];
$telephone = $shipping_address_data['telephone'];
$amount_paid = $order_details->total_paid;
$message = 'Dear '.$first_name.' thank you for shopping at abc.com. Your order'.$this->getOrderId().' amounting to Rs.'.$amount_paid.'is being processed.';
echo '<b>'.$message.' Please check your email for further details.</b>';
I am using Magento Community 1.7.0.1.
try this
i would like to give you an simple solution without need of modifying core files.
for that you need to create an observer for SuccessAction below is the event that will trigger your code when an order is successfull
checkout_onepage_controller_success_action
this will help you in creating observer for the above event create observer using this
one more thing i would like to add is in the controller at location Mage/Checkout/OnepageController search for successAction, this is the Action which is processed on the succes of order. Here on line 240 if you comment $session->clear(); than you would not require to place order again and again, just by refreshing the page you can check your changes.
And lastly FYI above event will dispatch orderId by using that you can load the order object, for doing that the below is the code
//load order object
$_order = Mage::getModel('sales/order')->loadByIncrementId($order_id_from_observer);
(I'm a first time poster, so please forgive my lack of proper formatting, and if this question has already been answered in some form or fashion)
Issue: Shopify API - Partial Refund On Order Through Creation of A New Transaction(opposed to simply cancelling the order)
Reason: Give customer partial refund without cancelling the order
Problem: The Query Crashes at the point of sending the 'Create Transaction' into the shopify api, no errors, try and catch are not initiated, and the code after the query to shopify is ignored as well.
Shopify Developer API XML/JSON for Transactions:
http://api.shopify.com/transactions.html
Currently using Sandeepsheety's PHP API Code:
https://github.com/sandeepshetty/shopify.php/blob/master/README.md
<?php
//-------------------------------------------------------------------------------
//PHP Code Begins
//NOTE: [Does return correct values for the Order through GET through id=135264996 and,
// transaction GET data is verified as well - Test Order Total = $94.50 and,
// tested a few other orders ids with the same result.]
//-------------------------------------------------------------------------------
//Does connect and I have verified with a few GETS and even a couple cancellations
$shopify = shopify_api_client($SHOPIFY_STORE_URL, NULL, $SHOPIFY_API_KEY, $SHOPIFY_TOKEN, true);
//Based on Create Transactions: (POST /admin/orders/#{id}/transactions.json)
$jsonURL= "/admin/orders/135264996/transactions.json";
$query = $shopify('POST', $jsonURL, array('kind'='refund', 'amount'=10));
//NOTHING HAPPENS and Code Stops HERE
echo "Passed"; //IGNORED
?>
The Transaction API only supports 'capture' as the kind. The server is returning a 403 Forbidden, with text "Only capturing is currently supported".
shopify.php must not be handling that error properly but that is the issue you're running into.