Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

possible misleading information on comment section #26

Closed
prajwolonta opened this issue Sep 4, 2014 · 10 comments
Closed

possible misleading information on comment section #26

prajwolonta opened this issue Sep 4, 2014 · 10 comments

Comments

@prajwolonta
Copy link

Hi i am integrating the package in laravel. Im going thru the comments and i see this:

// Create a storage model object.
// A basic PDO storage is provided, but just extend Model\Transaction and use your own.

I search transaction inside model folder but there's none? it is TransactionAbstract or is it Metadata\Transaction please help me understand.

Also how is it possible to using it with laravel eloquent?

Many thanks
Prajwol.

@judgej
Copy link
Member

judgej commented Sep 5, 2014

Hi,

Yes, it should be TransactionAbstract that is extended.

To use with eloquent, I expect your model would need to be injected with the Laravel transaction model, then you would use that model as a service (if that is the right term) to do the reading and writing.

Strangely enough, I am trying out the omnipay/sagepay package with Laravel now, and created an eloquent model for it yesterday.

Something to bear in mind, is that the PDO model in this package has a separate database column for each field that it needs to store. That is not necessary unless you have a specific need to be able to join or search for any of those columns. The approach I have taken with omnipay/sagepay is to have columns for VendorTxCode (the index), the main status and the notify callback status, and a few message fields. But beyond that, most of the rest of the data (e.g. as returned in the initial call to SagePay and the transaction results provided in the notify callback) are serialised into text fields. Eloquent makes it dead easy to automatically json_encode() and json_decode() that data invisibly as you read and write records.

The eventual idea is that it should be possible to use a single transactions model for ANY gateway that omnipay uses. I am constructing a site that requires several different payment gateways and currencies, which is why I'm trying out omnipay. I'm still finding each gateway is different enough to need custom handling, but if the transaction model can be made general enough to work with any of the gateways, then I could release it as a standalone package that would easily integrate with this gateway, omnipay, or any other gateways run under Laravel.

Best of luck, and let me know if there is anything I can help with or anything above that is not clear.

judgej added a commit that referenced this issue Sep 5, 2014
@prajwolonta
Copy link
Author

Hi judgej,
First of all im sorry i didn't expressed my gratitude for providing this package and thank you for the response. Have you tried integrating it with laravel ?
I did extended the transaction model i created to Model\TransactionAbstract but getting error.
Could you please tell you how you succeeded with integrating laravel.

I would really appreciate.

Many thanks,
Prajwol

@judgej
Copy link
Member

judgej commented Sep 5, 2014

Yes, I have used it with Laravel, but I've just used the PDO model, so that kind of bypasses eloquent.

@prajwolonta
Copy link
Author

Hi judgej.. I decided to use pdo.. as really short on deadline :p btw how do you add discount on basket? I searched on basket model but found nothing. Any reply would be appreciated.

@judgej
Copy link
Member

judgej commented Sep 7, 2014

The basket model is just a repository of the final basket from your application, so it can be sent to SagePay as metadata. It does not have any functionality beyond that. You add product details or ProductLines and it formats itself in the XML format that SagePay expects.

@prajwolonta
Copy link
Author

how am i to send the discounts with this package? Could you add a one line code on the read me itself? as im sure it'll help lot others like me.

@judgej
Copy link
Member

judgej commented Sep 7, 2014

Sorry, I'm not sure I understand what discounts you mean, and how that relates to the payment gateway.

@prajwolonta
Copy link
Author

sending discount fixed amount by xml just like we send shipping charges.
According to sagepay on basket xml
"Displaying on the payment page. It is possible to send through a delivery charge and one or more discounts. The discount is at the
order level rather than item level and is a fixed amount discount. You can however add multiple discounts to the order."

You can check this at :
http://www.sagepay.co.uk/file/1161/download-document/SERVERProtocolandIntegrationGuidelinesV3%200.pdf

for discount check page number 56

@judgej
Copy link
Member

judgej commented Sep 8, 2014

Ah, I see now. The SagePay spec I was working from is a little earlier than the one you linked. and the discount functionality was not documented at that time, so has not been coded. The API version hasn't changed, so it looks like it was just an omission in the first v3.0 spec.

It could be coded like the order lines, allowing you to add discount values or objects to the basket. When formatting as XML, the basket would then expand the discounts in the appropriate place (IIRC the XML elements must be in the same order as documented).

You could start by creating your own basket, extending BasketAbstract, and add those features, then we can look at integrating the code.

@judgej
Copy link
Member

judgej commented Sep 8, 2014

I've moved the discount support to a separate ticket.

@judgej judgej closed this as completed Sep 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants