Last active
August 29, 2015 14:09
-
-
Save yosriady/0e4048cea9ff0bd7fbd5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def build_adaptive_payment_request(sheet) | |
| trackingId = generate_token | |
| api = PayPal::SDK::AdaptivePayments::API.new | |
| pay_request = api.build_pay() | |
| pay_request.trackingId = trackingId | |
| pay_request.actionType = "PAY" | |
| pay_request.cancelUrl = orders_cancel_url | |
| pay_request.returnUrl = orders_success_url(trackingId) | |
| pay_request.ipnNotificationUrl = orders_ipn_notify_url | |
| pay_request.currencyCode = DEFAULT_CURRENCY | |
| # Primary receiver (Sheet Owner) | |
| pay_request.receiverList.receiver[0].amount = sheet.price #100% | |
| pay_request.receiverList.receiver[0].email = sheet.user.paypal_email | |
| pay_request.receiverList.receiver[0].primary = true | |
| pay_request.receiverList.receiver[0].paymentType = "DIGITALGOODS" | |
| # Secondary Receiver (Marketplace) | |
| pay_request.receiverList.receiver[1].amount = sheet.commission | |
| pay_request.receiverList.receiver[1].email = MARKETPLACE_PAYPAL_EMAIL | |
| pay_request.receiverList.receiver[1].primary = false | |
| pay_request.receiverList.receiver[1].paymentType = "DIGITALGOODS" | |
| return pay_request | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment