Wordpress WooCommerce FedEx Plugin Adult Shipping - php

I am trying to set the adult signature on the FedEx Plugin for Woocommerce. I have tried the code another question posted here: php fedex set signature Label ADULT
They said that they resolved the issue with this coding
$item['SpecialServicesRequested'] = array(
'SpecialServiceTypes' => 'SIGNATURE_OPTION',
'SignatureOptionDetail' => array(
'OptionType' => 'ADULT'
)
);
$request['RequestedShipment']['RequestedPackageLineItems'][] = $item;
But I don't know why it ins't working. I am not 100% sure where to put this code but when I add it to the woocommerce-shipping-fedex/shipping-fedex.php it doesn't do anything.
Any Ideas?
To see this in progress go to christinagriffis.com/landonstaging

Thanks...I'm not sure, but just try this below one. U will find the addSpecialServices() function in shipwebseriviceclient.php5 page.[this is FedEx Shipping integration library file ].
function addSpecialServices(){
$specialServices = array(
'SpecialServiceTypes' => array('COD'),
'CodDetail' => array(
'CodCollectionAmount' => array('Currency' => 'USD', 'Amount' => 150),
'CollectionType' => 'ANY')// ANY.
GUARANTEED_FUNDS
);
return $specialServices;
}

Related

mindbody-php-api for stored credit card payment?

