Skip to content

Commit

Permalink
Express Checkout - Billing Agreements, ref #168
Browse files Browse the repository at this point in the history
  • Loading branch information
jigneshkailam committed Jun 19, 2015
1 parent 0010bf7 commit 27fd7f8
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions classes/wc-gateway-paypal-express-angelleye.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,15 @@ function init_form_fields() {
'label' => __('Enable logging <code>/wp-content/uploads/wc-logs/paypal_express-{tag}.log</code>', 'paypal-for-woocommerce'),
'default' => 'no'
),

'billing_agreement_express' => array(
'title' => __('Billing Agreement', 'paypal-for-woocommerce'),
'type' => 'checkbox',
'label' => __('Enable billing agreement', 'paypal-for-woocommerce'),
'default' => 'no'
),


'error_email_notify' => array(
'title' => __('Error Email Notifications', 'paypal-for-woocommerce'),
'type' => 'checkbox',
Expand Down Expand Up @@ -1564,25 +1573,36 @@ function CallSetExpressCheckout($paymentAmount, $returnURL, $cancelURL, $usePayP
'l_shippingoptionamount' => '' // Shipping option amount. Required if specifying the Callback URL.
);
array_push($ShippingOptions, $Option);

global $pp_settings, $pp_pro, $pp_payflow;
$BillingAgreements = array();

$Item = array(
'l_billingtype' => '', // Required. Type of billing agreement. For recurring payments it must be RecurringPayments. You can specify up to ten billing agreements. For reference transactions, this field must be either: MerchantInitiatedBilling, or MerchantInitiatedBillingSingleSource
'l_billingtype' => 'MerchantInitiatedBilling', // Required. Type of billing agreement. For recurring payments it must be RecurringPayments. You can specify up to ten billing agreements. For reference transactions, this field must be either: MerchantInitiatedBilling, or MerchantInitiatedBillingSingleSource
'l_billingagreementdescription' => '', // Required for recurring payments. Description of goods or services associated with the billing agreement.
'l_paymenttype' => '', // Specifies the type of PayPal payment you require for the billing agreement. Any or IntantOnly
'l_paymenttype' => 'Any', // Specifies the type of PayPal payment you require for the billing agreement. Any or IntantOnly
'l_billingagreementcustom' => '' // Custom annotation field for your own use. 256 char max.
);

array_push($BillingAgreements, $Item);

$PayPalRequestData = array(
if (isset($pp_settings['billing_agreement_express']) && ($pp_settings['billing_agreement_express'] == 'yes')) {
$PayPalRequestData = array(
'SECFields' => $SECFields,
'SurveyChoices' => $SurveyChoices,
'Payments' => $Payments,
//'BuyerDetails' => $BuyerDetails,
//'ShippingOptions' => $ShippingOptions,
'BillingAgreements' => $BillingAgreements,
);
} else {
$PayPalRequestData = array(
'SECFields' => $SECFields,
'SurveyChoices' => $SurveyChoices,
'Payments' => $Payments,
//'BuyerDetails' => $BuyerDetails,
//'ShippingOptions' => $ShippingOptions,
//'BillingAgreements' => $BillingAgreements
);
// 'BillingAgreements' => $BillingAgreements,
);
}

// Rounding amendment

Expand Down

0 comments on commit 27fd7f8

Please sign in to comment.