Skip to content

Commit

Permalink
ClickBank IPN v6 compat. See: wpsharks/s2member#256
Browse files Browse the repository at this point in the history
  • Loading branch information
JasWSInc committed Oct 2, 2014
1 parent c19891e commit 69a09e9
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public static function clickbank_notify()

$ipn['txn_type'] = 'subscr_signup';
$ipn['subscr_id'] = $s2vars['s2_subscr_id'];
$ipn['recurring'] = $clickbank['lineItems'][0]->paymentPlay->paymentsRemaining > 0 ? '1' : '0';
$ipn['recurring'] = $clickbank['lineItems'][0]->paymentPlan->paymentsRemaining > 0 ? '1' : '0';

$ipn['txn_id'] = $clickbank['receipt'];

Expand All @@ -133,7 +133,7 @@ public static function clickbank_notify()
$ipn['period3'] = $s2vars['s2_p3'];

$ipn['mc_amount1'] = number_format($clickbank['totalOrderAmount'], 2, '.', '');
$ipn['mc_amount3'] = number_format($clickbank['lineItems'][0]->paymentPlay->rebillAmount, 2, '.', '');
$ipn['mc_amount3'] = number_format($clickbank['lineItems'][0]->paymentPlan->rebillAmount, 2, '.', '');

$ipn['mc_gross'] = (preg_match('/^[1-9]/', $ipn['period1'])) ? $ipn['mc_amount1'] : $ipn['mc_amount3'];

Expand Down Expand Up @@ -238,8 +238,8 @@ public static function clickbank_notify()

c_ws_plugin__s2member_utils_urls::remote(home_url('/?s2member_paypal_notify=1'), $ipn, array('timeout' => 20));
}
if( // Here we handle Recurring cancellations, and/or EOT (End Of Term) through $clickbank['lineItems'][0]->paymentPlay->rebillStatus.
(preg_match('/^(?:TEST_)?(?:SALE|BILL)$/i', $clickbank['transactionType']) && $clickbank['lineItems'][0]->recurring && (preg_match('/^COMPLETED$/i', $clickbank['lineItems'][0]->paymentPlay->rebillStatus) || $clickbank['lineItems'][0]->paymentPlay->paymentsRemaining <= 0) && apply_filters('c_ws_plugin__s2member_pro_clickbank_notify_handles_completions', TRUE, get_defined_vars()))
if( // Here we handle Recurring cancellations, and/or EOT (End Of Term) through $clickbank['lineItems'][0]->paymentPlan->rebillStatus.
(preg_match('/^(?:TEST_)?(?:SALE|BILL)$/i', $clickbank['transactionType']) && $clickbank['lineItems'][0]->recurring && (preg_match('/^COMPLETED$/i', $clickbank['lineItems'][0]->paymentPlan->rebillStatus) || $clickbank['lineItems'][0]->paymentPlan->paymentsRemaining <= 0) && apply_filters('c_ws_plugin__s2member_pro_clickbank_notify_handles_completions', TRUE, get_defined_vars()))
|| (preg_match('/^(?:TEST_)?CANCEL-REBILL$/i', $clickbank['transactionType']) && $clickbank['lineItems'][0]->recurring)
)
{
Expand Down

0 comments on commit 69a09e9

Please sign in to comment.