Skip to content

Commit

Permalink
Stripe Android v4.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
tuyen-vuduc committed May 27, 2017
1 parent ff7ac4d commit 4b8791f
Show file tree
Hide file tree
Showing 13 changed files with 385 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Autosave files
*~

# build
[Oo]bj/
[Bb]in/
packages/
TestResults/

# globs
Makefile.in
*.DS_Store
*.sln.cache
*.suo
*.cache
*.pidb
*.userprefs
*.usertasks
config.log
config.make
config.status
aclocal.m4
install-sh
autom4te.cache/
*.user
*.tar.gz
tarballs/
test-results/
Thumbs.db

# Mac bundle stuff
*.dmg
*.app

# resharper
*_Resharper.*
*.Resharper

# dotCover
*.dotCover
*.nupkg
48 changes: 48 additions & 0 deletions Naxam.Stripe.Droid/Additions/AboutAdditions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Additions allow you to add arbitrary C# to the generated classes
before they are compiled. This can be helpful for providing convenience
methods or adding pure C# classes.

== Adding Methods to Generated Classes ==

Let's say the library being bound has a Rectangle class with a constructor
that takes an x and y position, and a width and length size. It will look like
this:

public partial class Rectangle
{
public Rectangle (int x, int y, int width, int height)
{
// JNI bindings
}
}

Imagine we want to add a constructor to this class that takes a Point and
Size structure instead of 4 ints. We can add a new file called Rectangle.cs
with a partial class containing our new method:

public partial class Rectangle
{
public Rectangle (Point location, Size size) :
this (location.X, location.Y, size.Width, size.Height)
{
}
}

At compile time, the additions class will be added to the generated class
and the final assembly will a Rectangle class with both constructors.


== Adding C# Classes ==

Another thing that can be done is adding fully C# managed classes to the
generated library. In the above example, let's assume that there isn't a
Point class available in Java or our library. The one we create doesn't need
to interact with Java, so we'll create it like a normal class in C#.

By adding a Point.cs file with this class, it will end up in the binding library:

public class Point
{
public int X { get; set; }
public int Y { get; set; }
}
36 changes: 36 additions & 0 deletions Naxam.Stripe.Droid/Jars/AboutJars.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
This directory is for Android .jars.

There are 4 types of jars that are supported:

== Input Jar and Embedded Jar ==

This is the jar that bindings should be generated for.

For example, if you were binding the Google Maps library, this would
be Google's "maps.jar".

The difference between EmbeddedJar and InputJar is, EmbeddedJar is to be
embedded in the resulting dll as EmbeddedResource, while InputJar is not.
There are couple of reasons you wouldn't like to embed the target jar
in your dll (the ones that could be internally loaded by <uses-library>
feature e.g. maps.jar, or you cannot embed jars that are under some
proprietary license).

Set the build action for these jars in the properties page to "InputJar".


== Reference Jar and Embedded Reference Jar ==

These are jars that are referenced by the input jar. C# bindings will
not be created for these jars. These jars will be used to resolve
types used by the input jar.

NOTE: Do not add "android.jar" as a reference jar. It will be added automatically
based on the Target Framework selected.

Set the build action for these jars in the properties page to "ReferenceJar".

"EmbeddedJar" works like "ReferenceJar", but like "EmbeddedJar", it is
embedded in your dll. But at application build time, they are not included
in the final apk, like ReferenceJar files.

