Skip to content

Commit

Permalink
Merge pull request #1060 from opencollective/paypal
Browse files Browse the repository at this point in the history
use USD for Paypal connect
  • Loading branch information
xdamman committed Dec 13, 2017
2 parents a7df9f1 + 5303f56 commit 664c862
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions server/paymentProviders/paypal.js
Expand Up @@ -101,6 +101,7 @@ export default {

// Returns the balance in the currency of the paymentMethod
getBalance: (paymentMethod) => {
// TODO: fix using call to paypal to get real balance
let totalSpent = 0, totalTransactions = 0, firstTransactionAt, lastTransactionAt;
return models.Transaction.findAll({
attributes: [
Expand Down Expand Up @@ -145,15 +146,15 @@ export default {
const lowerLimit = collective.currency === 'USD' ? 2000 : Math.floor(0.95 * limit);
console.log(">>> requesting a paykey for ", formatCurrency(lowerLimit*100, collective.currency));
return {
currencyCode: collective.currency,
currencyCode: 'USD', // collective.currency, // we should use the currency of the host collective but still waiting on PayPal to resolve that issue.
startingDate: new Date().toISOString(),
endingDate: expiryDate.toISOString(),
returnUrl: `${config.host.api}/connected-accounts/paypal/callback?paypalApprovalStatus=success&preapprovalKey=\${preapprovalKey}`,
cancelUrl: `${config.host.api}/connected-accounts/paypal/callback?paypalApprovalStatus=error&preapprovalKey=\${preapprovalKey}`,
displayMaxTotalAmount: false,
feesPayer: 'SENDER',
maxAmountPerPayment: lowerLimit, // PayPal claims this can go up to $10k without needing additional permissions from them.
maxTotalAmountOfAllPayments: lowerLimit, // PayPal claims this isn't needed but Live errors out if we don't send it.
maxAmountPerPayment: 2000.00, // lowerLimit, // PayPal claims this can go up to $10k without needing additional permissions from them.
maxTotalAmountOfAllPayments: 2000.00, //, // PayPal claims this isn't needed but Live errors out if we don't send it.
clientDetails: CollectiveId
};
});
Expand Down
2 changes: 1 addition & 1 deletion test/graphql.collective.test.js
Expand Up @@ -122,7 +122,7 @@ describe('graphql.collective.test.js', () => {
expect(collective.tiers).to.have.length(2);
expect(collective.stats).to.deep.equal({
backers: { all: 26, users: 25, organizations: 1 },
yearlyBudget: 227796,
yearlyBudget: 219116,
topExpenses: {"byCategory":[{"category":"Engineering","count":7,"totalExpenses":380829}],"byCollective":[{"slug":"tjholowaychuk","image":"https://opencollective-production.s3-us-west-1.amazonaws.com/25254v3s400_acc93f90-0085-11e7-951e-491568b1a942.jpeg","name":"TJ Holowaychuk","totalExpenses":-339120}]},
topFundingSources: {"byCollective":[{"slug":"pubnub","image":"https://opencollective-production.s3-us-west-1.amazonaws.com/pubnublogopng_38ab9250-d2c4-11e6-8ba3-b7985935397d.png","name":"PubNub","totalDonations":147560},{"slug":"harlow_ward","image":"https://opencollective-production.s3-us-west-1.amazonaws.com/168a47c0-d41d-11e6-b711-1589373fcf88.jpg","name":"Harlow Ward","totalDonations":42940},{"slug":"breck7","image":"https://opencollective-production.s3-us-west-1.amazonaws.com/bb14acd098624944ac160008b79fb9e5_30e998d0-619b-11e7-9eab-c17f21ef8eb7.png","name":"Breck Yunits","totalDonations":34720}],"byCollectiveType":[{"type":"USER","totalDonations":192031}]}
});
Expand Down

0 comments on commit 664c862

Please sign in to comment.