I am using mindbody api for payment, when I add my credit card detail then payment is successful but when I am using stored(existing) card for payment then it's given error :
Card Authorization Failed mb.Core.BLL.Transaction failed validation Could not determine the type of credit card.
my code is:
$shoppingCart = array(
'ClientID' => $client_id,
'Test' => false,
'InStore' => true, //add by NIK
'CartItems' => array(
'CartItem' => array(
'Quantity' => $product_qty,
'Item' => new SoapVar(
array('ID' => $product_id), SOAP_ENC_ARRAY, 'Service', 'http://clients.mindbodyonline.com/api/0_5'
),
'DiscountAmount' => 0
)
),
'Payments' => array(
'PaymentInfo' => new SoapVar(
array(
'LastFour'=>$clientCreditCard->LastFour,
'Amount'=>round($OnlinePrice, 2),
),
SOAP_ENC_ARRAY,
'StoredCardInfo',
'http://clients.mindbodyonline.com/api/0_5'
),
)
);
please give any solution for it, what should I do or send extra parameter.
thanks!
Shouldn't it look more like this?
'Payments' => array(
'PaymentInfo' => new SoapVar(
array(
'CreditCardNumber'=>'4111111111111111',
'ExpYear'=>'2015',
'ExpMonth'=>'06',
'Amount'=>'130',
'BillingAddress'=>'123 Happy Ln',
'BillingPostalCode'=>'93405'
),
SOAP_ENC_ARRAY,
'CreditCardInfo',
'http://clients.mindbodyonline.com/api/0_5'
)
Taken from this README.md https://github.com/devincrossman/mindbody-php-api
Your shopping cart array with saved card is correctly constructed.
I've been struggling with exactly the same problem for the last few days, and I found that the error in my case was that the front end account page was passing the credit card number with spaces in the string - the front end form was automatically adding the spaces for the usual format/usability reasons in the admin part of the application where the saved card details are entered.
I solved it by stripping out the spaces in PHP : str_replace(" ", "", $_POST['cardnumber']) in the card save function.
Once I did that the saved card payment process worked fine.

Fedex how to set preferred currency in PHP

Fedex seems to have very intuitive documentation and no code samples (besides the downloaded modules). I want to change the currency for the rates from fedex. In documentation/XML file I have found something like preferredCurrency. Similar to other attributes I'm trying to set it like this:
if($var == 'preferredcurrency') Return 'HUF';
but this is totally ignored (I tried also PreferredCurrency) and the returned rate is always $USD. Anyone is familiar with FEDEX API and can help?
UPDATE:
It's basically about requesting and receiving response. I have some function where I set parameters like:
function getProperty($var){
if($var == 'shipper') Return array(
'Contact' => array(
'PersonName' => 'Sender Name',
'CompanyName' => 'Sender Company Name',
'PhoneNumber' => '1234567890'
),
'Address' => array(
'StreetLines' => array('Address Line 1'),
'City' => 'SomeCity',
'StateOrProvinceCode' => 'SomeState',
'PostalCode' => '3434343',
'CountryCode' => 'US',
'Residential' => 1
)
);
}
and then in another file a request to fedex is made, like :
$request['RequestedShipment']['Shipper'] = array(
'Address'=>getProperty('address1')
);
All of this values are defined in an XML file, I'm trying to get rate including CurrencyExchangeRate like this:
$request['CurrencyExchangeRate'] = array(
'FromCurrency' => array('USD'),
'IntoCurrency' => array('HUF'),
'Rate' => array(1.0)
);
But this request is ignored and I don't know why.
Maybe you just have a misssing Element. The Docs are here: Shipment Docs.
$request['RequestedShipment']['PreferredCurrency'] = 'HUF' and
$request['RequestedShipment']['RateRequestTypes'] = 'PREFERRED'

php fedex set signature Label ADULT

I am working on wordpress site and using woocommerce extension http://www.woothemes.com/products/fedex-shipping-module/
I am Passing the values Signature value to adults. But it is not working
Please correct me where i am wrong
$request['RequestedShipment']['RateRequestTypes'] = $this->request_type;
$request['RequestedShipment']['PackageDetail'] = 'INDIVIDUAL_PACKAGES';
$request['RequestedShipment']['SpecialServicesRequested'][] = array(
'SpecialServiceTypes' => 'SIGNATURE_OPTION',
'SignatureOptionDetail' => array(
'OptionType' => 'ADULT'
)
);
`
Do i need to change something from the from the RateService_v13.wsdl file
Please suggest
Thanks
I resolved this issue
For further user having the same issue can resolve this by below code
$item['SpecialServicesRequested'] = array(
'SpecialServiceTypes' => 'SIGNATURE_OPTION',
'SignatureOptionDetail' => array(
'OptionType' => 'ADULT'
)
);
$request['RequestedShipment']['RequestedPackageLineItems'][] = $item;
If Suppose anyone is using Fedex Integration with Laravel you may use below code.
In place of _DIRECT you may use _ADULT or any other option.
$packageLineItem1 = new FedexShipServiceCT\RequestedPackageLineItem();
$packageLineItem1
->setSequenceNumber(1)
->setItemDescription('Product')
->setSpecialServicesRequested(new FedexShipServiceCT\PackageSpecialServicesRequested(array(
'SignatureOptionDetail' => new FedexShipServiceCT\SignatureOptionDetail(array(
'OptionType' => FedexShipServiceST\SignatureOptionType::_DIRECT
))
)))
->setDimensions(new FedexShipServiceCT\Dimensions(array(
'Width' => 1,
'Height' => 1,
'Length' => 1,
'Units' => FedexShipServiceST\LinearUnits::_IN
)))
->setWeight(new FedexShipServiceCT\Weight(array(
'Value' => 1,
'Units' => FedexShipServiceST\WeightUnits::_LB
)));
Thanks

Create a Coupon In BigCommerce Using API

I am trying to create a coupon in big commerce using their API. I am using the following code after connecting with the store.
$coupon = array('name' => 'somecoupon', 'type' => 'percentage_discount', 'amount' => '50.0', 'code' => '50off', 'enabled' => true);
echo Bigcommerce::createCoupon($coupon);
I simply copied the code from their
Support Page
All the other codes on that page work but create coupon doesnt work. If I use get coupons codes, they work perfectly but creating coupon is not working what so ever. Any ideas on this?
Any help would be highly appreciated.
Thanks
The developer page neglects to mention that 'applies_to' is also a required field, hence why your code is failing.
Try
$coupon = array('name' => 'somecoupon', 'type' => 'percentage_discount', 'amount' => '50.0', 'code' => '50off', 'enabled' => true, 'applies_to'=> array('entity' => 'categories', 'ids' => array('value' => 0)));
echo Bigcommerce::createCoupon($coupon);

PayPal Order Summary Using REST API - - cURL or PHP

I am working with the PayPal RESTful API.
https://developer.paypal.com/webapps/developer/docs/api/
How can I pass my consumers order items and purchase description to PayPal, so when my user is redirected to PayPal to approve the order by logging in, their order summary will show up on the left.
.
.
ORDER SUMMARY ON THE LEFT
I have tried to passing in the transactions.item_list.items but that information isn't showing up in the order summary still.
Any help how to get an order summary to appear on the paypal approval page using the PayPal RESTful API?
I haven't been to pleased with their documentation as it is lacking some information and also has a few mistakes which wasted decent amount of my time to debug.
//
// prepare paypal data
$payment = array(
'intent' => 'sale',
'redirect_urls' => array(
'return_url' => $url_success,
'cancel_url' => $url_cancel,
),
'payer' => array(
'payment_method' => 'paypal'
)
);
//
// prepare basic payment details
$payment['transactions'][0] = array(
'amount' => array(
'total' => '0.03',
'currency' => 'USD',
'details' => array(
'subtotal' => '0.02',
'tax' => '0.00',
'shipping' => '0.01'
)
),
'description' => 'This is the payment transaction description 1.'
);
//
// prepare individual items
$payment['transactions'][0]['item_list']['items'][] = array(
'quantity' => '1',
'name' => 'Womens Large',
'price' => '0.01',
'currency' => 'USD',
'sku' => '31Wf'
);
$payment['transactions'][0]['item_list']['items'][] = array(
'quantity' => '1',
'name' => 'Womens Medium',
'price' => '0.01',
'currency' => 'USD',
'sku' => '31WfW'
);
//
//format payment array to pass to cURL
$CURL_POST = json_encode($payment);
your code is good. This is actually a bug that will be fixed very soon. Regarding documentation, can you share how we can make it better? I want to make sure your feedback gets passed to our documentation team.
I experienced the same issue while trying it out today. What I did was add the Items like below.
$item = new Item();
$item->setQuantity($item_quantity);
$item->setName($item_name);
$item->setPrice($item_price);
$item->setCurrency($item_currency);
$item_list = new ItemList();
$item_list->setItems(array($item));
The $item_list is a property of transaction so you should add it after.
$transaction = new Transaction();
$transaction->setItemList($item_list);
....
That should show on the Order summary pane on PayPal page.
You can also check the answer here.
Try using the sample shown here : http://htmlpreview.github.io/?https://raw.githubusercontent.com/paypal/PayPal-PHP-SDK/master/sample/doc/payments/CreatePaymentUsingPayPal.html
It is a sample that comes along with the PayPal REST API SDK. You can try those samples out yourselves, by following instructions on readme.
This is how it would look like, when you run that sample:

Categories