strangerstudios / pmpro-sponsored-members

Generate a discount code for a main account holder to distribute to sponsored members.
https://www.paidmembershipspro.com/add-ons/pmpro-sponsored-members/
15 stars 27 forks source link

fix for paypal express compatibility #64

Closed LMNTL closed 4 years ago

LMNTL commented 5 years ago

Paypal Express compatibility still doesn't appear to work correctly as of the latest version. I tested just the changing 'init' to 'pmpro_checkout_preheader' like in PR #53 here, but that was only partially effective; coupon codes were generated and the correct amount for transactions showed during initial trip to Paypal, but the actual price charged didn't include the extra seat cost. Preserving the 'seats' parameter by including it in NVP string's return URL fixes that.

Steps to reproduce:

  1. Create a membership level with a $1 initial payment
  2. Created a sponsored level that costs $1 per seat with seats chosen at checkout Example array:
    $pmprosm_sponsored_account_levels = array(
        1 => array(
                'main_level_id' => 1
                'sponsored_level_id' => 2,
                'seat_cost' => 1,
                'max_seats' => 100,
                'min_seats' => 1,
        )
    );
  3. Checkout with PayPal Express, choosing 1 seat
  4. Complete checkout and go to confirmation page in PMPro
  5. No sponsored members created, PMPro order does not reflect extra seat cost
  6. Install this PR
  7. Repeat steps 3-4
  8. Sponsored members created, amount shown during Paypal-side checkout steps, in Orders table, and actual amount charged all match

Fixes:

44

Tested on:

PMPro v2.0.7 + v2.1 beta 1, Sponsored Members v0.7, WP 5.2.2

andrewlimaza commented 4 years ago

Thanks this looks good :)