Giter Club home page Giter Club logo

Comments (10)

judgej avatar judgej commented on September 14, 2024

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.

from sagepay.

prajwolonta avatar prajwolonta commented on September 14, 2024

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

from sagepay.

judgej avatar judgej commented on September 14, 2024

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

from sagepay.

prajwolonta avatar prajwolonta commented on September 14, 2024

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.

from sagepay.

judgej avatar judgej commented on September 14, 2024

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.

from sagepay.

prajwolonta avatar prajwolonta commented on September 14, 2024

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.

from sagepay.

judgej avatar judgej commented on September 14, 2024

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

from sagepay.

prajwolonta avatar prajwolonta commented on September 14, 2024

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

from sagepay.

judgej avatar judgej commented on September 14, 2024

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.

from sagepay.

judgej avatar judgej commented on September 14, 2024

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

from sagepay.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.