Cannot get Vipps in payment window - php

Using the code sample from here, I wish to add payment with Vipps to the payment options, so I added the following key-values as per the documentation to the request:
$request['paymentwindow'] = [
'paymentmethods' => [
[
'id' => 'paymentcard',
'action' => 'include'
],
[
'id' => 'vipps',
'action' => 'include'
]
]
];
But, this seems to have no effect and no option for payment with Vipps is added to the payment window. What am I doing wrong?

Short answer: Vipps is only available in production account

Related

Select2 keep showing "Searching" in ajax with pivot (n-n) in Laravel Backpack 5 Pro

I have 2 models: Order and Product, each has belongsToMany with pivot set properly.
In OrderCrudController, I also use FetchOperation and make a fethProducts() function as below:
use \Backpack\CRUD\app\Http\Controllers\Operations\FetchOperation;
public function fetchProducts()
{
return $this->fetch([
'model' => \App\Models\Product::class,
'searchable_attributes' => ['name','sku']
]);
// return $this->fetch(\App\Models\Product::class); <-- I also tried this one
}
protected function setupCreateOperation()
{
CRUD::setValidation(OrderRequest::class);
// other fields
$this->crud->addField([
'name' => 'products',
'type' => 'relationship',
'pivotSelect' => [
'attribute' => 'name',
'ajax' => true,
],
'subfields' => [
[
'name' => 'quantity',
'type' => 'number',
],
],
]);
}
But it comes to unexpected behavior when I search the product, the select2 field remains "searching" though the request successfully retrieved the data.
screenshot - select2 field
screenshot - ajax results
PS: this field works perfectly without subfields, no vendor overrides etc., so I think I've set everything correctly.
Anyone can help?
This was asked two months ago but somehow I missed it, just noticed it today after someone opened an issue on the GitHub repository.
I am happy you guys found a solution for it but unfortunatelly I cannot recommend it as using the select2_from_ajax will miss the functionality to don't allow the selection of the same pivots twice, otherwise you will have undesired consequences when saving the entry.
I've just submitted a PR to fix this issue, I will ping you guys here when it's merged, probably by next Monday.
Cheers
I just came accross this exact problem and after quite some research and trials, i finally found a solution !
The problem seems to be related to the relationship field type inside the pivotSelect. Try to use select2_from_ajax instead and don't forget to set method to POST explicitly, that worked for me like a charm.
Here is what you might try in your case :
$this->crud->addField([
'name' => 'products',
'type' => 'relationship',
'pivotSelect' => [
'attribute' => 'name',
'type' => 'select2_from_ajax',
'method' => 'POST',
'data_source' => backpack_url('order/fetch/products') // Assuming this is the URL of the fetch operation
],
'subfields' => [
[
'name' => 'quantity',
'type' => 'number',
],
],
]);

Laravel Stripe Setup

okay, this is my first time to ask a question here so please give grace if it's not very clear. Anyway, I have this code in Laravel Billing.php.
Is this correct? Whenever a new customer is created, it doesn't have it's user email address but instead this unknown#domain.com was assigned to the user.
This was set by my previous developer. But ever since we hired him for just simple fix, we've had numerous issues with the site.
$stripeCustomer = StripeCustomer::create([
'email' => $currentCustomer->email ? $currentCustomer->email : 'unknown#domain.com',
'description' => $company->name,
'metadata' => [
'company_id' => $company->id,
'card_owner_email' => $currentCustomer->email ? $currentCustomer->email : false,
'company_name' => $company->name,
],
]);
You can remove customer email from the StripeCustomer when creating since stripe API said that email field of customer is optional. Here is the reference link
Here what you should fix:
$customerObject = [
'description' => $company->name,
'metadata' => [
'company_id' => $company->id,
'company_name' => $company->name,
],
];
if ($currentCustomer->email) {
$customerMetadata["metadata"]["card_owner_email"] = $currentCustomer->email;
$customerObject["email"] = $currentCustomer->email;
}
$stripeCustomer = StripeCustomer::create($customerObject);

Bigcommerce cart 422: Missing required fields error

I'm using Laravel to consume the Bigcommerce V3 API.
I have ben able to succesfully create a new cart. But when trying to add an item to it, I keep getting a 422: Missing required fields error.
I'm making my request trough Guzzle like this:
return json_decode($this->client->getRestClient()
->post('carts/'.$cartId.'/items?include=line_items.physical_items.options', [
'Accept' => 'application/json',
'json' => [
'line_items' => [
'product_id' => 86,
'quantity' => 1
],
],
])
->getBody())
->data;
The product I'm trying to add has no options or modifiers, so I don't understand what could wrong with my request. According to the docs, this should be all that's needed.
Does anyone have any idea what could be wrong? I tried contacting support, but to no avail.
Thanks in advance!
line_items is an array of objects. Try wrapping your product data in an object.
Like this:
'line_items' => [
{
'quantity' => 1,
'product_id' => 86
}
]
Your line_items field needs to have an array of objects, like this:
[
{
"product_id":86,
"quantity":1
}
]

Is there any method in brain-tree auto renew payment?

HI I am using braintree(braintree/braintree_php": "4.5.0) . I have implemented the 3dsecure in the web.It working fine. I need to auto renew the payment with paymentMethodToken. Below code i have used for auto renewal.
$trans = [
'amount' => "14.63",
'merchantAccountId' => "Vo**ID",
'paymentMethodToken' =>"token",
'transactionSource' => "recurring",
'customFields' => [
'client_id' => "id",
'service_id' => "id",
'invoice_id' => "id",
'action' => "autorenew",
'slots' => "15",
],
'options' => [
'submitForSettlement' => true,
'storeInVaultOnSuccess' => true,
'paypal' => [
'description' =>"Renew server",
]
]
];
$transaction = $gateway->transaction()->sale($trans);
When run this code i get below error
Authorization in Util.php line 59:
The above code is working when the user enter the credit card information to pay.This only gives error when i do payment with paymentMethodToken to auto renew the payments.Any help?
reference : https://developers.braintreepayments.com/guides/paypal/server-side/php
As per I understood your requirement. You need to do auto payment.
For that, Braintree provide the best way to do this called Subscription.
Let me know, If you need any more help.

Braintree Discount - PHP NotFound in Util.php line 64:

I am trying to override the discount amount i have created from Braintree control panel by calling the function below.
$result = Braintree_Subscription::create([
'paymentMethodToken' => 'the_payment_method_token',
'planId' => 'the_plan_id',
'addOns' => [
'add' => [
[
'inheritedFromId' => 'abcd',
'amount' => 20.00
]
]
]
]);
But it is returning me this error
NotFound in Util.php line 64:; Util::throwStatusCodeException('404') in Http.php line 47 Appreciate any help. Thanks!
Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support.
The 404 error you're seeing is likely being thrown due to one or more ID's specified in your API call not matching what you have in your control panel. The two ID's from your example code are the following:
A Plan with the ID the_plan_id
An add-on with the ID abcd
You'll want to ensure that you have a plan and add-on with those ID's in your control panel before using them in an API call. Since there isn't a way to generate plans or ID's from the API, you can follow the guide below on how to make them.
Making a Plan
The other potential issue here is that in your question, you mentioned you wanted to use a discount, where in your code, you're specifying an add-on. This might itself be the source of the problem. I would change these lines:
'addOns' => [
'add' => [
[
'inheritedFromId' => 'abcd',
'amount' => 20.00
]
]
to
'discounts' => [
'add' => [
[
'inheritedFromId' => 'abcd',
'amount' => 20.00
]
]

Categories