Binary file added Naxam.Stripe.Droid/Jars/stripe-android-4.0.2.aar
Binary file not shown.
102 changes: 102 additions & 0 deletions Naxam.Stripe.Droid/Naxam.Stripe.Droid.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Xamarin.Build.Download.0.4.3\build\Xamarin.Build.Download.props" Condition="Exists('..\packages\Xamarin.Build.Download.0.4.3\build\Xamarin.Build.Download.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{7815A47B-A3E2-4A84-BED6-CD67DD747C96}</ProjectGuid>
<ProjectTypeGuids>{10368E6C-D01B-4462-8E8B-01FC667A7035};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<RootNamespace>Naxam.Stripe.Droid</RootNamespace>
<AssemblyName>Naxam.Stripe.Droid</AssemblyName>
<TargetFrameworkVersion>v7.1</TargetFrameworkVersion>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<AndroidUseLatestPlatformSdk>true</AndroidUseLatestPlatformSdk>
<AndroidClassParser>class-parse</AndroidClassParser>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidLinkMode>None</AndroidLinkMode>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidManagedSymbols>true</AndroidManagedSymbols>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Mono.Android" />
<Reference Include="Xamarin.Android.Support.Annotations">
<HintPath>..\packages\Xamarin.Android.Support.Annotations.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.Annotations.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.Compat">
<HintPath>..\packages\Xamarin.Android.Support.Compat.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.Compat.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.Core.UI">
<HintPath>..\packages\Xamarin.Android.Support.Core.UI.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.Core.UI.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.Core.Utils">
<HintPath>..\packages\Xamarin.Android.Support.Core.Utils.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.Core.Utils.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.Media.Compat">
<HintPath>..\packages\Xamarin.Android.Support.Media.Compat.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.Media.Compat.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.Fragment">
<HintPath>..\packages\Xamarin.Android.Support.Fragment.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.Fragment.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.Vector.Drawable">
<HintPath>..\packages\Xamarin.Android.Support.Vector.Drawable.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.Vector.Drawable.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.Animated.Vector.Drawable">
<HintPath>..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.Animated.Vector.Drawable.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.v7.AppCompat">
<HintPath>..\packages\Xamarin.Android.Support.v7.AppCompat.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.v7.AppCompat.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.v4">
<HintPath>..\packages\Xamarin.Android.Support.v4.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.v4.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Additions\AboutAdditions.txt" />
<None Include="Jars\AboutJars.txt" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<TransformFile Include="Transforms\EnumFields.xml" />
<TransformFile Include="Transforms\EnumMethods.xml" />
<TransformFile Include="Transforms\Metadata.xml" />
</ItemGroup>
<ItemGroup>
<LibraryProjectZip Include="Jars\stripe-android-4.0.2.aar" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.Bindings.targets" />
<Import Project="..\packages\Xamarin.Build.Download.0.4.3\build\Xamarin.Build.Download.targets" Condition="Exists('..\packages\Xamarin.Build.Download.0.4.3\build\Xamarin.Build.Download.targets')" />
<Import Project="..\packages\Xamarin.Android.Support.Annotations.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Annotations.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Annotations.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Annotations.targets')" />
<Import Project="..\packages\Xamarin.Android.Support.Compat.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Compat.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Compat.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Compat.targets')" />
<Import Project="..\packages\Xamarin.Android.Support.Core.UI.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Core.UI.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Core.UI.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Core.UI.targets')" />
<Import Project="..\packages\Xamarin.Android.Support.Core.Utils.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Core.Utils.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Core.Utils.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Core.Utils.targets')" />
<Import Project="..\packages\Xamarin.Android.Support.Media.Compat.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Media.Compat.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Media.Compat.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Media.Compat.targets')" />
<Import Project="..\packages\Xamarin.Android.Support.Fragment.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Fragment.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Fragment.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Fragment.targets')" />
<Import Project="..\packages\Xamarin.Android.Support.Vector.Drawable.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Vector.Drawable.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Vector.Drawable.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Vector.Drawable.targets')" />
<Import Project="..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Animated.Vector.Drawable.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.Animated.Vector.Drawable.targets')" />
<Import Project="..\packages\Xamarin.Android.Support.v7.AppCompat.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.v7.AppCompat.targets" Condition="Exists('..\packages\Xamarin.Android.Support.v7.AppCompat.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.v7.AppCompat.targets')" />
<Import Project="..\packages\Xamarin.Android.Support.v4.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.v4.targets" Condition="Exists('..\packages\Xamarin.Android.Support.v4.25.3.1\build\MonoAndroid70\Xamarin.Android.Support.v4.targets')" />
</Project>
27 changes: 27 additions & 0 deletions Naxam.Stripe.Droid/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using Android.App;

// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.

[assembly: AssemblyTitle("Naxam.Stripe.Droid")]
[assembly: AssemblyDescription("Xamarin Binding Library for Stripe Android SDK")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("NAXAM COMPANY LIMITED")]
[assembly: AssemblyProduct("X Bindings")]
[assembly: AssemblyCopyright("Copyright (c) 2017 NAXAM")]
[assembly: AssemblyTrademark("NAXAM")]
[assembly: AssemblyCulture("")]

// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion("4.0.2")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.

//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
19 changes: 19 additions & 0 deletions Naxam.Stripe.Droid/Transforms/EnumFields.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<enum-field-mappings>
<!--
This example converts the constants Fragment_id, Fragment_name,
and Fragment_tag from android.support.v4.app.FragmentActivity.FragmentTag
to an enum called Android.Support.V4.App.FragmentTagType with values
Id, Name, and Tag.
<mapping clr-enum-type="Android.Support.V4.App.FragmentTagType" jni-class="android/support/v4/app/FragmentActivity$FragmentTag">
<field clr-name="Id" jni-name="Fragment_id" value="1" />
<field clr-name="Name" jni-name="Fragment_name" value="0" />
<field clr-name="Tag" jni-name="Fragment_tag" value="2" />
</type>
Notes:
- An optional "bitfield" attribute marks the enum type with [Flags].
- For Java interfaces, use "jni-interface" attribute instead of "jni-class" attribute.
-->
</enum-field-mappings>
19 changes: 19 additions & 0 deletions Naxam.Stripe.Droid/Transforms/EnumMethods.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<enum-method-mappings>
<!--
This example changes the Java method:
android.support.v4.app.Fragment.SavedState.writeToParcel (int flags)
to be:
android.support.v4.app.Fragment.SavedState.writeToParcel (Android.OS.ParcelableWriteFlags flags)
when bound in C#.
<mapping jni-class="android/support/v4/app/Fragment.SavedState">
<method jni-name="writeToParcel" parameter="flags" clr-enum-type="Android.OS.ParcelableWriteFlags" />
</mapping>
Notes:
- For Java interfaces, use "jni-interface" attribute instead of "jni-class" attribute.
- To change the type of the return value, use "return" as the parameter name.
- The parameter names will be p0, p1, ... unless you provide JavaDoc file in the project.
-->
</enum-method-mappings>
28 changes: 28 additions & 0 deletions Naxam.Stripe.Droid/Transforms/Metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<!--
This sample removes the class: android.support.v4.content.AsyncTaskLoader.LoadTask:
<remove-node path="/api/package[@name='android.support.v4.content']/class[@name='AsyncTaskLoader.LoadTask']" />
This sample removes the method: android.support.v4.content.CursorLoader.loadInBackground:
<remove-node path="/api/package[@name='android.support.v4.content']/class[@name='CursorLoader']/method[@name='loadInBackground']" />
-->

<attr path="/api/package[@name='com.stripe.android.model']/class[@name='StripeSourceTypeModel']" name="visibility">public</attr>

<attr path="/api/package[@name='com.stripe.android.model']/class[@name='Source']/method[@name='getReceiver']" name="propertyName">SourceReceiver</attr>
<attr path="/api/package[@name='com.stripe.android.model']/class[@name='Source']/method[@name='setReceiver']" name="propertyName">SourceReceiver</attr>

<attr path="/api/package[@name='com.stripe.android.model']/class[@name='Source']/method[@name='getRedirect']" name="propertyName">SourceRedirect</attr>
<attr path="/api/package[@name='com.stripe.android.model']/class[@name='Source']/method[@name='setRedirect']" name="propertyName">SourceRedirect</attr>

<attr path="/api/package[@name='com.stripe.android.model']/class[@name='Source']/method[@name='getCodeVerification']" name="propertyName">SourceCodeVerification</attr>
<attr path="/api/package[@name='com.stripe.android.model']/class[@name='Source']/method[@name='setCodeVerification']" name="propertyName">SourceCodeVerification</attr>

<attr path="/api/package[@name='com.stripe.android.time']/class[@name='Clock']/method[@name='getCalendarInstance']" name="propertyName">SharedCalendar</attr>

<remove-node path="/api/package[@name='com.stripe.android.model']/class[@name='SourceCardData']/method[@name='getAdditionalFields' and count(parameter)=0]" />
<remove-node path="/api/package[@name='com.stripe.android.model']/class[@name='SourceSepaDebitData']/method[@name='getAdditionalFields' and count(parameter)=0]" />

<remove-node path="/api/package[@name='com.stripe.android.model']/class[@name='Card']/method[@name='getType']" />
</metadata>
14 changes: 14 additions & 0 deletions Naxam.Stripe.Droid/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="25.3.1" targetFramework="monoandroid71" />
<package id="Xamarin.Android.Support.Annotations" version="25.3.1" targetFramework="monoandroid71" />
<package id="Xamarin.Android.Support.Compat" version="25.3.1" targetFramework="monoandroid71" />
<package id="Xamarin.Android.Support.Core.UI" version="25.3.1" targetFramework="monoandroid71" />
<package id="Xamarin.Android.Support.Core.Utils" version="25.3.1" targetFramework="monoandroid71" />
<package id="Xamarin.Android.Support.Fragment" version="25.3.1" targetFramework="monoandroid71" />
<package id="Xamarin.Android.Support.Media.Compat" version="25.3.1" targetFramework="monoandroid71" />
<package id="Xamarin.Android.Support.v4" version="25.3.1" targetFramework="monoandroid71" />
<package id="Xamarin.Android.Support.v7.AppCompat" version="25.3.1" targetFramework="monoandroid71" />
<package id="Xamarin.Android.Support.Vector.Drawable" version="25.3.1" targetFramework="monoandroid71" />
<package id="Xamarin.Build.Download" version="0.4.3" targetFramework="monoandroid71" />
</packages>
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Xamarin Stripe Android SDK Binding Library
Xamarin Binding Library for Stripe Android SDK

```
Install-Package Naxam.Stripe.Droid
```
17 changes: 17 additions & 0 deletions Stripe.Droid.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Naxam.Stripe.Droid", "Naxam.Stripe.Droid\Naxam.Stripe.Droid.csproj", "{7815A47B-A3E2-4A84-BED6-CD67DD747C96}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7815A47B-A3E2-4A84-BED6-CD67DD747C96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7815A47B-A3E2-4A84-BED6-CD67DD747C96}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7815A47B-A3E2-4A84-BED6-CD67DD747C96}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7815A47B-A3E2-4A84-BED6-CD67DD747C96}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
Loading

0 comments on commit 4b8791f

Please sign in to comment.