12 class ExpressAuthorizeRequest
extends AbstractRequest
29 return $this->
setParameter(
'callbackTimeout', $callbackTimeout);
73 if (!empty($callback)) {
76 if (empty($shippingOptions)) {
78 'When setting a callback for the Instant Update API you must set shipping options'
82 foreach ($shippingOptions as $shippingOption) {
83 if ($shippingOption->isDefault()) {
91 'One of the supplied shipping options must be set as default'
100 $this->
validate(
'amount',
'returnUrl',
'cancelUrl');
104 $data[
'METHOD'] =
'SetExpressCheckout';
105 $data[
'PAYMENTREQUEST_0_PAYMENTACTION'] =
'Authorization';
106 $data[
'PAYMENTREQUEST_0_AMT'] = $this->
getAmount();
107 $data[
'PAYMENTREQUEST_0_CURRENCYCODE'] = $this->
getCurrency();
128 if (!empty($callback)) {
129 $data[
'CALLBACK'] = $callback;
138 if (!empty($shippingOptions)) {
139 foreach ($shippingOptions as $index => $shipping) {
140 $data[
'L_SHIPPINGOPTIONNAME' . $index] = $shipping->getName();
141 $data[
'L_SHIPPINGOPTIONAMOUNT' . $index] = number_format($shipping->getAmount(), 2);
142 $data[
'L_SHIPPINGOPTIONISDEFAULT' . $index] = $shipping->isDefault() ?
'1' :
'0';
144 if ($shipping->hasLabel()) {
145 $data[
'L_SHIPPINGOPTIONLABEL' . $index] = $shipping->getLabel();
152 $data[
'PAYMENTREQUEST_0_TAXAMT'] = $this->
getTaxAmount();
161 $data[
'PAYMENTREQUEST_0_SHIPTONAME'] = $card->getName();
162 $data[
'PAYMENTREQUEST_0_SHIPTOSTREET'] = $card->getAddress1();
163 $data[
'PAYMENTREQUEST_0_SHIPTOSTREET2'] = $card->getAddress2();
164 $data[
'PAYMENTREQUEST_0_SHIPTOCITY'] = $card->getCity();
165 $data[
'PAYMENTREQUEST_0_SHIPTOSTATE'] = $card->getState();
166 $data[
'PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE'] = $card->getCountry();
167 $data[
'PAYMENTREQUEST_0_SHIPTOZIP'] = $card->getPostcode();
168 $data[
'PAYMENTREQUEST_0_SHIPTOPHONENUM'] = $card->getPhone();
169 $data[
'EMAIL'] = $card->getEmail();
173 if ($billingAgreement) {
174 $data[
'L_BILLINGTYPE0'] = $billingAgreement->getType();
175 $data[
'L_BILLINGAGREEMENTDESCRIPTION0'] = $billingAgreement->getDescription();
177 if ($billingAgreement->hasPaymentType()) {
178 $data[
'L_PAYMENTTYPE0'] = $billingAgreement->getPaymentType();
181 if ($billingAgreement->hasCustomAnnotation()) {
182 $data[
'L_BILLINGAGREEMENTCUSTOM0'] = $billingAgreement->getCustomAnnotation();