Inhalte aufrufen

Profilbild

Smartstore Error


45 Antworten zu diesem Thema

#21 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3294 Beiträge

Geschrieben: 19 February 2018 - 19:55

Try
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
before your WebRequest/HttpWebRequest. Example.

Schöne Grüße aus Düsseldorf,
Marcus Gesing


#22 Olamide

Olamide

    Advanced Member

  • Members
  • 32 Beiträge

Geschrieben: 19 February 2018 - 20:06

Hello, I really appreciate your effort, I actually did that in my code before making the request as shown below:

 

I noticed that is not reaching the log line in bold

 

PLEASE NOTE THAT THE METHOD IS AN ASYNCHRONOUS METHOD WHICH IS BEING CALLED IN A SYNCHRONOUS METHOD I.E. PostProcessPayment METHOD

 

public async Task GetPayStackPaymentReferenceUrl(PayStackSettings settings,Core.Domain.Customers.Customer customer,string amount, string reference,string callbackurl,int storeid)
{
try
{
 
var model = new PaystackStandardModel
{
amount = amount,
email =customer.Email,
reference = reference,
callback_url = callbackurl,
metadata = new Metadata
{
custom_fields = new Custom_Fields[]
   {
new Custom_Fields{display_name = "Store Id",variable_name="store_id",value=storeid.ToString()},
new Custom_Fields{display_name = "Customer Guid",variable_name="customer_guid",value=customer.CustomerGuid.ToString()}
   }
}
};
using (var client = new HttpClient())
{
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
_logger.Info("settings.PayStackApiUrl: " + settings.PayStackApiUrl);
client.BaseAddress = new Uri(settings.PayStackApiUrl);
 
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", settings.SecretKey);
var jsonObj = JsonConvert.SerializeObject(model);
_logger.Info("jsonObj: " + jsonObj);
var stringContent = new StringContent(jsonObj, System.Text.Encoding.UTF8, "application/json");
 
var result = await client.PostAsync("transaction/initialize", stringContent);
var content = await result.Content.ReadAsStringAsync();
_logger.Info("paystackResponse: " + content);
var paystackResponse = JsonConvert.DeserializeObject<PaystackResponse>(content);
 
if (paystackResponse.status)
{
paystackpaymentUrl = paystackResponse.data.authorization_url;
_logger.Info("paystackpaymentUrl: " + paystackpaymentUrl);
// return paystackResponse.data.authorization_url;
}
//return "";
}
}
catch (Exception ex)
{
_logger.Error(ex,ex.Message);
//return "";
}
 
thanks


#23 Murat Cakir

Murat Cakir

    SmartStore AG

  • Administrators
  • 1076 Beiträge

Geschrieben: 19 February 2018 - 21:55

And where and how gets GetPayStackPaymentReferenceUrl() called? You either...

  • ...must await for the method to complete, or
  • ...wrap your function call in Task.Run(...), or
  • ...use our AsyncRunner.RunSync() wrapper to call your method, or
  • ...just don't do async stuff  ;)

Murat Cakir
SmartStore AG


#24 Olamide

Olamide

    Advanced Member

  • Members
  • 32 Beiträge

Geschrieben: 19 February 2018 - 23:08

Hello,

 

Thanks for the feedback, i removed the async implementation and it worked, it is now redirecting to the payment gateway.

 

But i have another issue, it requires a callback url to be specified, i followed the method in paypal implementation which is

_services.WebHelper.GetStoreLocation(store.SslEnabled) + "Plugins/SmartStore.PayStack/PayStack/ConfirmPayment";

 

but didn't work

 

How can i generate a callback url with the following details:

Controller name: PayStackController

actionName: ConfirmPayment

 

This is my RouteProvider implementation

 

public void RegisterRoutes(RouteCollection routes)
{
routes.MapRoute("SmartStore.PayStack",
"Plugins/SmartStore.PayStack/{action}",
new { controller = "PayStack" },
new[] { "SmartStore.PayStack.Controllers" }
)
.DataTokens["area"] = "SmartStore.PayStack";
}
 
Thanks


#25 Olamide

Olamide

    Advanced Member

  • Members
  • 32 Beiträge

Geschrieben: 20 February 2018 - 00:01

Hello,

 

I have corrected the error, it actually from my Routeprovider, i didn't specify the controller part of the url in the routes.MapRoute method.

 

The payment gateway is now working fine.

 

But i noticed something, while i was still designing the payment gateway, if an error occurred in the PostProcessPayment override method where the redirection takes place, the cart items are empty and the customer won't see any item in the basket also when i check the dashboard, i see it as pending payment, how can i prevent this, I mean if error occurs in the PostProcessPayment, i want to preserve the items in the cart and not mark it as pending payment.

 

Thanks



#26 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3294 Beiträge

Geschrieben: 20 February 2018 - 10:43

You cannot prevent pending payment status because it's the initial status. It's the correct status in case of an error in PostProcessPayment. PostProcessPayment and URL redirecting take place after the order has been placed, i.e. the shopping cart is always empty at this point, regardless of whether an error occured or not. However you can implement and override CanRePostProcessPayment method. That allows the buyer to initiate the payment redirecting again from his frontend order page.
 
Theoretical, if you don't want to accept an order in case of a payment error, you would have to redirect in the checkout. However, there is a danger that money will be collected for which there is no order at all (should be avoided under all circumstances).

Schöne Grüße aus Düsseldorf,
Marcus Gesing


#27 Olamide

Olamide

    Advanced Member

  • Members
  • 32 Beiträge

Geschrieben: 20 February 2018 - 11:12

Hello Marcus,

 

You have being of great help to me, thanks a lot. The payment plugin is now working as required. Really appreciate your effort.

 

But please i need some few things:

 

1. is it possible to customize the products by adding suppliers with their respective account numbers so that when payments are made using the plugin, they are created directly.

2. How can i design a custom module for the site, i need a chat module to integrate with it and i want to create it and install on the site.

 

 

Thanks



#28 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3294 Beiträge

Geschrieben: 20 February 2018 - 15:34

1. No, not out of the box.
2. That depends on details. You can use a widget for the chat UI and inject it in the frontend through the plugin.

Schöne Grüße aus Düsseldorf,
Marcus Gesing


#29 Olamide

Olamide

    Advanced Member

  • Members
  • 32 Beiträge

Geschrieben: 21 February 2018 - 07:09

Hello Marcus,

 

Thanks for the reply.

 

Since it's not possible out of the box, perhaps it could be possible in the paid version.

 

Also can i add custom properties when registering a product.

 

Thanks



#30 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3294 Beiträge

Geschrieben: 21 February 2018 - 13:17

You can use SyncMapping.


Schöne Grüße aus Düsseldorf,
Marcus Gesing


#31 Olamide

Olamide

    Advanced Member

  • Members
  • 32 Beiträge

Geschrieben: 27 July 2018 - 07:19

Hello Marcus,

 

Thanks a lot for your assistance while i was creating a plugin. Please i would like to ask is it possible to register products by different sellers. I mean i want a situation whereby a product can be sold by different sellers and the customer gets to choose from a seller.

 

Thanks



#32 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3294 Beiträge

Geschrieben: 27 July 2018 - 08:37

Multi-Vendor is a feature we plan to include in the future.

Schöne Grüße aus Düsseldorf,
Marcus Gesing


#33 Olamide

Olamide

    Advanced Member

  • Members
  • 32 Beiträge

Geschrieben: 27 July 2018 - 08:41

Thanks Marcus for the reply.

 

Please would this be available this year because i can see the request was made in Nov 2015, also how can i make use of multi-shop feature pending when multi-vendor is available.

 

Thanks



#34 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3294 Beiträge

Geschrieben: 27 July 2018 - 08:46

No, probably not this year. An exact date has not yet been determined. I can't say details about multi-vendor yet.


Schöne Grüße aus Düsseldorf,
Marcus Gesing


#35 Olamide

Olamide

    Advanced Member

  • Members
  • 32 Beiträge

Geschrieben: 27 July 2018 - 08:56

Thanks Marcus, you have always being of great help. Hope am not disturbing you.

would like to know if it's possible to extend the Product Info page like adding custom properties which will be accessible while making payment (properties like Seller Id and Seller Name).

 

Thanks



#36 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3294 Beiträge

Geschrieben: 27 July 2018 - 11:26

Yes, it's possible by using widgets but I would check whether the built-in features are not sufficient for this purpose, for example product and checkout attributes.


Schöne Grüße aus Düsseldorf,
Marcus Gesing


#37 Olamide

Olamide

    Advanced Member

  • Members
  • 32 Beiträge

Geschrieben: 27 July 2018 - 11:33

Please Assist while you help with the last request:

 

I cloned the repo on github, built the solution successfully but while running the install, i got this error:

 

Setup failed: Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration.

 

Help



#38 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3294 Beiträge

Geschrieben: 27 July 2018 - 12:46

Add an ignoring changes migration to solve migration conflicts ("Unable to update database to match the current model because there are pending changes and automatic migration is disabled"):
add-migration Merge -IgnoreChanges

Schöne Grüße aus Düsseldorf,
Marcus Gesing


#39 Olamide

Olamide

    Advanced Member

  • Members
  • 32 Beiträge

Geschrieben: 27 July 2018 - 13:26

Hello Marcus, 

 

Thanks for the reply, but I got this new error

 

More than one migrations configuration type was found in the assembly 'SmartStore.Data'. Specify the name of the one to use.



#40 Olamide

Olamide

    Advanced Member

  • Members
  • 32 Beiträge

Geschrieben: 27 July 2018 - 13:37

Hello Marcus, 

 

I was able to resolve the above error but found another one again

 

 

System.TypeInitializationException: The type initializer for 'SmartStore.Data.SmartObjectContext' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
   at SmartStore.Utilities.CommonHelper.MapPath(String path, Boolean findAppRoot)
   at SmartStore.Core.Data.DataSettings.ResolveTenant() in C:\Users\akinnagbeeo\source\repos\SmartStoreNET\src\Libraries\SmartStore.Core\Data\DataSettings.cs:line 285
   at SmartStore.Core.Data.DataSettings.Load() in C:\Users\akinnagbeeo\source\repos\SmartStoreNET\src\Libraries\SmartStore.Core\Data\DataSettings.cs:line 202
   at SmartStore.Core.Data.DataSettings.get_Current() in C:\Users\akinnagbeeo\source\repos\SmartStoreNET\src\Libraries\SmartStore.Core\Data\DataSettings.cs:line 56
   at SmartStore.Core.Data.DataSettings.DatabaseIsInstalled() in C:\Users\akinnagbeeo\source\repos\SmartStoreNET\src\Libraries\SmartStore.Core\Data\DataSettings.cs:line 73
   at SmartStore.Data.SmartObjectContext..cctor() in C:\Users\akinnagbeeo\source\repos\SmartStoreNET\src\Libraries\SmartStore.Data\SmartObjectContext.cs:line 20
   --- End of inner exception stack trace ---
   at SmartStore.Data.SmartObjectContext..ctor() in C:\Users\akinnagbeeo\source\repos\SmartStoreNET\src\Libraries\SmartStore.Data\SmartObjectContext.cs:line 34
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Data.Entity.Infrastructure.DbContextInfo.CreateInstance()
   at System.Data.Entity.Infrastructure.DbContextInfo..ctor(Type contextType, DbProviderInfo modelProviderInfo, AppConfig config, DbConnectionInfo connectionInfo, Func`1 resolver)
   at System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration, DbContext usersContext, DatabaseExistenceState existenceState, Boolean calledByCreateDatabase)
   at System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration)
   at System.Data.Entity.Migrations.Design.MigrationScaffolder..ctor(DbMigrationsConfiguration migrationsConfiguration)
   at System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.RunCore()
   at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.Run()
The type initializer for 'SmartStore.Data.SmartObjectContext' threw an exception.




Auf dieses Thema antworten