How to add paypal pro (omnipay gateway) to sylius - paypal

I feel like I've read quite a few threads of people wanting help with adding a gateway, but I haven't seemed to find any solution that's been shared once the asker figured out the answer. I know there have been suggestions to look at the Payum Bundle docs too, but since I can't figure out how exactly Sylius is integrating with the Payum Bundle, I'm not able to receive much help from the payum docs. Would someone be able to help explain what is necessary to get PayPal Pro to work in the sylius app?
I've added this to the config file:
payum:
contexts:
paypal_pro:
omnipay:
type: PayPal_Pro
options:
username: %paypal.username%
password: %paypal.password%
signature: %paypal.signature%
testMode: %paypal.test_mode%
storages:
Sylius\Component\Core\Model\Order:
doctrine:
driver: orm
Sylius\Component\Core\Model\Payment:
doctrine:
driver: orm
and this in my services.yml file:
sylius.payum.paypal.action.capture_payment_using_credit_card:
class: %sylius.payum.paypal.action.capture_payment_using_credit_card.class%
tags:
- { name: payum.action, factory: omnipay }
For the CapturePaymentUsingCreditCardAction class, I just copied over Sylius's Stripe one. I thought this would be enough since Stripe was said to work out of the box as well. When I input the fake credit card information (we're in sandbox mode), I just get an "Unknown payment error" flash message after I'm redirected to the payment method selection page. From what I understand from reading this thread, the states are automatically managed by the state machine. I had added a PaymentStatusAction briefly (copied over from the Dummy class and var_dumping what the details held), but that didn't do anything to help.
Also, would someone be able to explain the need for ExecuteSameRequestWithDetailsAction? It looks almost the same as something like CapturePaymentUsingCreditCardAction.

Related

How to simulate and debug PAYER_ACTION_REQUIRED?

