GithubHelp home page GithubHelp logo

afterpay-ruby's People

Contributors

christianrimondi avatar garciajordy avatar mtylty avatar vassalloandrea avatar

Watchers

 avatar  avatar  avatar  avatar

afterpay-ruby's Issues

Add User agent to the Afterpay configuration

https://developers.afterpay.com/afterpay-online/reference#request-headers

lib/afterpay.rb add user_agent attribute
lib/afterpay/http_service/request.rb add faraday_options

User-Agent Header

 

User-Agent header must be supplied with all Merchant API requests prior to placing any live transactions.

For example:

  • MyAfterpayModule/1.0.0 (E-Commerce Platform Name/1.0.0; PHP/7.0.0; Merchant/600032000) https://merchant.example.com
Description Example Data Above Other Merchant Examples
Afterpay Plugin MyAfterpayModule/1.0.0 • Custom Plugin/1.0• Shopify Plugin/3.5.1• AfterpayCartridge/1.0• AfterpayExtension/2.9
Platform E-Commerce Platform Name/1.0.0 • Websphere Commerce/8.1• Commerce Cloud/1.1• Magento/2.3.0
System Information PHP/7.0.0 • PHP/7.2.18• Ruby/2.5.3• Java/8.3
Merchant ID Merchant/600032000 • Merchant/101113200• Merchant/101931210
Merchant Website URL https://merchant.example.com http://www.merchantwebsite.com

Afterpay::Components::Order#as_json doesn't convert the items array

Afterpay::Components::Order.new(items: [Afterpay::Components::Item.new(name: 'Test')]).as_json

=> {
 "amount"=>nil,
 "consumer"=>nil,
 "billing"=>nil,
 "shipping"=>nil,
 "courier"=>nil,
 "items"=>[
   #<Afterpay::Components::Item:0x00007fe8fc5ae370 @categories=nil, @estimated_shipment_date=nil, @image_url=nil, @name="Test", @page_url=nil, @price=nil, @quantity=nil, @sku=nil>
 ],
 "discounts"=>nil,
 "merchant"=>nil,
 "paymentType"=>nil,
 "merchantReference"=>nil,
 "taxAmount"=>nil,
 "shippingAmount"=>nil
}

I think the bug is here because the represent method doesn't handle the arrays (it should loop through the array and call the #as_json method on each value)

Upgrade V1 code to Afterpay V2

We should simply upgrade the existing code. More features will be added only after the solidus-afterpay extension is available.

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.