we are integrating the Paypal-API for Paypal-Checkout and came about the possebility that Paypal might return a PAYER_ACTION_REQUIRED-error (see https://developer.paypal.com/docs/api/orders/v2/#error-PAYER_ACTION_REQUIRED).
We now want to see if our understanding and implemented handling of this error is correct, but we couldn't find a way to provoke this error intentionally in the sandbox to debug our code. How is it done?
We tried to use a card-number from this page:
https://developer.paypal.com/tools/sandbox/card-testing/#rejection-triggers
and tried to use a "rejection trigger", but either we get "the name contains invalid characters"- or "the credit-card data is not valid"-messages, but the Paypal-Window is never leaved so none of these errors hits our code.
Any ideas?
See the guide for integrating 3D Secure, which is what returns this status. It's particularly necessary for processing cards from Europe with an Advanced Credit and Debit Cards integration.
If you are using the Standard integration, you do not need to be concerned about 3DS as it's taken care of by PayPal.

Why snipcart digital goods verification fails

I’ve been stuck on this for a while now.
I’m trying to set up a digital products webshop, using Vue + Strapi + Snipcart.
Here’s the error I’m encountering once I try to checkout with a product:
browser error message from snipcart
However, If I test with a normal product that doesn’t have guid attached to it - everything is fine and the transaction goes through.
I use snipcart’s JSON crawler. Therefore I’ve created an endpoint from my API with all products.
JSON structure
{
"_id":"618ff1327f4e2824f09134cf",
"price":123,
"file_guid":"7571fd60-a403-404c-b27a-616c0856e1ee",
"id":"618ff1327f4e2824f09134cf"
}
...
The only thing that comes to my mind - is that I’m not correctly referencing guid in my JSON document
I’ve also tried just guid instead file_guid - it didn’t work.
Lastly this is my “Add to cart” button code:
<v-btn dark depressed class="mt-5 snipcart-add-item"
:data-item-id="productDetails.id"
:data-item-description="productDetails.shortDescription"
:data-item-price="productDetails.price"
:data-item-image="apiUrl + productDetails.image.url"
:data-item-name="productDetails.title"
:data-item-url="'https://92ef-91-101-56-233.ngrok.io/products/snipcart'"
:data-item-max-quantity="1"
:data-item-min-quantity="1"
:data-item-file-guid="productDetails.file_guid"
>ADD TO CART</v-btn>
Everything is running and tested locally using ngrok.
Does anyone have any ideas of what I’m doing wrong? Any help is highly appreciated.
Thanks.
I’ve managet to figure out the issue. As I suspected I was referencing guid wrong (file_guid and guid), that’s why snipcart’s JSON crawler was returning me the error.
I’ve found in some random repository that You must use the name fileGuid in your API otherwise crawler won’t find it.

LinkedIn API: fetching our company's posts & profile info

So, I'm making this application, and it's required that it has an embed thingy containing the recent LinkedIn posts as well as basic profile info of the company...
Since I like the Law of Minimum effort, the first thing I saw that made my eyes sparkle was the RSS feed... But it seems like it's been phased out. It just redirects to the company page, period.
Then I realized that we have 2 APIs, v1 being superdead since May.
So, I succesfully generated a v2 access token, keeping in mind that it will have to be renewed every 2 months, but hey, nothing's perfect.
Anyway, I know there's a v1 endpoint that would seem to put me on the right track:
https://api.linkedin.com/v1/companies/{id}:
(id,name,ticker,description)?format=json
However, when I go to the v2 docs (https://learn.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin/context), there's this entire, very detailed section about Authentication, and a section titled "API guide" which talks about "API Concepts" as well as "Best Practices"... but no section detailing just where the endpoints are and how to use them?????
Please, help me, SO, how do I get a company's recent posts as well as basic info like name and pfp?
Thank you in advance.
UPDATE: I have made progress, I think.
I found this: https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/company-pages-migration
And this: https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/organizations/organization-lookup-api
I am making the call and after basically having to guess how to input my token (it must be included as the oauth2_access_token parameter) I get a 403 error DESPITE me being an administrator for the organization I'm looking up.
Call: https://api.linkedin.com/v2/organizations/XXXXXXXX?oauth2_access_token=my-token
Response:
{"serviceErrorCode":100,"message":"Not enough permissions to access: GET /organizations/00000000","status":403}
This makes me think maybe I need to request extra permissions on authentication... but THAT I do not find anywhere (i.e. what the permissions are. I only find really vague stuff with NO details. eg: https://learn.microsoft.com/en-us/linkedin/shared/authentication/permissions?context=linkedin/context)
UPDATE 2: As suggested by #ManvinderSingh I removed the oauth2_access_token param and instead included my token in the Authorization header. This works awesome for the /v2/me endpoint, for instance, BUT still 403's me on the v2/organizations/XXXXXXXX endpoint for an organization that I am an admin of.
As per the documentation https://learn.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin/context#step-4-make-authenticated-requests.
You have to send the token in the Authorization header like this.
Authorization: Bearer {access_token}

Get PublishingPageContent rendered when using Rest Api

I have recently encountered this problem on SharePoint:
https://sharepoint.stackexchange.com/questions/221059/get-publishingpagecontent-rendered-when-using-rest-api
Since there is no provided answer for the question, I was just wondering if someone else has maybe solved this problem or found a workaround for it in the meantime?
Best regards!
https://blogs.msdn.microsoft.com/sowmyancs/2008/03/15/create-publishing-pages-in-portal-sites-programmatically-and-add-it-into-a-specific-folders-inside-the-pages-library/
Publishing the pages (as listed in the code above) leaves the pages in a "pending" approval status. To programatically approve the pages as well
– just use the Publish and Approve methods of the SPFile class:
publishingPage.CheckIn(checkInComment);
SPFile pageFile = publishingPage.ListItem.File;
pageFile.Publish(checkInComment);
pageFile.Approve(checkInComment);
Listed here: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.publishing.publishingpage.description.aspx

Encoding problems in PayPal Here callback URL?

I'm trying to get PayPal Here to issue a callback to a FileMaker Go database. It looks like the fmp:// protocol is being used correctly, but seems that there may be some kind of other problem with the callback URL.
Here's the URL that I'm using to call PayPal Here (note that I'm not stripping out the carriage returns from the base64-encoded invoice in my application; this is the actual URL my application sends to the OS, and the invoice appears to be fine in PPH):
paypalhere://takePayment?as=b64&accepted=card%2Cpaypal&returnUrl=fmp:%2F%2F$%2Ffmg_pphTest&step=choosePayment&invoice=eyJwYXltZW50VGVybXMiOiJEdWVPblJlY2VpcHQiLCJkaXNjb3VudFBlcmNlbnQiOjAsImN1cnJl
bmN5Q29kZSI6IlVTRCIsInBheWVyRW1haWwiOiJjcmlzdG9zK3Rlc3RAY3Jpc3Rvc2xjLmNvbSIs
Iml0ZW1MaXN0Ijp7DQogICAgIml0ZW0iOiBbDQogICAgICAgIHsibmFtZSI6IkRpbGl0aGl1bSBD
cnlzdGFsIiwiZGVzY3JpcHRpb24iOiJNYWtlcyBzaGlwIGdvIGZhc3QuIiwidW5pdFByaWNlIjow
LjEsInF1YW50aXR5IjoxMCwidGF4UmF0ZSI6MCwidGF4TmFtZSI6IlRheCJ9DQogICAgXQ0KfX0=
This is the URL that I want to fire (this is just for testing; later on, there will be additional parameters added on to send the payment status, etc., but I can't even get this basic version to work yet):
fmp://$/fmg_pphTest
However, the behavior I'm seeing looks like this is the URL PPH is actually sending:
fmp://
Testing is being done on an iPad 2 running iOS 8.3. Any thoughts/suggestions out there?
A kind soul on the FileMaker Community boards pointed me at a working example, https://github.com/Genecom/FileMakerSampleSolutions. After doing some comparisons, I discovered the issue is due to using base64-encoding of the JSON invoice object. When I changed it to use URL-encoding of the JSON invoice (like the Genecom example), I was able to get the callback URL to work successfully.
I opened an issue on the PayPal Here github project, please feel free to chime in there if you've also experienced this issue (or found countervailing evidence): https://github.com/paypal/here-sideloader-api-samples/issues/26